Raw NIF bindings for the RustPython interpreter.
Nothing here blocks a scheduler: session_submit/3 only queues a request on
the session's own OS thread and returns a job id, and the answer is delivered
to the calling process as {tag, reply}.
Use Rupyex instead of calling these directly.
Precompiled
The NIF ships precompiled for the platforms below, so installing Rupyex needs
no Rust toolchain. To build from source instead — for an unlisted platform, or
to work on the crate — set RUPYEX_BUILD=1, or:
config :rustler_precompiled, :force_build, rupyex: trueBuilding needs Rust 1.93+ and takes a few minutes the first time. A debug build of RustPython is slow enough to be misleading, so the crate is always built in release mode.
Summary
Functions
Stop the interpreter thread and release its memory.
Abort a queued or running job.
Start an interpreter thread. Returns the session resource.
Whether the session still accepts requests.
Queue request; the reply is sent to the calling process as {tag, reply}.
Whether this build embeds the Python standard library.
Types
@type session() :: reference()
Opaque handle to a session thread.
Functions
@spec session_close(session()) :: :ok
Stop the interpreter thread and release its memory.
@spec session_interrupt(session(), non_neg_integer()) :: :ok
Abort a queued or running job.
Start an interpreter thread. Returns the session resource.
Whether the session still accepts requests.
@spec session_submit(session(), reference(), tuple() | atom()) :: {:ok, non_neg_integer()} | {:error, atom(), String.t()}
Queue request; the reply is sent to the calling process as {tag, reply}.
Returns {:ok, job_id} — the id session_interrupt/2 can abort — or
{:error, :conversion | :closed, message}.
@spec stdlib_available?() :: boolean()
Whether this build embeds the Python standard library.