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
Copy file name to clipboardExpand all lines: docs/user/FAQ.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ For native extensions running as LLVM bitcode, CPython is currently slower -- yo
46
46
### I heard languages with JIT compilers have slow startup. Is that true for GraalVM's Python runtime?
47
47
48
48
It depends.
49
-
When you use [Native Image](https://www.graalvm.org/reference-manual/native-image/) with Python, or the `graalpython` launcher of GraalVM, startup is competitive with CPython.
49
+
When you use [Native Image](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/README.md) with Python, or the `graalpython` launcher of GraalVM, startup is competitive with CPython.
50
50
In any case, both with Native Image or when running on the JVM, you first need to warm up to reach peak performance. This is a complicated story in itself, but, in general, it can take a while (a minute or two) after you have reached and are running your core workload.
51
51
52
52
### Can I share warmed-up code between multiple Python contexts?
See [Polyglot Programming](https://www.graalvm.org/reference-manual/polyglot-programming/) and [Embed Languages](https://www.graalvm.org/reference-manual/embed-languages/) for more information about interoperability with other programming languages.
191
+
See [Polyglot Programming](https://github.com/oracle/graal/blob/master/docs/reference-manual/polyglot-programming.md) and [Embed Languages](https://github.com/oracle/graal/blob/master/docs/reference-manual/embedding/embed-languages.md) for more information about interoperability with other programming languages.
192
192
193
193
## The Behaviour of Types
194
194
@@ -197,18 +197,12 @@ ways and have restrictions on how they can interact with Python.
197
197
198
198
### Interop Types to Python
199
199
200
-
Most importantly and upfront - all foreign objects passing into Python have the
201
-
Python type `foreign`. There is no emulation of i.e., objects that are interop
202
-
booleans to have the Python type `bool`. This is because interop types can
203
-
overlap in ways that the Python builtin types cannot, and it would not be clear
204
-
what should take precendence. Instead, the `foreign` type defines all of the
205
-
Python special methods for type conversion that are used throughout the
206
-
interpreter (methods like `__add__`, `__int__`, `__str__`, `__getitem__` etc)
207
-
and these try to do the right thing based on the interop type (or raise an
208
-
exception.)
209
-
210
-
Types not listed in the below table have no special interpretation in Python
211
-
right now.
200
+
Most importantly and upfront - all foreign objects passing into Python have the Python type `foreign`.
201
+
There is no emulation of i.e., objects that are interop booleans to have the Python type `bool`.
202
+
This is because interop types can overlap in ways that the Python builtin types cannot, and it would not be clear what should take precendence.
203
+
Instead, the `foreign` type defines all of the Python special methods for type conversion that are used throughout the interpreter (methods like `__add__`, `__int__`, `__str__`, `__getitem__`, etc.) and these try to do the right thing based on the interop type (or raise an exception.)
204
+
205
+
Types not listed in the below table have no special interpretation in Python right now.
Copy file name to clipboardExpand all lines: docs/user/Jython.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,4 +245,4 @@ There are no APIs particular to Python that are exposed, and everything is done
245
245
246
246
It is important to note that as long as your application is executed on GraalVM with the Python language installed,
247
247
you can embed Python in your programs.
248
-
For more details, refer to the [Embed Languages](https://www.graalvm.org/reference-manual/embed-languages/) guide.
248
+
For more details, refer to the [Embed Languages](https://github.com/oracle/graal/blob/master/docs/reference-manual/embedding/embed-languages.md) guide.
Truffle based GraalVM languages usually implement the system related
4
-
functions using the [Truffle abstraction layer](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/), which is OS independent
5
-
and provides extension points for the users when embedding GraalVM Python
6
-
or other Truffle based languages into Java applications. See, for example,
Truffle-based GraalVM languages usually implement the system related functions using the [Truffle abstraction layer](https://github.com/oracle/graal/blob/master/truffle/docs/README.md), which is OS independent and provides extension points for the users when embedding GraalVM Python or other Truffle based languages into Java applications.
11
+
See, for example, [Truffle FileSystem service-provider](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html).
8
12
9
-
The Python standard library also provides OS abstraction, but exposes lower level interfaces,
10
-
for instance, the OS module directly exposes some POSIX functions. On non-POSIX platforms,
11
-
this interface is emulated to a degree.
13
+
The Python standard library also provides OS abstraction, but exposes lower level interfaces, for instance, the OS module directly exposes some POSIX functions.
14
+
On non-POSIX platforms, this interface is emulated to a degree.
12
15
13
-
GraalVM Python runtime provides two alternative implementations of the system related
14
-
functionality offered by the builtin Python modules such as `os`.
15
-
Which implementation is used can be controlled by the option `PosixModuleBackend`:
16
-
valid values are `native` and `java`.
16
+
GraalVM Python runtime provides two alternative implementations of the system related functionality offered by the builtin Python modules such as `os`.
17
+
Which implementation is used can be controlled by the option `PosixModuleBackend`: valid values are `native` and `java`.
17
18
18
19
## Native backend
19
20
20
-
The `native` backend calls directly the POSIX API in mostly the same way
21
-
as CPython, the reference Python implementation, does.
21
+
The `native` backend calls directly the POSIX API in mostly the same way as CPython, the reference Python implementation, does.
22
22
23
-
This approach is the most compatible with CPython and provides bare access
24
-
to the underlying OS interface without any emulation layer in between.
23
+
This approach is the most compatible with CPython and provides bare access to the underlying OS interface without any emulation layer in between.
25
24
26
-
By default, this implementation bypasses the Truffle abstraction layer,
27
-
therefore it is not sandboxed and does not support custom implementations
28
-
of [Truffle FileSystem service-provider](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html)
29
-
and other Polyglot API providers related to system interfaces.
25
+
By default, this implementation bypasses the Truffle abstraction layer, therefore it is not sandboxed and does not support custom implementations of [Truffle FileSystem service-provider](https://www.graalvm.org/truffle/javadoc/org/graalvm/polyglot/io/FileSystem.html) and other Polyglot API providers related to system interfaces.
30
26
31
-
The native backend is chosen by default when GraalVM Python
32
-
is started via the `graalpython` or any other Python related
33
-
launcher inside GraalVM. The exception are Python related launchers
34
-
with `-managed` suffix available only in GraalVM Enterprise
35
-
(e.g., `graalpython-managed`), which by default use the `java` POSIX backend.
27
+
The native backend is chosen by default when GraalVM Python is started via the `graalpython` or any other Python related launcher inside GraalVM.
28
+
The exception are Python related launchers with `-managed` suffix available only in GraalVM Enterprise (e.g., `graalpython-managed`), which by default use the `java` POSIX backend.
36
29
37
30
### Limitations of the native backend
38
31
@@ -43,21 +36,15 @@ Known limitations:
43
36
44
37
## Java backend
45
38
46
-
The `java` backend uses the [Truffle abstraction layer](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/)
47
-
and therefore supports custom Polyglot API providers related to system interfaces and sandboxing.
48
-
Since this abstraction is POSIX agnostic, it does not expose
49
-
all the necessary functionality. Some functionality is emulated, and some
50
-
functionality is not supported at all.
39
+
The `java` backend uses the [Truffle abstraction layer](https://github.com/oracle/graal/blob/master/truffle/docs/README.md) and therefore supports custom Polyglot API providers related to system interfaces and sandboxing.
40
+
Since this abstraction is POSIX agnostic, it does not expose all the necessary functionality. Some functionality is emulated, and some functionality is not supported at all.
51
41
52
-
The java backend is the default when GraalVM Python is run via
53
-
the `Context` API, i.e., [embedded in Java applications](https://www.graalvm.org/reference-manual/embed-languages), or when it is launched using Python related launchers
54
-
with `-managed` suffix available only in GraalVM Enterprise.
42
+
The java backend is the default when GraalVM Python is run via the `Context` API, i.e., [embedded in Java applications](https://github.com/oracle/graal/blob/master/docs/reference-manual/embedding/embed-languages.md), or when it is launched using Python related launchers with `-managed` suffix available only in GraalVM Enterprise.
55
43
56
44
### Limitations of the emulated backend
57
45
58
-
GraalVM Python can log info about known incompatibility of functions executed at runtime,
59
-
which includes the OS interface related functions. To turn on this logging use
60
-
`--log.python.compatibility=FINE` or other desired logging level.
46
+
GraalVM Python can log info about known incompatibility of functions executed at runtime, which includes the OS interface related functions.
47
+
To turn on this logging, use `--log.python.compatibility=FINE` or other desired logging level.
61
48
62
49
Known limitations of the emulated layer are:
63
50
@@ -76,12 +63,8 @@ Known limitations of the emulated layer are:
76
63
77
64
## Relation to Python native extensions
78
65
79
-
Apart from operating system interfaces exposed as builtin Python level modules,
80
-
Python native extensions executed via the GraalVM LLVM runtime may also access
81
-
OS interfaces at the C level. How such accesses are handled depends on the
82
-
GraalVM LLVM runtime configuration.
66
+
Apart from operating system interfaces exposed as builtin Python level modules, Python native extensions executed via the GraalVM LLVM runtime may also access OS interfaces at the C level.
67
+
How such accesses are handled depends on the GraalVM LLVM runtime configuration.
83
68
84
-
At this point, the only combination where OS handles, such as file descriptors,
85
-
can be shared between Python and the C code of Python extensions is with
86
-
`native` PosixModuleBackend and `native` mode of GraalVM LLVM runtime.
87
-
This combination is the default for the `graalpython` launcher.
69
+
At this point, the only combination where OS handles, such as file descriptors, can be shared between Python and the C code of Python extensions is with `native` PosixModuleBackend and `native` mode of GraalVM LLVM runtime.
70
+
This combination is the default for the `graalpython` launcher.
Copy file name to clipboardExpand all lines: docs/user/ParserDetails.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This guide elaborates on how Python files are parsed on the GraalVM Python runti
14
14
15
15
Creating the abstract syntax tree (AST) for a Python source has two phases.
16
16
The first one creates a simple syntax tree (SST) and a scope tree.
17
-
The second phase transforms the SST to the [Language Implementation framework](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/) tree.
17
+
The second phase transforms the SST to the [Truffle Language Implementation framework](https://github.com/oracle/graal/blob/master/truffle/docs/README.md) tree.
18
18
19
19
For the transformation, the scope tree it needed.
20
20
The scope tree contains scope locations for variable and function definitions, and information about scopes.
Copy file name to clipboardExpand all lines: docs/user/README.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,12 @@ See [FAQ](FAQ.md) for commonly asked questions about this implementation.
15
15
16
16
## Installing Python
17
17
18
-
The Python runtime is not provided by default, and can be added to GraalVM with the [GraalVM Updater](https://www.graalvm.org/reference-manual/graalvm-updater), `gu`, tool:
18
+
The Python runtime is not provided by default, and can be added to GraalVM with the [GraalVM Updater](https://github.com/oracle/graal/blob/master/docs/reference-manual/graalvm-updater.md), `gu`, tool:
19
19
```shell
20
20
gu install python
21
21
```
22
22
23
-
The above command will install Python from the GitHub catalog for GraalVM Community Edition users.
24
-
For GraalVM Enterprise users, the [manual installation](https://www.graalvm.org/reference-manual/graalvm-updater/#manual-installation) is required.
23
+
The above command will install Python from the catalog.
25
24
26
25
## Running Python
27
26
@@ -70,7 +69,7 @@ For more information, continue reading to the [Installing Supported Packages](Pa
70
69
71
70
## Native Image and JVM Runtime
72
71
73
-
By default, GraalVM runs Python from a binary, compiled ahead-of-time with [Native Image](https://www.graalvm.org/reference-manual/native-image/), yielding faster startup time and lower footprint.
72
+
By default, GraalVM runs Python from a binary, compiled ahead-of-time with [Native Image](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/README.md), yielding faster startup time and lower footprint.
74
73
Although the ahead-of-time compiled binary includes the Python and LLVM interpreters, in order to interoperate with
75
74
other languages you have to supply the `--jvm` argument.
76
75
This instructs the launcher to run on the JVM instead of in Native Image mode.
The standard Python built-in `breakpoint()` will work using the [GraalVM's Chrome Inspector](https://www.graalvm.org/tools/chrome-debugger/) implementation.
24
+
The standard Python built-in `breakpoint()` will work using the [GraalVM's Chrome Inspector](https://github.com/oracle/graal/blob/master/docs/tools/chrome-debugger.md) implementation.
25
25
You can inspect variables, set watch expressions, interactively evaluate code snippets, etc.
26
26
However, this only works if you pass `--inspect` or some other inspect option. Otherwise, `pdb` is triggered as on CPython (and does not currently work).
0 commit comments