- Dev Build
Tooling Support for Python
GraalVM’s Python runtime is incomplete and cannot launch the standard Python debugger
However, it can run the tools that GraalVM provides.
graalpython --help:tools command will give you more information about tools currently supported on Python.
To enable debugging, pass the
--inspect option to the
graalpython --inspect -c "breakpoint(); import os; os.exit()" Debugger listening on port 9229. To start debugging, open the following URL in Chrome: chrome-devtools://devtools/bundled/js_app.html?ws=127.0.1.1:9229/76fcb6dd-35267eb09c3
The standard Python built-in
breakpoint() will work using the GraalVM’s Chrome Inspector implementation.
You can inspect variables, set watch expressions, interactively evaluate code snippets, etc.
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).
Code Coverage #
GraalVM comes with a coverage instrument that can be used with
graalpython --help:tools command to see details on how to use it.
In order to work better with existing Python code, the standard library
trace module is partially supported with this low-overhead GraalVM coverage instrument.
So you can do this:
graalpython -m trace -m -c -s my_script.py
This will work similarly to how it would run on CPython.
The programmatic API also works, with some limitations. For example, it does not currently track calls, only line counts and called functions.
_lsprof built-in module has been implemented using the GraalVM
Not all profiling features are currently supported, but basic profiling works:
graalpython -m cProfile -s sort -m ginstall --help
The interactive exploration of a stats output file also works:
graalpython -m cProfile -o ginstall.profile -m ginstall --help graalpython -m pstats ginstall.profile ginstall.profile% callers [...]