Python¶
Woxi is available on PyPI as a Python package with pre-built wheels for Linux, macOS, and Windows (CPython 3.10+):
API¶
woxi.interpret evaluates Wolfram Language code and returns the
result formatted as Wolfram Language text.
Print output goes to the process stdout,
exactly like woxi eval on the command line:
Session state (variable definitions, function definitions, the RNG seed, …) persists across calls within a thread:
woxi.evaluate captures everything an evaluation produces —
stdout, graphics (as SVG), sound, and warnings —
instead of letting it escape to the terminal:
res = woxi.evaluate('Print["hi"]; Plot[Sin[x], {x, 0, 10}]')
res.result # Final expression value as text
res.stdout # => 'hi\n'
res.graphics # => '<svg …'
res.warnings # => []
Failures raise woxi.WolframError:
Random numbers can be made reproducible:
woxi.seed_rng(1)
a = woxi.interpret("RandomInteger[100]")
woxi.seed_rng(1)
assert woxi.interpret("RandomInteger[100]") == a
woxi.unseed_rng()
Command line¶
The package also installs a woxi command mirroring the core
subcommands of the native CLI:
woxi eval 'Plus[1, 2]' # Evaluate an expression
woxi run script.wls # Run a Wolfram Language file
woxi repl # Interactive session
For the full-featured native CLI (including the Jupyter kernel),
install the Rust binary instead: cargo install woxi.