Understanding GraalPython – the Python Truffle interpreter
GraalVM provides a Python runtime. The Python runtime is 3.8 version-compliant and is still in the experimental phase at the time of writing this book. In this section, we will install and understand how Python runs on Truffle and Graal. We will also build some sample code, to understand the interoperability features of Graal Python.
Installing Graal Python
Graal Python is an optional runtime and is not installed by default along with GraalVM. To download it, you have to use the Graal Updater tool. The following command downloads and installs Graal Python:
gu install python
To validate the installation, let's run simple Python code. The following is the source code of HelloGraalPython.py
:
print("Hello Graal Python")
It's a very simple Hello World application where we are printing the message. Let's run this application using graalpython
:
graalpython HelloGraalPython.py
...