Skip to content

feat(sandboxed-gym): Install dependencies from wheels in Gym host runtime - #1522

Open
JashG wants to merge 3 commits into
sandboxed-gym-integration/schapmanfrom
wheels-v1-sandbox-install/jgulabrai
Open

feat(sandboxed-gym): Install dependencies from wheels in Gym host runtime#1522
JashG wants to merge 3 commits into
sandboxed-gym-integration/schapmanfrom
wheels-v1-sandbox-install/jgulabrai

Conversation

@JashG

@JashG JashG commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds wheels-v1 dependency installation to the sandboxed Gym host runtime. Before Gym starts, the runtime installs vendored wheels from the read-only environment mount into writable job storage and ensures Gym’s per-server environments resolve their requirements from those wheels without accessing a package index.

This PR depends on #1400.

Changes

Runtime behavior

  • Detect nemo-environment.yaml manifests using the wheels-v1 format. Install wheels from the read-only environment mount into writable job storage before Gym starts.
  • Expose installed packages to the running host through sys.path and to child processes through PYTHONPATH.
  • Set UV_FIND_LINKS and UV_NO_INDEX so Gym’s per-server environments resolve their requirements.txt dependencies exclusively from the staged wheelhouse.
  • Preserve existing behavior for environments without a manifest or using another format.

Runtime dependencies

  • Add a sandboxed-gym[runtime] extra containing PyYAML.
  • Install PyYAML in the development Gym host image.

Test coverage

  • Add unit tests for manifest handling, missing wheels, installation arguments, offline uv configuration, import-path propagation, and bootstrap ordering.
  • Add a lightweight integration test that creates a real wheel locally and invokes the real uv executable without Docker or external package downloads.
  • Verify the installed package is importable by the running host and a child process.
  • Verify a simulated Gym per-server requirements.txt installation resolves from the staged wheelhouse with package-index access disabled.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: This PR implements the internal M2a runtime installation step. Wheel-bundle production, staging, and broader component coverage are handled separately.

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Targeted validation:

  • uv run --project packages/sandboxed_gym --extra dev pytest packages/sandboxed_gym/tests/test_gym_host_runtime.py packages/sandboxed_gym/tests/test_wheels_v1_install_integration.py -q
    • Result: 25 passed
  • uv run ruff check packages/sandboxed_gym/src/sandboxed_gym/runtime/gym_host_runtime.py packages/sandboxed_gym/tests/test_gym_host_runtime.py packages/sandboxed_gym/tests/test_wheels_v1_install_integration.py
    • Result: passed
  • uv run ruff format --check packages/sandboxed_gym/src/sandboxed_gym/runtime/gym_host_runtime.py packages/sandboxed_gym/tests/test_gym_host_runtime.py packages/sandboxed_gym/tests/test_wheels_v1_install_integration.py
    • Result: passed; all three files already formatted
  • uv run pre-commit run -a
    • Relevant checks passed, including Ruff, formatting, type checking, lock drift, configuration checks, and copyright headers.

Signed-off-by: Jash Gulabrai <jgulabrai@nvidia.com>
@JashG
JashG requested review from a team as code owners August 25, 2026 17:03
@github-actions github-actions Bot added the feat label Aug 25, 2026
COPY packages/sandboxed_gym/src /opt/sandboxed_gym/src
RUN pip install --no-cache-dir --no-deps /opt/sandboxed_gym && pip install --no-cache-dir "pydantic>=2.10.0"
RUN pip install --no-cache-dir --no-deps /opt/sandboxed_gym \
&& pip install --no-cache-dir "pydantic>=2.10.0" "pyyaml>=6.0.2"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyyaml is for parsing the nemo-environment.yaml file.

JashG added 2 commits August 25, 2026 13:25
… deps are importable

Signed-off-by: Jash Gulabrai <jgulabrai@nvidia.com>
Signed-off-by: Jash Gulabrai <jgulabrai@nvidia.com>
@JashG JashG changed the title feat(evaluator): Install vendored wheels in Gym host runtime feat(sandboxed-gym): Install dependencies from vendored wheels in Gym host runtime Aug 25, 2026
@JashG JashG changed the title feat(sandboxed-gym): Install dependencies from vendored wheels in Gym host runtime feat(sandboxed-gym): Install dependencies from wheels in Gym host runtime Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant