Python
Execute Python in a secure and isolated runtime environment
This page is about the Python interpreter environment inside the Riza Code Interpreter API. If you’re looking to call the API from Python, head over to the API Client Libraries page.
The environment your Python runs in depends on the underlying Riza environment associated with your runtime.
By default Python runs in our highly-performant WASI environment. If you’re executing Python in a custom runtime, then your Python runs in our microVM environment.
Runtime
Riza runs Python 3.12.0 compiled to WASM (in the default WASI environment) or directly (in the microVM environment). The entire standard library is included.
To add additional packages from PyPI, you’ll need to build a custom runtime. See Adding Packages for more information.
Resource limits
There are no limitations beyond the general limits that apply to all Riza interpreter runtime environments.
See our roadmap for planned future improvements.
Standard I/O
You can write to stdout
and stderr
as you typically would.
You can read from stdin
and access command line arguments and environment
variables, all as you typically would.
Files
The filesystem is read-only in all environments.
You can pass input files via the API using the files
parameter in the WASI environment.
This feature is not yet available in the microVM environment.
See the Files reference for more details.
Accessing the network
Network access is blocked by default, so you need to allow traffic to
individual hosts using the http
request parameter. See the HTTP
reference for a full example.
In the WASI environment
You can make HTTP requests using the requests
or httpx
packages. Protocols other
than HTTP are not supported, and code can’t access the network directly.
In the microVM environment
You can access the network any way you like, but you’ll need to set the (unfortunately
named in this context) http
request parameter to allow traffic to all hosts. Host-specific
network controls are not yet supported.