nemo_gym
nemo_gym
Subpackages
nemo_gym.agentsnemo_gym.artifactsnemo_gym.clinemo_gym.clientnemo_gym.confignemo_gym.corenemo_gym.datanemo_gym.environmentnemo_gym.evalnemo_gym.metricsnemo_gym.modelsnemo_gym.orchestrationnemo_gym.rolloutsnemo_gym.sandboxnemo_gym.server_runtimenemo_gym.telemetrynemo_gym.trajectorynemo_gym.utilsnemo_gym.verificationnemo_gym.verifiersnemo_gym.web
Submodules
Package Contents
Functions
Data
NEMO_GYM_EXTRA_ROOTS_ENV_VAR_NAME
API
Put the artifact roots on sys.path so plugin modules (e.g. a benchmark’s prepare.py) import.
Extra roots go to the front. Editable installs move cwd/PARENT_DIR (the built-ins) to the end;
non-editable installs preserve existing import order and append those roots only when missing.
Use explicit extra roots (or --search-dir) to override both files and modules of an installed
built-in, since cwd-first file lookup does not necessarily match non-editable import precedence.
Idempotent; reads NEMO_GYM_EXTRA_ROOTS at call time, so it can be re-run after --search-dir folds
roots into the env (see nemo_gym.cli.main).
Resolve a possibly-relative path for reading a built-in or user-supplied file against the ordered
component_search_roots.
Absolute paths are returned unchanged. A relative path is returned rooted at the first root where it
exists (earliest-wins: extra roots > cwd > install root), so a repo-relative path like
benchmarks/<name>/config.yaml or resources_servers/<env>/data/example.jsonl resolves by name
from any cwd or plugin root. validator overrides the default Path.exists check — pass it when a
candidate is valid only if specific markers are present (e.g. a server dir must ship
pyproject.toml and uv.lock). If nothing matches, the path under the highest-priority
root is returned so error messages point at the user’s own location.
Use this for read paths only — never for write targets (e.g. metrics written next to a dataset), which must stay relative to the user’s writable cwd rather than the install root.
Ordered, de-duplicated roots to look for a Gym component/artifact under: the NEMO_GYM_EXTRA_ROOTS
roots first, then cwd and the install root (PARENT_DIR, the built-ins) last.
Earlier roots win on a name collision, so user components shadow built-ins. De-duplicated by resolved
path, since cwd/install root coincide in an editable checkout. The single source of truth for where Gym
looks for components — used by path resolution (_resolve_under_cwd_or_install), module imports
(_augment_sys_path) and the gym list/gym search discovery functions.
sys_path weaves existing import paths in after the extra roots. Editable installs move cwd and the
install root to the end. Non-editable installs preserve existing entry order and append cwd and the
install root only when missing: moving a shared install root behind cwd would shadow dependencies,
while demoting an explicit server path could break sibling imports. File lookup (no sys_path)
remains extra roots, cwd, then the install root in either mode.