You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With GraalPy, you can distribute Python applications or libraries as standalone binaries or JAR files without any external dependencies.
10
10
The [Truffle framework](https://github.com/oracle/graal/tree/master/truffle) on which GraalPy is built, and the [Sulong LLVM runtime](https://github.com/oracle/graal/tree/master/sulong) that GraalPy leverages for managed execution of Python's native extensions enables users to completely virtualize all filesystem accesses of Python programs, including those to the standard library and installed packages.
11
11
12
-
GraalPy comes with a module that can create standalone binaries or Java project skeletons.
12
+
GraalPy comes with a module that can create standalone binaries or Java-Python polyglot project skeletons.
13
13
The binaries bundle everything into one native executable.
14
-
The Java skeletons are set up with Maven to build and run self-contained JAR files.
15
-
They can also be used to generate a standalone binary from those JAR files later, so Java skeletons offer more flexibility and control over the steps.
14
+
The polyglot skeletons are set up with Maven to to generate a standalone binary for a simple java - python hello world example and can be used as a starting point or inspiration for further java-python polyglot development.
It generates a standalone _my_binary_ file which includes the Python code, the GraalPy runtime, and the Python standard library in a single, self-contained executable.
33
33
Use `graalpy -m standalone native --help` for further options.
34
-
35
-
XXX add polyglot app if implemented
36
34
37
35
## Embedding GraalPy in a Java Application
38
36
39
-
You can distribute the Python script as a JAR file that runs on GraalVM and includes GraalPy.
40
-
To achieve this, run the `java` subcommand of GraalPy's `standalone` module:
37
+
You can also generate a Java-Python polyglot project skeleton.
38
+
To achieve this, run the `polyglot_app` subcommand of GraalPy's `standalone` module:
It creates a Java project _MyJavaApplication_. It includes a _pom.xml_ file that makes it easy to generate a JAR file or a GraalVM native executable with Maven.
44
+
It creates a Java project _MyJavaApplication_. It includes a _pom.xml_ file that makes it easy to generate a GraalVM native executable with Maven.
49
45
You can open this Maven project with any Java IDE and edit the main class that was created to modify the Python embedding.
50
-
To build the application, either use `mvn -Pjar package` to create a JAR file, or `mvn -Pnative package` to create a GraalVM native executable.
46
+
To build the application, either use `mvn -Pnative package` to create a GraalVM native executable.
51
47
52
48
Take a look at the generated _pom.xml_ file.
53
49
There are some options to tweak the performance and footprint trade-off.
0 commit comments