Snex.Interpreter (Snex v0.1.0)
View SourceRuns a Python interpreter in a separate OS process.
This module is responsible for facilitating in-and-out communication between Elixir and the spawned Python interpreter.
Usually you won't interact with this module directly.
Instead, you would create a custom interpreter module with use Snex.Interpreter:
defmodule SnexTest.NumpyInterpreter do
use Snex.Interpreter,
pyproject_toml: """
[project]
name = "my-numpy-project"
version = "0.0.0"
requires-python = "==3.11.*"
dependencies = ["numpy>=2"]
"""
endSee the Snex module documentation for more detail.
Summary
Functions
Returns a specification to start this module under a supervisor.
Starts a new Python interpreter.
Types
@type option() :: {:python, String.t()} | {:environment, %{optional(String.t()) => String.t()}} | GenServer.option()
Options for start_link/1.
@type server() :: GenServer.server()
Running instance of Snex.Interpreter.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link([option()]) :: GenServer.on_start()
Starts a new Python interpreter.
The interpreter can be used by functions in the Snex module.
Options
:python- The Python executable to use. This can be a full path or a command to find viaSystem.find_executable/1.:environment- A map of environment variables to set when running the Python executable.- any other options will be passed to
GenServer.start_link/3.