diff --git a/graalpy/graalpy-freeze-dependencies-guide/README.md b/graalpy/graalpy-freeze-dependencies-guide/README.md
index 299b892..3018c05 100644
--- a/graalpy/graalpy-freeze-dependencies-guide/README.md
+++ b/graalpy/graalpy-freeze-dependencies-guide/README.md
@@ -61,6 +61,18 @@ Most Python packages are hosted on [PyPI](https://pypi.org) and can be installed
The Python ecosystem has conventions about the filesystem layout of installed packages that need to be kept in mind when embedding into Java.
You can use the GraalPy plugins for Maven or Gradle to manage Python packages for you.
+For Maven, add dependency on GraalPy runtime, and configure the GraalPy Maven plugin:
+
+`pom.xml`
+```xml
+
+ org.graalvm.polyglot
+ python
+ 24.1.1
+ pom
+
+```
+
`pom.xml`
```xml
@@ -86,6 +98,8 @@ You can use the GraalPy plugins for Maven or Gradle to manage Python packages fo
```
+For Gradle, add the GraalPy plugin, configure it, and add the dependency on the GraalPy runtime:
+
`build.gradle.kts`
```kotlin
plugins {
@@ -99,6 +113,10 @@ plugins {
graalPy {
packages = setOf("vaderSentiment==3.3.2") // ①
}
+
+dependencies {
+ implementation("org.graalvm.python:python:24.1.1")
+}
```
❶ The `packages` section lists all Python packages optionally with [requirement specifiers](https://pip.pypa.io/en/stable/reference/requirement-specifiers/).
@@ -116,7 +134,7 @@ in a newly created [virtual environment](https://docs.python.org/3/library/venv.
```
```shell
-./gradlew build
+./gradlew assemble
```
If the compilation is successful, one can run the following command to get versions of all the installed Python packages if you use Maven:
@@ -135,12 +153,12 @@ If you are using Gradle, run the following command:
On macOS and Linux:
```shell
-./build/generated/graalpy/resources/org.graalvm.python.vfs/venv/bin/pip3 freeze -l
+./app/build/generated/graalpy/resources/org.graalvm.python.vfs/venv/bin/pip3 freeze -l
```
On Windows:
```shell
-.\build\generated\graalpy\resources\org.graalvm.python.vfs\venv\Scripts\pip3.exe freeze -l
+.\app\build\generated\graalpy\resources\org.graalvm.python.vfs\venv\Scripts\pip3.exe freeze -l
```
The output will look something like this:
diff --git a/graalpy/graalpy-freeze-dependencies-guide/build.gradle.kts b/graalpy/graalpy-freeze-dependencies-guide/build.gradle.kts
index 18dcdf4..806fa2f 100644
--- a/graalpy/graalpy-freeze-dependencies-guide/build.gradle.kts
+++ b/graalpy/graalpy-freeze-dependencies-guide/build.gradle.kts
@@ -3,10 +3,17 @@ plugins {
id("org.graalvm.python") version "24.1.1"
}
+// To make the paths of this reference solution (without 'app' subdirectory for sources)
+// and "gradle init ..." based solution (with sources in 'app') the same for README.md
+layout.buildDirectory.set(layout.projectDirectory.dir("app/build"))
+
if ("true".equals(System.getProperty("no.transitive.dependencies"))) {
graalPy {
packages = setOf("vaderSentiment==3.3.2") // ①
}
+ dependencies {
+ implementation("org.graalvm.python:python:24.1.1")
+ }
} else {
// The default profile shows the end result: all our transitive
// dependencies are explicitly pinned to a specific version.
@@ -20,6 +27,9 @@ if ("true".equals(System.getProperty("no.transitive.dependencies"))) {
"urllib3==2.2.2"
)
}
+ dependencies {
+ implementation("org.graalvm.python:python:24.1.1")
+ }
}
repositories {
@@ -29,10 +39,8 @@ repositories {
}
}
-dependencies {
- implementation("org.graalvm.python:python:24.1.1") // ①
- implementation("org.graalvm.python:python-embedding:24.1.1") // ③
-}
+// This dependency is necessary only for the example Java code, not for building and running pip freeze:
+dependencies.add("implementation", "org.graalvm.python:python-embedding:24.1.1")
group = "org.example"
version = "1.0-SNAPSHOT"
diff --git a/graalpy/graalpy-freeze-dependencies-guide/pom.xml b/graalpy/graalpy-freeze-dependencies-guide/pom.xml
index ab8211b..05d166e 100644
--- a/graalpy/graalpy-freeze-dependencies-guide/pom.xml
+++ b/graalpy/graalpy-freeze-dependencies-guide/pom.xml
@@ -18,14 +18,15 @@
org.graalvm.polyglot
- python
+ python
24.1.1
- pom
+ pom
+
org.graalvm.python
- python-embedding
+ python-embedding
24.1.1