nemo_gym.server_runtime.supervisor.server_venv
nemo_gym.server_runtime.supervisor.server_venv
Module Contents
Functions
Data
NEMO_GYM_ALLOWED_COMPONENT_ROOTS_ENV_VAR_NAME
API
Build uv pip install flags for nemo-gym in sub-venvs.
Supports:
- Pre-release versions via NEMO_GYM_ALLOW_PRERELEASE=true
- Custom PyPI indexes via UV_INDEX_URL, UV_EXTRA_INDEX_URL, UV_INDEX_STRATEGY
- Auto-detection of parent venv version for consistency
Returns: str
String of flags to add to ‘uv pip install nemo-gym’
Detect nemo-gym version from parent venv and return version specifier.
Returns: str
Version specifier string (e.g., “==0.2.1rc0”) or empty string
Whether skip_venv_if_present may reuse venv_path: it needs the marker written after a successful setup.
A cancelled install leaves bin/python and bin/activate without its packages, so those alone are not enough.
A server outside Gym’s own servers: in no Gym checkout, and not shipped inside the installed wheel.
Its lock pins its own Gym source, so the locked installer would skip the parent’s Gym; the legacy installer gives it the parent’s editable checkout or the parent’s published version instead.
Whether root is a NeMo Gym source checkout, not just any project with a pyproject.toml.
A server directory two levels below a Gym checkout installs Gym from that checkout. An external
repository that keeps its own servers in resources_servers/<name> has a pyproject.toml of its
own and gets Gym from the parent installation instead.
The extras a server requests on its Gym requirement lines, formatted as [a,b], or "" for none.
A server outside a Gym checkout gets Gym from its parent installation instead of its own nemo-gym[...] line, so
the line’s extras must be carried over or their dependencies are never installed.
The extras requested on the Gym requirements among requirements, formatted as [a,b], or "" for none.
Whether a uv Python request admits version.
The request is a specifier such as >=3.13,<3.14 or a version such as 3.13, optionally prefixed with
cpython@ or cpython. Requests this cannot interpret, such as pypy@3.10 or the free-threaded
3.13+freethreaded, admit nothing and are left to uv.
The interpreter a server venv is built with: the parent’s, unless the server’s .python-version excludes it.
A range such as >=3.13.14,<3.14 would otherwise let uv pick a different patch release than the parent’s,
and Ray refuses to connect processes whose Python patch versions differ.
Reject a server resolved outside scheduler-approved component roots.
Resolve the venv a server runs from: uv_venv_dir/<type>/<name>/.venv, else <server dir>/.venv.
Callers need this to launch a server with the venv’s own interpreter rather than trusting whatever
bin/activate puts on PATH. A venv copied or moved after creation keeps the original prefix
hard-coded in bin/activate, so sourcing it silently hands the server a different interpreter than
the one uv_venv_dir asked for.
Prepare a component from its lock, or retain custom component setup.