1
1
# GraalVM Implementation of Python
2
2
3
3
This is an early-stage experimental implementation of Python. A primary goal is
4
- to support SciPy and its constituent libraries. This Python implementation
5
- currently aims to be compatible with Python 3.8, but it is a long way from
6
- there, and it is very likely that any Python program that requires any packages
7
- at all will hit something unsupported. At this point, the Python implementation
8
- is made available for experimentation and curious end-users.
4
+ to support SciPy and its constituent libraries. GraalPython can usually execute
5
+ pure Python code faster than CPython (but not when C extensions are
6
+ involved). The GraalVM Python implementation currently aims to be compatible
7
+ with Python 3.8, but it is a long way from there, and it is very likely that any
8
+ Python program that uses more features of standard library modules or external
9
+ packages will hit something unsupported. At this point, the Python
10
+ implementation is made available for experimentation and curious end-users.
9
11
10
12
### Trying it
11
13
12
- To try it, you can use the bundled releases from
13
- [ www.graalvm.org ] ( https://www.graalvm.org/downloads/ ) . For more information and
14
- some examples of what you can do with it, check out the
15
- [ reference ] ( https://www.graalvm.org/reference-manual/python/ ) .
14
+ The easiest option to try GraalPython is
15
+ [ Pyenv ] ( https://github.com/pyenv/pyenv/ ) , the Python version manager. It allows
16
+ you to easily install different GraalPython releases. To get version 20.2, for
17
+ example, just run ` pyenv install graalpython-20.2 ` .
16
18
17
- ### Create a virtual environment
19
+ To try GraalPython with a full GraalVM, including the support for Java embedding
20
+ and interop with other languages, you can use the bundled releases from
21
+ [ www.graalvm.org ] ( https://www.graalvm.org/downloads/ ) .
18
22
19
- The best way of using the GraalVM implementation of Python is out of a virtual environment. This generates
20
- wrapper scripts and makes the implementation usable from shell as standard Python interpreter. To do so
21
- execute the following in the project directory:
23
+ If you want to build GraalPython from source, checkout this repository and the
24
+ [ mx] ( https://github.com/graalvm/mx ) build tool, and run `mx --dy /compiler
25
+ python-gvm` in the ` graalpython` repository root. If the build is fine, it will
26
+ print the full path to the ` graalpython ` executable as the last line of output.
22
27
23
- Build GraalPython:
28
+ For more information and some examples of what you can do with GraalPython,
29
+ check out the [ reference] ( https://www.graalvm.org/reference-manual/python/ ) .
24
30
25
- ```
26
- mx build
27
- ```
31
+ ### Create a virtual environment
28
32
29
- Create the venv:
33
+ The best way of using the GraalVM implementation of Python is out of a virtual
34
+ environment. To create the venv, run the following:
30
35
31
36
```
32
- mx python -m venv <dir-to-venv>
37
+ graalpython -m venv <dir-to-venv>
33
38
```
34
39
35
40
To activate the environment in your shell session call:
@@ -47,28 +52,28 @@ At the moment not enough of the standard library is implemented to run the
47
52
standard package installers for many packages. As a convenience, we provide a
48
53
simple module to install packages that we know to be working (including
49
54
potential patches required for those packages). Try the following to find out
50
- more :
55
+ which packages are at least partially supported and tested by us in our CI :
51
56
52
57
```
53
- graalpython -m ginstall --help
58
+ graalpython -m ginstall install --help
54
59
```
55
60
56
- As a slightly more exciting example, try:
61
+ As a slightly exciting example, try:
57
62
58
63
```
59
- graalpython -m ginstall install numpy
64
+ graalpython -m ginstall install pandas
60
65
```
61
66
62
- If all goes well (also consider native dependencies of NumPy), you should be
63
- able to ` import numpy ` afterwards.
67
+ If all goes well (also consider native dependencies of NumPy), you should be
68
+ able to ` import numpy ` and ` import pandas ` afterwards.
64
69
65
70
Support for more extension modules is high priority for us. We are actively
66
71
building out our support for the Python C API to make extensions such as NumPy,
67
- SciPy, Scikit-learn, Pandas, Tensorflow and the like work. This work means that
68
- some other extensions might also already work, but we're not actively testing
69
- other extensions right now and cannot promise anything. Note that to try
70
- extensions on this implementation, you have to download, build, and install them
71
- manually for now.
72
+ SciPy, Scikit-learn, Pandas, Tensorflow and the like work fully . This work means
73
+ that some other extensions might also already work, but we're not actively
74
+ testing other extensions right now and cannot promise anything. Note that to try
75
+ other extensions on this implementation, you have to download, build, and
76
+ install them manually for now.
72
77
73
78
### Polyglot Usage
74
79
0 commit comments