{"id":25611119,"url":"https://github.com/graalvm/graalpython","last_synced_at":"2025-02-21T23:01:17.839Z","repository":{"id":37250664,"uuid":"129883600","full_name":"oracle/graalpython","owner":"oracle","description":"GraalPy – A high-performance embeddable Python 3 runtime for Java","archived":false,"fork":false,"pushed_at":"2024-10-29T13:32:36.000Z","size":202807,"stargazers_count":1239,"open_issues_count":44,"forks_count":107,"subscribers_count":58,"default_branch":"master","last_synced_at":"2024-10-29T14:50:25.598Z","etag":null,"topics":["embeddable","graalvm","java","python","python3"],"latest_commit_sha":null,"homepage":"https://www.graalvm.org/python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-17T09:54:59.000Z","updated_at":"2024-10-29T12:41:11.000Z","dependencies_parsed_at":"2024-03-27T05:15:33.923Z","dependency_job_id":"c05b2fd7-b917-445d-a5c1-28fafd64fc3a","html_url":"https://github.com/oracle/graalpython","commit_stats":null,"previous_names":["graalvm/graalpython"],"tags_count":133,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fgraalpython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fgraalpython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fgraalpython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Fgraalpython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle","download_url":"https://codeload.github.com/oracle/graalpython/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100531,"owners_count":19747688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embeddable","graalvm","java","python","python3"],"created_at":"2025-02-21T23:01:10.639Z","updated_at":"2025-02-21T23:01:17.829Z","avatar_url":"https://github.com/oracle.png","language":"Python","readme":"# GraalPy, the GraalVM Implementation of Python\n\n[![](https://img.shields.io/badge/maven-org.graalvm.polyglot/python-orange)](https://central.sonatype.com/artifact/org.graalvm.polyglot/python)\n[![](https://img.shields.io/badge/pyenv-graalpy-blue)](#start-replacing-cpython-with-graalpy) \n\u003c/a\u003e [![Join Slack][badge-slack]][slack] [![GraalVM on Twitter][badge-twitter]][twitter] [![License](https://img.shields.io/badge/license-UPL-green)](#license)\n\nGraalPy is a high-performance implementation of the Python language for the JVM built on [GraalVM](https://www.graalvm.org/python). \nGraalPy is a Python 3.11 compliant runtime.\nIt has first-class support for embedding in Java and can turn Python applications into fast, standalone binaries.\nGraalPy is ready for production running pure Python code and has experimental support for many popular native extension modules.\n\n## Why GraalPy?\n\n**Low-overhead integration with Java and other languages**\n\n* Use [Python in Java](docs/user/Interoperability.md) applications on GraalVM JDK, Oracle JDK, or OpenJDK\n* Use JVM tools like [Maven](docs/user/README.md), JFR, or [GraalVM Native Image](docs/user/Native-Images-with-Python.md)\n* Manage Python libraries' system access thanks to GraalPy's [Java-based emulation of Python OS APIs](docs/user/Embedding-Permissions.md)\n\n**Compatible with the Python ecosystem**\n\n* Use almost any standard Python feature, the CPython tests run on every commit and pass ~85%\n* See if the packages you need work according to our [Python Compatibility Checker](https://www.graalvm.org/python/compatibility/)\n* Support for native extension modules is considered experimental, but you can already install [packages](docs/user/Python-Runtime.md#installing-packages) like *NumPy*, *PyTorch*, or *Tensorflow*; run [Hugging Face](https://huggingface.co/) models like *Stable Diffusion* or *GPT*\n![](docs/user/assets/mcd.svg#gh-light-mode-only)![](docs/user/assets/mcd-dark.svg#gh-dark-mode-only)\u003csup\u003e\nWe run the tests of the [most depended on PyPI packages](https://libraries.io/pypi) every day.\nFor 97% of those packages a recent version can be installed on GraalPy and GraalPy passes over 60% of all tests of all packages combined.\nWe assume that CPython not passing 100% of all tests is due to problems in our infrastructure that may also affect GraalPy.\nPackages where CPython fails all tests are marked as \"not tested\" for both CPython and GraalPy.\n\u003c/sup\u003e\n\n**Runs Python code faster**\n\n* Pure Python code is often faster than on CPython after JIT compilation\n* C extension performance is near CPython, but varies depending on the specific interactions of native and Python code\n* GraalPy is ~4x faster than CPython on the official [Python Performance Benchmark Suite](https://pyperformance.readthedocs.io/)\n![](docs/user/assets/performance.svg#gh-light-mode-only)![](docs/user/assets/performance-dark.svg#gh-dark-mode-only)\u003csup\u003e\nBenchmarks run via `pip install pyperformance \u0026\u0026 pyperformance run` on each of CPython and GraalPy.\nHarness and benchmarks were adapted by hand for Jython due to missing Python 3 support.\nEach interpreter was installed via \u003ctt\u003e[pyenv](https://github.com/pyenv/pyenv)\u003c/tt\u003e.\nGeomean speedup was calculated against CPython on the intersection of benchmarks that run on all interpreters.\n\u003c/sup\u003e\n\n## Getting Started\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ca name=\"start-embedding-graalpy-in-java\"\u003e\u003c/a\u003eEmbedding GraalPy in Java\u003c/strong\u003e\u003c/summary\u003e\n\nGraalPy is [available on Maven Central](https://central.sonatype.com/artifact/org.graalvm.polyglot/python) for inclusion in Java projects.\nRefer to our [embedding documentation](https://www.graalvm.org/latest/reference-manual/embed-languages/) for more details.\n\n* Maven\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eorg.graalvm.polyglot\u003c/groupId\u003e\n      \u003cartifactId\u003epolyglot\u003c/artifactId\u003e\n      \u003cversion\u003e24.1.1\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003eorg.graalvm.polyglot\u003c/groupId\u003e\n      \u003cartifactId\u003epython\u003c/artifactId\u003e\n      \u003cversion\u003e24.1.1\u003c/version\u003e\n      \u003ctype\u003epom\u003c/type\u003e\n  \u003c/dependency\u003e\n  ```\n\n* Gradle\n  ```kotlin\n  implementation(\"org.graalvm.polyglot:polyglot:24.1.1\")\n  implementation(\"org.graalvm.polyglot:python:24.1.1\")\n  ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ca name=\"start-replacing-cpython-with-graalpy\"\u003e\u003c/a\u003eReplacing CPython with GraalPy\u003c/strong\u003e\u003c/summary\u003e\n\nGraalPy should in many cases work as a drop-in replacement for CPython.\nYou can use `pip` to install packages as usual.\nPackages with C code usually do not provide binaries for GraalPy, so they will be automatically compiled during installation.\nThis means that build tools have to be available and installation will take longer.\nWe provide [Github actions](scripts/wheelbuilder) to help you build binary packages with the correct dependencies.\nThanks to our integration with GraalVM Native Image, we can deploy Python applications as [standalone binary](docs/user/Python-Standalone-Applications.md), all dependencies included.\n\n* Linux\n\n  The easiest way to install GraalPy on Linux is to use [Pyenv](https://github.com/pyenv/pyenv) (the Python version manager).\n  To install version 24.1.1 using Pyenv, run the following commands:\n  ```bash\n  pyenv install graalpy-24.1.1\n  ```\n  ```bash\n  pyenv shell graalpy-24.1.1\n  ```\n  \u003e NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.\n  \n  Alternatively, you can download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases).\n  \n  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.\n  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.\n\n* macOS\n\n  The easiest way to install GraalPy on macOS is to use [Pyenv](https://github.com/pyenv/pyenv) (the Python version manager).\n  To install version 24.1.1 using Pyenv, run the following commands:\n  ```bash\n  pyenv install graalpy-24.1.1\n  ```\n  ```bash\n  pyenv shell graalpy-24.1.1\n  ```\n  \u003e NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.\n\n  Alternatively, you can download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases).\n  \n  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. \n  2. Remove the quarantine attribute.\n      ```bash\n      sudo xattr -r -d com.apple.quarantine /path/to/graalpy\n      ```\n      For example:\n      ```bash\n      sudo xattr -r -d com.apple.quarantine ~/.pyenv/versions/graalpy-24.1.1\n      ```\n  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.\n\n* Windows\n\n  The Windows support of GraalPy is still experimental, so not all features and packages may be available.\n  The easiest way to install GraalPy on Windows is to use [Pyenv-win](https://pyenv-win.github.io/pyenv-win/) (the Python version manager for Windows).\n  To install version 24.1.1 using Pyenv-win, run the following commands:\n  ```cmd\n  pyenv install graalpy-24.1.1-windows-amd64\n  ```\n  ```cmd\n  pyenv shell graalpy-24.1.1-windows-amd64\n  ```\n  \u003e NOTE: There will be a delay between GraalPy release and its availability on Pyenv. Make sure to update Pyenv.\n\n  Alternatively, you can download a compressed GraalPy installation file from [GitHub releases](https://github.com/oracle/graalpython/releases).\n  \n  1. Find the download that matches the pattern _graalpy-XX.Y.Z-windows-amd64.tar.gz_ and download.\n  2. Uncompress the file and update your `PATH` variable to include to the _graalpy-XX.Y.Z-windows-amd64/bin_ directory.\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ca name=\"start-using-graalpy-in-github-actions\"\u003e\u003c/a\u003eUsing GraalPy in Github Actions\u003c/strong\u003e\u003c/summary\u003e\n\nThe _setup-python_ action supports GraalPy:\n\n```yaml\n    - name: Setup GraalPy\n      uses: actions/setup-python@v5\n      with:\n        python-version: graalpy # or graalpy24.1 to pin a version\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e\u003ca name=\"start-migrating-jython-scripts-to-graalpy\"\u003e\u003c/a\u003eMigrating Jython Scripts to GraalPy\u003c/strong\u003e\u003c/summary\u003e\n\nMost existing Jython code that uses Java integration will be based on a stable Jython release\u0026mdash;however, these are only available in Python 2.x versions.\nTo migrate your code from Python 2 to Python 3, follow [the official guide from the Python community](https://docs.python.org/3/howto/pyporting.html).\nGraalPy provides a [special mode](docs/user/Python-on-JVM.md) to facilitate migration.\nTo run Jython scripts, you need to use a GraalPy distribution running on the JVM so you can access Java classes from Python scripts.\n\n* Linux\n  \n  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.\n  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.\n  3. Run your scripts with `graalpy --python.EmulateJython`.\n\n* macOS\n\n  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.\n  2. Remove the quarantine attribute.\n      ```bash\n      sudo xattr -r -d com.apple.quarantine /path/to/graalpy\n      ```\n      For example:\n      ```bash\n      sudo xattr -r -d com.apple.quarantine ~/.pyenv/versions/graalpy-24.1.1\n      ```\n  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.\n  4. Run your scripts with `graalpy --python.EmulateJython`.\n\n* Windows\n\n  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-windows-amd64.tar.gz_.\n  2. Uncompress the file and update your `PATH` variable to include to the _graalpy-jvm-XX.Y.Z-windows-amd64/bin_ directory.\n  3. Run your scripts with `graalpy --python.EmulateJython`.\n\n\u003c/details\u003e\n\n### Examples\n![](docs/showcase.png)\u003csup\u003e\n[Java AWT app with Python graph library](https://github.com/timfel/graalpy-jbang) using [JBang](https://www.jbang.dev/)  |  [Standalone binary](https://github.com/timfel/racing-all-afternoon) of a Python game by [Joey Navarro](https://github.com/josephnavarro/racing-all-afternoon) with all dependencies included.\n\u003c/sup\u003e\n\n## Documentation\n\n[GraalPy Quick Reference Sheet](https://www.graalvm.org/uploads/quick-references/GraalPy_v1/quick-reference-graalpy-v1(eu_a4).pdf) should help you get started.\nMore GraalPy-specific user documentation is available in [docs/user](docs/user).\nGeneral documentation about [polyglot programming](https://www.graalvm.org/latest/reference-manual/polyglot-programming/) and [language embedding](https://www.graalvm.org/latest/reference-manual/embed-languages/) is available on the GraalVM website.\n\n## Community\n\nThe best way to get in touch with us is to join the `#graalpy` channel on [GraalVM Slack][slack] or [tweet us][twitter].\n\n## Contributing\n\nThis project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md).\n\nIf you're thinking about contributing something to this repository, you will need to sign the [Oracle Contributor Agreement](https://www.graalvm.org/community/contributors/) for us to able to merge your work.\nAlso take a look at the [code of conduct](https://www.graalvm.org/community/conduct/) for contributors.\n\n## Security\n\nConsult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process.\n\n## License\n\nThis 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/).\nThis 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.\n\n[badge-slack]: https://img.shields.io/badge/Slack-join-active?logo=slack\n[badge-twitter]: https://img.shields.io/badge/Twitter-@graalvm-active?logo=twitter\n[slack]: https://www.graalvm.org/slack-invitation/\n[twitter]: https://twitter.com/graalvm\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraalvm%2Fgraalpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraalvm%2Fgraalpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraalvm%2Fgraalpython/lists"}