Repository navigation
fix(cli): keep requested Gym extras when installing servers from PyPI - #4295
Merged
Merged
Conversation
When Gym runs from a PyPI install, a requirements.txt server's local `nemo-gym[...] @ ../../` line is dropped and replaced with a plain `nemo-gym==<version>` requirement. The extras on that line were lost, so servers requesting `[sandbox]` never got the sandbox dependencies. Read the extras from the local Gym requirement and carry them onto the PyPI requirement. pyproject.toml servers already keep their extras, because their second install resolves the server's own `nemo-gym[...]` dependency. Part of #3669: servers that use Ray will request a `[ray]` extra once Ray is optional, which depends on this. Signed-off-by: Ananth Subramaniam <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
hemildesai
approved these changes
Oct 9, 2026
ananthsub
enabled auto-merge
October 9, 2026 16:44
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37961395487 |
ehosseiniasl
pushed a commit
to ehosseiniasl/Gym
that referenced
this pull request
Oct 9, 2026
…A-NeMo#4301) ## What changed Every server implementation that declares `ray_enabled = True` now requests nemo-gym's `ray` extra (added in NVIDIA-NeMo#4300) in its own manifest: | Manifest | Change | Servers | |---|---|---| | `requirements.txt` | `-e nemo-gym[dev,ray] @ ../../` | `code_gen`, `evalplus`, `legal_agent_bench`, `longmt_eval`, `spider2_lite`, `swerl_gen`, `wmt_translation`, `mini_swe_agent`, `osworld_agent`, `stirrup_agent`, `swe_agents` | | `requirements.txt` | `-e nemo-gym[dev,ray,sandbox] @ ../../` | `anyterminal_agent`, `harbor_agent`, `mini_swe_agent_2` | | `pyproject.toml` | `"nemo-gym[dev,ray]"` | `code_fim`, `harbor_agent_general` | | `setup.py` | `"nemo-gym[dev,ray]"` | `local_vllm_model`, `genrm_model` | A new audit in `tests/unit_tests/test_ray_opt_out.py` fails when a server directory containing a class that declares `ray_enabled = True` doesn't request the extra in any of its manifests. The FAQ's "Installing Ray" section now describes the convention. ## Why This is the third step of making Ray optional (NVIDIA-NeMo#3669). After NVIDIA-NeMo#4300, a server venv gets Ray only when the server's own dependencies ask for it; the parent's version is applied as a constraint, not installed. Once Ray leaves nemo-gym's core dependencies, these servers need to request it themselves, and NVIDIA-NeMo#4295 makes sure the extra survives PyPI installs. ## Validation - `pytest tests/unit_tests/test_ray_opt_out.py`. With the manifests reverted, the new audit lists every Ray server. - **Resolution:** `uv pip install --dry-run` from each server's directory resolves with Ray included, for one server per manifest format: `code_gen` (`requirements.txt`), `anyterminal_agent` (`requirements.txt` with `sandbox`), `code_fim` (`pyproject.toml`), and `local_vllm_model` (`setup.py`). - `pytest responses_api_agents/osworld_agent/tests/test_dependency_policy.py`, which reads that server's dependency files. - `fern check` passes. - `pre-commit run` scoped to the changed files. ## Rollout evidence N/A. Ray is still a core dependency of nemo-gym, so these servers install the same packages as before. This doesn't change prompts, model requests, trajectories, verification or rewards. ## Compatibility No change for any install today. External servers that use Ray should request `nemo-gym[ray]` the same way before Ray becomes optional. Signed-off-by: Ananth Subramaniam <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
When Gym is installed from PyPI rather than a source checkout,
setup_env_commandbuilds eachrequirements.txtserver's venv by:-e nemo-gym[...] @ ../../line with anemo-gym==<version>requirement;The extras on the local line were dropped in that replacement. A new helper,
_local_nemo_gym_extras(), now reads them and carries them onto the PyPI requirement. For example,-e nemo-gym[dev,sandbox] @ ../../now installsnemo-gym[dev,sandbox]==<version>.Servers with a
pyproject.tomlalready keep their extras, because their second install resolves the server's ownnemo-gym[...]dependency. Editable installs from a checkout are unchanged.Why
37 servers request
[sandbox]or[dev,sandbox]on that line. On PyPI installs they got neither extra, so the sandbox dependencies were missing from their venvs.This also unblocks making Ray optional (#3669): servers that use Ray will request a
[ray]extra, which has to survive PyPI installs.Validation
pytest tests/unit_tests/test_cli_setup_command.py-e,../..and../../, spaces, trailing comments,nemo_gym, the bare-e ../../line, unrelated local paths, and repeated lines;[dev,sandbox]. It fails without this change;requirements.txtline namingnemo-gymwith../..is recognized, so a new format can't silently drop extras again.uvcheck, run offline against hand-built wheels: a fakenemo-gym0.3.0 whosedevandsandboxextras each pull in a marker package.nemo-gymand the server's own dependency, but neither marker package.nemo-gym[dev,sandbox]after a plainnemo-gymalso installed both, which confirms thepyproject.tomlpath already keeps extras.pre-commit runscoped to the changed files.Rollout evidence
N/A. This changes which packages a server venv installs on PyPI-based setups. It doesn't change prompts, model requests, trajectories, verification or rewards.
Compatibility
PyPI-based setups now install the extras each server already asks for. Servers that request
[sandbox]get the sandbox dependencies, which makes their venvs larger and their first install slower. Editable checkouts are unaffected.