From 4fabb82b4f204417c651827f2626a20a5f61806e Mon Sep 17 00:00:00 2001 From: Betty Mann Date: Fri, 23 Jan 2026 15:43:04 +0000 Subject: [PATCH] [GR-71393] Default to GraalPyResource.contextBuilder, change to 25.0.2 and remove macOS x64 --- .github/scripts/extract_matrix.py | 1 - README.md | 12 ++-- docs/site/02-downloads.md | 57 ------------------- docs/site/_config.yml | 2 +- docs/site/index.md | 5 +- docs/user/Interoperability.md | 11 ++-- docs/user/Python-Runtime.md | 4 +- docs/user/README.md | 7 ++- docs/user/Test-Tiers.md | 1 - .../graal/python/annotations/PythonOS.java | 4 +- .../python/resources/PythonResource.java | 4 +- 11 files changed, 27 insertions(+), 81 deletions(-) diff --git a/.github/scripts/extract_matrix.py b/.github/scripts/extract_matrix.py index 65a0b6bb3b..71321e5847 100644 --- a/.github/scripts/extract_matrix.py +++ b/.github/scripts/extract_matrix.py @@ -77,7 +77,6 @@ # Gitlab Runners OSS OSS = { - "macos-latest": ["darwin", "aarch64"], "ubuntu-latest": ["linux", "amd64"], "ubuntu-24.04-arm": ["linux", "aarch64"], "windows-latest": ["windows", "amd64"] diff --git a/README.md b/README.md index 53c220dee8..b0a0b66253 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Refer to our [embedding documentation](https://www.graalvm.org/latest/reference- * Gradle ```kotlin implementation("org.graalvm.polyglot:polyglot:25.0.2") - implementation("org.graalvm.polyglot:python:25.0.2") + implementation("org.graalvm.python:python-embedding:25.0.2") ``` @@ -115,7 +115,7 @@ Thanks to our integration with GraalVM Native Image, we can deploy Python applic Alternatively, you can download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases). - 1. Find the download that matches the pattern _graalpy-XX.Y.Z-macos-amd64.tar.gz_ or _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ (depending on your platform) and download. + 1. Find the download that matches the pattern _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ and download. 2. Remove the quarantine attribute. ```bash sudo xattr -r -d com.apple.quarantine /path/to/graalpy @@ -124,7 +124,7 @@ Thanks to our integration with GraalVM Native Image, we can deploy Python applic ```bash sudo xattr -r -d com.apple.quarantine ~/.pyenv/versions/graalpy-25.0.2 ``` - 3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-XX.Y.Z-macos-amd64/bin_ (or _graalpy-XX.Y.Z-macos-aarch64/bin_) directory. + 3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-XX.Y.Z-macos-aarch64/bin_ directory. * Windows @@ -174,7 +174,7 @@ To run Jython scripts, you need to use a GraalPy distribution running on the JVM * macOS - 1. Find and download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases) that matches the pattern _graalpy-jvm-XX.Y.Z-macos-amd64.tar.gz_ or _graalpy-jvm-XX.Y.Z-macos-aarch64.tar.gz_ (depending on your platform) and download. + 1. Find and download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases) that matches the pattern _graalpy-jvm-XX.Y.Z-macos-aarch64.tar.gz_ and download. 2. Remove the quarantine attribute. ```bash sudo xattr -r -d com.apple.quarantine /path/to/graalpy @@ -183,7 +183,7 @@ To run Jython scripts, you need to use a GraalPy distribution running on the JVM ```bash sudo xattr -r -d com.apple.quarantine ~/.pyenv/versions/graalpy-25.0.2 ``` - 3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-jvm-XX.Y.Z-macos-amd64/bin_ (or _graalpy-jvm-XX.Y.Z-macos-aarch64/bin_) directory. + 3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-jvm-XX.Y.Z-macos-aarch64/bin_ directory. 4. Run your scripts with `graalpy --python.EmulateJython`. * Windows @@ -222,7 +222,7 @@ Consult the [security guide](./SECURITY.md) for our responsible security vulnera ## License -This GraalVM implementation of Python is Copyright (c) 2017, 2024 Oracle and/or its affiliates and is made available to you under the terms the Universal Permissive License v 1.0 as shown at [https://oss.oracle.com/licenses/upl/](https://oss.oracle.com/licenses/upl/). +This GraalVM implementation of Python is Copyright (c) 2017, 2026 Oracle and/or its affiliates and is made available to you under the terms the Universal Permissive License v 1.0 as shown at [https://oss.oracle.com/licenses/upl/](https://oss.oracle.com/licenses/upl/). This implementation is in part derived from and contains additional code from 3rd parties, the copyrights and licensing of which is detailed in the [LICENSE](./LICENSE.txt) and [THIRD_PARTY_LICENSE](THIRD_PARTY_LICENSE.txt) files. [badge-slack]: https://img.shields.io/badge/Slack-join-active?logo=slack diff --git a/docs/site/02-downloads.md b/docs/site/02-downloads.md index fcf6ca3795..e6a9b17d16 100644 --- a/docs/site/02-downloads.md +++ b/docs/site/02-downloads.md @@ -84,7 +84,6 @@ steps: Linux (aarch64) Linux (amd64) macOS (aarch64) - macOS (amd64) Windows (amd64) @@ -133,20 +132,6 @@ steps: - - - - - - - - - - - - - - @@ -205,20 +190,6 @@ steps: - - - - - - - - - - - - - - @@ -279,20 +250,6 @@ steps: - - - - - - - - - - - - - - @@ -352,20 +309,6 @@ steps: - - - - - - - - - - - - - - diff --git a/docs/site/_config.yml b/docs/site/_config.yml index fc4e23b984..51beefacf6 100644 --- a/docs/site/_config.yml +++ b/docs/site/_config.yml @@ -1,7 +1,7 @@ baseurl: "/python" url: "https://graalvm.org" github: "oracle/graalpython" -language_version: 25.0.1 +language_version: 25.0.2 name: GraalPy permalink: pretty diff --git a/docs/site/index.md b/docs/site/index.md index cab9ad19ae..b90a4e23fb 100644 --- a/docs/site/index.md +++ b/docs/site/index.md @@ -146,7 +146,7 @@ layout: base {%- highlight groovy -%} implementation("org.graalvm.polyglot:polyglot:{{ site.language_version }}") -implementation("org.graalvm.polyglot:python:{{ site.language_version }}") +implementation("org.graalvm.python:python-embedding:{{ site.language_version }}") {%- endhighlight -%}
@@ -163,8 +163,9 @@ implementation("org.graalvm.polyglot:python:{{ site.language_version }}")
{%- highlight java -%} import org.graalvm.polyglot.Context; +import org.graalvm.python.embedding.GraalPyResources; -try (Context context = Context.create()) { +try (Context context = GraalPyResources.contextBuilder().build()) { context.eval("python", "print('Hello from GraalPy!')"); } {%- endhighlight -%} diff --git a/docs/user/Interoperability.md b/docs/user/Interoperability.md index 80862752c2..8283b43721 100644 --- a/docs/user/Interoperability.md +++ b/docs/user/Interoperability.md @@ -252,10 +252,11 @@ This allows other languages to call your Python code directly. Then use it, for example, from Java code: ```java import org.graalvm.polyglot.*; - + import org.graalvm.python.embedding.GraalPyResources; + class Main { public static void main(String[] args) { - try (var context = Context.create()) { + try (var context = GraalPyResources.createContext()) { context.eval(Source.newBuilder("python", "file:///python_script.py").build()); String result = context. @@ -399,10 +400,11 @@ import java.nio.file.Files; import java.nio.file.Path; import org.graalvm.polyglot.Context; +import org.graalvm.python.embedding.GraalPyResources; class Main { public static void main(String[] args) { - try (var context = Context.create()) { + try (var context = GraalPyResources.createContext()) { context.eval("python", Files.readString(Path.of("path/to/interop/behavior/script.py"))); assert context.eval("python", "numpy.float64(12)").asDouble() == 12.0; assert context.eval("python", "numpy.int32(12)").asByte() == 12; @@ -446,12 +448,13 @@ The following snippet sets up the Java environment and makes the object availabl ```java import org.example.MyJavaClass; +import org.graalvm.python.embedding.GraalPyResources; class Main { public static void main(String[] args) { MyJavaClass myJavaObject = new MyJavaClass(42, 17); - try (var context = Context.create()) { + try (var context = GraalPyResources.createContext()) { // myJavaObject will be globally available in example.py as my_java_object context.getBindings("python").putMember("my_java_object", myJavaObject); context.eval(Source.newBuilder("python", "example.py")); diff --git a/docs/user/Python-Runtime.md b/docs/user/Python-Runtime.md index aa20566f44..59e5f10e19 100644 --- a/docs/user/Python-Runtime.md +++ b/docs/user/Python-Runtime.md @@ -97,7 +97,7 @@ pyenv shell graalpy-25.0.2 Alternatively, you can download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases). -1. Find the download that matches the pattern _graalpy-XX.Y.Z-macos-amd64.tar.gz_ or _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ (depending on your platform) and download. +1. Find the download that matches the pattern _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ and download. 2. Remove the quarantine attribute. ```bash sudo xattr -r -d com.apple.quarantine /path/to/graalpy @@ -106,7 +106,7 @@ Alternatively, you can download a compressed GraalPy installation file from [Git ```bash sudo xattr -r -d com.apple.quarantine ~/.pyenv/versions/graalpy-25.0.2 ``` -3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-XX.Y.Z-macos-amd64/bin_ (or _graalpy-XX.Y.Z-macos-aarch64/bin_) directory. +3. Uncompress the file and update your `PATH` environment variable to include to the _graalpy-XX.Y.Z-macos-aarch64/bin_ directory. ### Windows diff --git a/docs/user/README.md b/docs/user/README.md index a37ffff264..4249a08ff7 100644 --- a/docs/user/README.md +++ b/docs/user/README.md @@ -97,7 +97,7 @@ In order to distribute the resulting application for other systems, follow these - Include the GraalPy support and the [GraalVM Polyglot API](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/package-summary.html) in the `dependencies` section: ```bash implementation("org.graalvm.polyglot:polyglot:25.0.2") - implementation("org.graalvm.polyglot:python:25.0.2") + implementation("org.graalvm.python:python-embedding:25.0.2") ``` 3. Finally, replace the code in the file named _App.java_ as follows for a small Python embedding: @@ -105,10 +105,11 @@ In order to distribute the resulting application for other systems, follow these package interop; import org.graalvm.polyglot.*; + import org.graalvm.python.embedding.GraalPyResources; class App { public static void main(String[] args) { - try (var context = Context.create()) { + try (var context = GraalPyResources.createContext()) { System.out.println(context.eval("python", "'Hello Python!'").asString()); } } @@ -157,7 +158,7 @@ In order to distribute the resulting application for other systems, follow these class App { ... public static void main(String[] args) { - try (Context context = GraalPyResources.createContext()) { + try (Context context = GraalPyResources.contextBuilder().build()) { String src = """ from termcolor import colored colored_text = colored("hello java", "red", attrs=["reverse", "blink"]) diff --git a/docs/user/Test-Tiers.md b/docs/user/Test-Tiers.md index 4678e0e7a1..5e20a012b4 100644 --- a/docs/user/Test-Tiers.md +++ b/docs/user/Test-Tiers.md @@ -41,7 +41,6 @@ Pure Python code runs reliably on GraalPy with recent JDKs when JIT compilation | Platform | Notes | |---------------------------------|----------------------------------------------| -| amd64-macos-darwin-graal-latest | macOS on Intel CPUs running Big Sur or newer. | | amd64-windows-msvc-graal-latest | Windows 11, Windows Server 2025, or newer. | | amd64-linux-glibc-oracle-21 | JDK 21 is tested without JIT compilation. | | aarch64-linux-glibc-oracle-21 | JDK 21 is tested without JIT compilation. | diff --git a/graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/PythonOS.java b/graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/PythonOS.java index 9d2e00c622..ed7f588b74 100644 --- a/graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/PythonOS.java +++ b/graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/PythonOS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -48,7 +48,7 @@ public enum PythonOS { PLATFORM_WIN32("win32", "Windows"), PLATFORM_ANY(null, null); - public static final String SUPPORTED_PLATFORMS = "linux/amd64, linux/aarch64, macos/amd64, macos/aarch64, and windows/amd64"; + public static final String SUPPORTED_PLATFORMS = "linux/amd64, linux/aarch64, macos/aarch64, and windows/amd64"; private final String name; private final String uname; diff --git a/graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java b/graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java index 8acd1a9f30..3894c908ce 100644 --- a/graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java +++ b/graalpython/com.oracle.graal.python.resources/src/com/oracle/graal/python/resources/PythonResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 @@ -130,7 +130,7 @@ public void unpackFiles(Env env, Path targetDirectory) throws IOException { throw new IOException("Extracting native resources failed for " + osArch.toString() + ". This means that GraalPy cannot use native extensions and some built-in features that rely on native code will be unavailable. " + - "Currently supported platforms are linux/amd64, linux/aarch64, macos/amd64, macos/aarch64, and windows/amd64. " + + "Currently supported platforms are linux/amd64, linux/aarch64, macos/aarch64, and windows/amd64. " + "If you are running on one of these platforms and are receiving this error, that indicates a bug in this build of GraalPy. " + "If you are running on a different platform and want to keep going with this unsupported configuration, you can specify the system property \"" + ResourcesFilter.EXCLUDE_PROP +