You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Note that the action will override the existing lock file.*
122
166
123
-
## GraalPy Gradle Plugin Configuration
167
+
For more information on managing Python packages, please refer to the descriptions of
168
+
the `graalPyLockFile` and `packages` fields in the [plugin configuration](#maven-plugin-configuration), as well as the [Python Dependency Management](#python-dependency-management) section
169
+
above in this document.
124
170
171
+
## GraalPy Gradle Plugin
172
+
173
+
### Gradle Plugin Configuration
125
174
The plugin must be added to the plugins section in the _build.gradle_ file.
126
175
The **version** property defines which version of GraalPy to use.
127
176
```
@@ -146,6 +195,15 @@ The plugin can be configured in the `graalPy` block:
146
195
}
147
196
```
148
197
198
+
- The **graalPyLockFile** element can specify an alternative path to a GraalPy lock file.
199
+
Default value is `$rootDir/graalpy.lock`.
200
+
```
201
+
graalPy {
202
+
graalPyLockFile = file("$rootDir/graalpy.lock")
203
+
...
204
+
}
205
+
```
206
+
149
207
- The **resourceDirectory** element can specify the relative [Java resource path](#java-resource-path).
150
208
Remember to use `VirtualFileSystem$Builder#resourceDirectory` when configuring the `VirtualFileSystem` in Java.
151
209
```
@@ -168,8 +226,18 @@ dependency `org.graalvm.python:python` to the community build: `org.graalvm.pyth
168
226
...
169
227
}
170
228
```
229
+
### Locking Python Packages
230
+
To lock the dependency tree of the specified Python packages, execute the GraalPy plugin task `graalPyLockPackages`.
231
+
```bash
232
+
$ gradle graalPyLockPackages
233
+
```
234
+
*Note that the action will override the existing lock file.*
235
+
236
+
For more information on managing Python packages, please refer to the descriptions of
237
+
the `graalPyLockFile` and `packages` fields in the [plugin configuration](#gradle-plugin-configuration), as well as the [Python Dependency Management](#python-dependency-management) sections
238
+
in this document.
171
239
172
-
###Related Documentation
240
+
## Related Documentation
173
241
174
242
*[Embedding Graal languages in Java](https://www.graalvm.org/reference-manual/embed-languages/)
175
243
*[Permissions for Python Embeddings](Embedding-Permissions.md)
Copy file name to clipboardExpand all lines: graalpython/com.oracle.graal.python.test.integration/src/org/graalvm/python/embedding/test/integration/GraalPyResourcesUtilsTests.java
+1-1
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@
48
48
importjava.nio.file.Path;
49
49
50
50
/**
51
-
* Siple copy of GraalPyResourcesTests to test also the deprecated
51
+
* Simple copy of GraalPyResourcesTests to test also the deprecated
Copy file name to clipboardExpand all lines: graalpython/com.oracle.graal.python.test.integration/src/org/graalvm/python/embedding/test/integration/VirtualFileSystemIntegrationUtilsTest.java
+1-1
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@
71
71
importstaticorg.junit.Assert.assertTrue;
72
72
73
73
/**
74
-
* Siple copy of VirtualFileSystemIntegrationTest to test also the deprecated
74
+
* Simple copy of VirtualFileSystemIntegrationTest to test also the deprecated
Copy file name to clipboardExpand all lines: graalpython/com.oracle.graal.python.test/src/org/graalvm/python/embedding/cext/test/MultiContextCExtTest.java
+78-68
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
2
+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* The Universal Permissive License (UPL), Version 1.0
assertTrue("created a copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup0")));
194
-
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup1")));
195
-
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
203
+
assertTrue("created a copy of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup0")));
204
+
assertTrue("created another copy of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup1")));
205
+
assertFalse("created no more copies of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
@@ -211,7 +221,7 @@ public void testCreatingVenvForMulticontext() throws IOException {
211
221
// First one works
212
222
varr1 = c1.eval(code);
213
223
assertEquals("tiny_sha3", r1.asString());
214
-
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
224
+
assertFalse("created no more copies of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
215
225
// Second one works because of isolation
216
226
varr2 = c2.eval(code);
217
227
assertEquals("tiny_sha3", r2.asString());
@@ -221,10 +231,10 @@ public void testCreatingVenvForMulticontext() throws IOException {
221
231
// first context is unaffected
222
232
r1 = c1.eval(code);
223
233
assertEquals("tiny_sha3", r1.asString());
224
-
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
234
+
assertFalse("created no more copies of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
225
235
// Third one works and triggers a dynamic relocation
226
236
c3.eval(code);
227
-
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
237
+
assertTrue("created another copy of the capi", Files.list(venvDir).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
228
238
// Fourth one does not work because we changed the sys.prefix
0 commit comments