Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# GraalPy, the GraalVM Implementation of Python

[![](https://img.shields.io/badge/maven-org.graalvm.polyglot/python-orange)](https://central.sonatype.com/artifact/org.graalvm.polyglot/python)
[![](https://img.shields.io/badge/pyenv-graalpy-blue)](#start-replacing-cpython-with-graalpy)
[![](https://img.shields.io/badge/pyenv-graalpy-blue)](#start-replacing-cpython-with-graalpy)
</a> [![Join Slack][badge-slack]][slack] [![GraalVM on Twitter][badge-twitter]][twitter] [![License](https://img.shields.io/badge/license-UPL-green)](#license)

GraalPy is a high-performance implementation of the Python language for the JVM built on [GraalVM](https://www.graalvm.org/python).
GraalPy is a Python 3.11 compliant runtime.
GraalPy is a high-performance implementation of the Python language for the JVM built on [GraalVM](https://www.graalvm.org/python).
GraalPy is a Python 3.12 compliant runtime.
It has first-class support for embedding in Java and can turn Python applications into fast, standalone binaries.
GraalPy is ready for production running pure Python code and has experimental support for many popular native extension modules.

Expand Down Expand Up @@ -93,9 +93,9 @@ Thanks to our integration with GraalVM Native Image, we can deploy Python applic
pyenv shell graalpy-25.0.1
```
> NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.

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-linux-amd64.tar.gz_ or _graalpy-XX.Y.Z-linux-aarch64.tar.gz_ (depending on your platform) and download.
2. Uncompress the file and update your `PATH` environment variable to include the _graalpy-XX.Y.Z-linux-amd64/bin_ (or _graalpy-XX.Y.Z-linux-aarch64/bin_) directory.

Expand All @@ -112,8 +112,8 @@ Thanks to our integration with GraalVM Native Image, we can deploy Python applic
> NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.

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-amd64.tar.gz_ or _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ (depending on your platform) and download.
2. Remove the quarantine attribute.
```bash
sudo xattr -r -d com.apple.quarantine /path/to/graalpy
Expand All @@ -138,7 +138,7 @@ Thanks to our integration with GraalVM Native Image, we can deploy Python applic
> NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.

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-windows-amd64.tar.gz_ and download.
2. Uncompress the file and update your `PATH` variable to include to the _graalpy-XX.Y.Z-windows-amd64/bin_ directory.

Expand All @@ -165,7 +165,7 @@ GraalPy provides a [special mode](docs/user/Python-on-JVM.md) to facilitate migr
To run Jython scripts, you need to use a GraalPy distribution running on the JVM so you can access Java classes from Python scripts.

* Linux

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-linux-amd64.tar.gz_ or _graalpy-jvm-XX.Y.Z-linux-aarch64.tar.gz_ (depending on your platform) and download.
2. Uncompress the file and update your `PATH` environment variable to include the _graalpy-jvm-XX.Y.Z-linux-amd64/bin_ (or _graalpy-jvm-XX.Y.Z-linux-aarch64/bin_) directory.
3. Run your scripts with `graalpy --python.EmulateJython`.
Expand Down
7 changes: 0 additions & 7 deletions docs/user/Embedding-Permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,3 @@ Known limitations of the Java backend are:

Python native extensions run by default as native binaries, with full access to the underlying system.
See [Embedding limitations](Native-Extensions.md#embedding-limitations)

The context permissions needed to run native extensions are:
```java
.allowIO(IOAccess.ALL)
.allowCreateThread(true)
.allowNativeAccess(true)
```
10 changes: 5 additions & 5 deletions docs/user/Python-Runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Choosing the GraalPy Runtime

GraalPy provides a Python 3.11 compliant runtime.
GraalPy provides a Python 3.12 compliant runtime.
A primary goal is to support PyTorch, SciPy, and their constituent libraries, as well as to work with other data science and machine learning libraries from the rich Python ecosystem.
GraalPy is distributed as an ahead-of-time compiled native executable, compact in size.

Expand Down Expand Up @@ -97,7 +97,7 @@ pyenv shell graalpy-25.0.1

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-amd64.tar.gz_ or _graalpy-XX.Y.Z-macos-aarch64.tar.gz_ (depending on your platform) and download.
2. Remove the quarantine attribute.
```bash
sudo xattr -r -d com.apple.quarantine /path/to/graalpy
Expand All @@ -110,12 +110,12 @@ Alternatively, you can download a compressed GraalPy installation file from [Git

### Windows

1. Find and download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases) that matches the pattern _graalpy-XX.Y.Z-windows-amd64.tar.gz_.
1. Find and download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases) that matches the pattern _graalpy-XX.Y.Z-windows-amd64.tar.gz_.
2. Uncompress the file and update your `PATH` variable to include to the _graalpy-XX.Y.Z-windows-amd64/bin_ directory.

#### Windows Limitations

The Windows distribution of GraalPy has more limitations than its Linux or macOS counterpart, so not all features and packages may be available.
The Windows distribution of GraalPy has more limitations than its Linux or macOS counterpart, so not all features and packages may be available.

It has the following known issues:
- JLine treats Windows as a dumb terminal, with no autocomplete and limited editing capabilities in the REPL
Expand All @@ -131,7 +131,7 @@ It has the following known issues:
## Installing Packages

The best way of using GraalPy is from a [venv](https://docs.python.org/3/library/venv.html) virtual environment.
This generates wrapper scripts and makes the implementation usable from a shell as the standard Python interpreter.
This generates wrapper scripts and makes the implementation usable from a shell as the standard Python interpreter.

1. Create a virtual environment with GraalPy by running the following command:
```bash
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ def ccompile(self, name, check_duplicate_name=True):
# Note: It could be that the C source file's checksum didn't change but someone
# manually deleted the shared library file.
if available_checksum != cur_checksum or not lib_file.exists():
os.makedirs(build_dir, exist_ok=True)
shutil.rmtree(build_dir, ignore_errors=True)
os.makedirs(build_dir)
# MSVC linker doesn't like absolute paths in some parameters, so just run from the build dir
old_cwd = os.getcwd()
os.chdir(build_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private static PFrame materializeFrame(TruffleStackTraceElement element, Materia
assert !PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER || !(unwrapContinuationRoot(rootNode) instanceof PBytecodeDSLRootNode) || location != null : rootNode;
// create the PFrame and refresh frame values
Frame frame = PGenerator.unwrapDSLGeneratorFrame(element);
return materializeFrameNode.execute(location, false, true, frame);
return materializeFrameNode.execute(location, true, true, frame);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static PFrame doEscapeFrame(Frame frameToMaterialize, PFrame escapedFram

// on a freshly created PFrame, we do always sync the arguments
escapedFrame.setGlobals(PArguments.getGlobals(frameToMaterialize));
escapedFrame.setLastCallerFlags(getCallerFlags(forceSync));
escapedFrame.setLastCallerFlags(getCallerFlags(forceSync || syncValuesNode == null));
if (forceSync) {
syncValuesNode.execute(escapedFrame, frameToMaterialize, location);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ public final class PosixConstants {
public static final OptionalIntConstant O_SEARCH;
public static final OptionalIntConstant O_PATH;
public static final OptionalIntConstant O_TTY_INIT;
public static final OptionalIntConstant O_EVTONLY;
public static final OptionalIntConstant O_FSYNC;
public static final OptionalIntConstant O_SYMLINK;
public static final OptionalIntConstant O_NOINHERIT;
public static final OptionalIntConstant O_NOFOLLOW;
public static final OptionalIntConstant O_NOFOLLOW_ANY;
public static final OptionalIntConstant O_NOLINKS;
public static final OptionalIntConstant O_NOATIME;
public static final OptionalIntConstant O_RANDOM;
public static final OptionalIntConstant O_SEQUENTIAL;
public static final OptionalIntConstant O_ASYNC;
public static final MandatoryIntConstant S_IFMT;
public static final MandatoryIntConstant S_IFSOCK;
public static final MandatoryIntConstant S_IFLNK;
Expand Down Expand Up @@ -452,6 +463,17 @@ public final class PosixConstants {
O_SEARCH = reg.createOptionalInt("O_SEARCH");
O_PATH = reg.createOptionalInt("O_PATH");
O_TTY_INIT = reg.createOptionalInt("O_TTY_INIT");
O_EVTONLY = reg.createOptionalInt("O_EVTONLY");
O_FSYNC = reg.createOptionalInt("O_FSYNC");
O_SYMLINK = reg.createOptionalInt("O_SYMLINK");
O_NOINHERIT = reg.createOptionalInt("O_NOINHERIT");
O_NOFOLLOW = reg.createOptionalInt("O_NOFOLLOW");
O_NOFOLLOW_ANY = reg.createOptionalInt("O_NOFOLLOW_ANY");
O_NOLINKS = reg.createOptionalInt("O_NOLINKS");
O_NOATIME = reg.createOptionalInt("O_NOATIME");
O_RANDOM = reg.createOptionalInt("O_RANDOM");
O_SEQUENTIAL = reg.createOptionalInt("O_SEQUENTIAL");
O_ASYNC = reg.createOptionalInt("O_ASYNC");
S_IFMT = reg.createMandatoryInt("S_IFMT");
S_IFSOCK = reg.createMandatoryInt("S_IFSOCK");
S_IFLNK = reg.createMandatoryInt("S_IFLNK");
Expand Down Expand Up @@ -694,7 +716,8 @@ public final class PosixConstants {
_SC_NPROCESSORS_ONLN = reg.createMandatoryInt("_SC_NPROCESSORS_ONLN");

openFlags = new IntConstant[]{O_ACCMODE, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_NONBLOCK, O_NOCTTY, O_NDELAY, O_DSYNC, O_CLOEXEC, O_SYNC, O_DIRECT, O_RSYNC,
O_TMPFILE, O_TEMPORARY, O_DIRECTORY, O_BINARY, O_TEXT, O_XATTR, O_LARGEFILE, O_SHLOCK, O_EXLOCK, O_EXEC, O_SEARCH, O_PATH, O_TTY_INIT};
O_TMPFILE, O_TEMPORARY, O_DIRECTORY, O_BINARY, O_TEXT, O_XATTR, O_LARGEFILE, O_SHLOCK, O_EXLOCK, O_EXEC, O_SEARCH, O_PATH, O_TTY_INIT, O_EVTONLY, O_FSYNC, O_SYMLINK,
O_NOINHERIT, O_NOFOLLOW, O_NOFOLLOW_ANY, O_NOLINKS, O_NOATIME, O_RANDOM, O_SEQUENTIAL, O_ASYNC};
fileType = new IntConstant[]{S_IFMT, S_IFSOCK, S_IFLNK, S_IFREG, S_IFBLK, S_IFDIR, S_IFCHR, S_IFIFO};
mmapFlags = new IntConstant[]{MAP_SHARED, MAP_PRIVATE, MAP_ANONYMOUS, MAP_DENYWRITE, MAP_EXECUTABLE};
mmapProtection = new IntConstant[]{PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ static void getConstants(PosixConstants.Registry constants) {
constants.put("O_EXLOCK", 0x00000020);
constants.put("O_EXEC", 0x40000000);
constants.put("O_SEARCH", 0x40100000);
constants.put("O_EVTONLY", 0x00008000);
constants.put("O_FSYNC", 0x00000080);
constants.put("O_SYMLINK", 0x00200000);
constants.put("O_NOFOLLOW", 0x00000100);
constants.put("O_NOFOLLOW_ANY", 0x20000000);
constants.put("O_ASYNC", 0x00000040);
constants.put("S_IFMT", 0x0000F000);
constants.put("S_IFSOCK", 0x0000C000);
constants.put("S_IFLNK", 0x0000A000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
*/
package com.oracle.graal.python.runtime;

// Auto generated by gen_native_cfg.py at 2025-05-20 13:24:18.395774
// on Linux FrankTheTank 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64
// Auto generated by gen_native_cfg.py at 2025-12-16 11:41:03.832352
// on Linux arisu 6.17.11-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Dec 9 00:25:56 UTC 2025 x86_64
class PosixConstantsLinux {

private PosixConstantsLinux() {
Expand Down Expand Up @@ -93,6 +93,10 @@ static void getConstants(PosixConstants.Registry constants) {
constants.put("O_DIRECTORY", 0x00010000);
constants.put("O_LARGEFILE", 0x00000000);
constants.put("O_PATH", 0x00200000);
constants.put("O_FSYNC", 0x00101000);
constants.put("O_NOFOLLOW", 0x00020000);
constants.put("O_NOATIME", 0x00040000);
constants.put("O_ASYNC", 0x00002000);
constants.put("S_IFMT", 0x0000F000);
constants.put("S_IFSOCK", 0x0000C000);
constants.put("S_IFLNK", 0x0000A000);
Expand Down
Loading