Skip to content

refactor(env): make unilab a self-contained env package - #2548

Merged
TATP-233 merged 2 commits into
mainfrom
refactor/issue-2542-env-self-contained
Oct 28, 2026
Merged

TATP-233 merged 2 commits into
mainfrom
refactor/issue-2542-env-self-contained

Conversation

@TATP-233

Copy link
Copy Markdown
Collaborator

Summary

Makes unilab a self-contained, lightweight env package — the "no-split" work from #2542 that must happen regardless of the eventual unilab-rl split (#2537).

  • Contract relocation: unilab.rl.contracts → unilab.base.contracts (single owner). The old namespace is deleted and all importers updated, so env users no longer import the contract from the algorithm namespace.
  • Env self-containment: base/env_factory.py and envs/manager_based_rl_env.py no longer import unilab.rl.*. unilab.base is now lazy so unilab.base.contracts imports without pulling in unisim.
  • Single unirl training extra: tensordict / rsl-rl-lib / wandb / tensorboard moved out of core deps into [project.optional-dependencies] unirl (one extra — not train, not per-algorithm). import unilab no longer triggers them. pyproject.rocm.toml and both lockfiles are kept in sync.
  • Install-layout leaks: cli.package_root and scripts.train_offpolicy.build_runner documented as internal (not a public contract).

Not in this PR

Item 5 of #2542 (the unilab.training seam split — separating offpolicy-specific dp_config/tensor_runtime from the algorithm-agnostic trainer API) is deferred: it needs a decision on the stable public-API boundary and will follow in a separate PR/ADR.

Validation (final head 2a7695bc)

  • uv run pytest -m "not slow" → 2869 passed, 34 skipped, 1 xfailed, 1 failed
    • The 1 failure is pre-existing and unrelated: tests/base/test_backend_conformance.py::test_fused_tensor_root_reset_reads_back_world_angular_velocity[motrix] (motrix physics numerics).
  • uv run ruff check and uv run ruff format --check → clean
  • uv lock --check → clean

Note: uv.rocm.lock regenerated from pyproject.rocm.toml, which also folds in pre-existing drift (the old lock still carried mjwarp/newton/superdex packages the ROCm toml no longer declares), making the lock consistent with the toml.

Part of #2542.

🤖 Generated with Claude Code

@TATP-233
TATP-233 requested a review from caozx1110 as a code owner October 28, 2026 13:03
TATP-233 and others added 2 commits October 28, 2026 21:49
Relocate the env-injection contract out of the algorithm namespace and make
the training stack an optional install, so `pip install unilab` is a
lightweight env-only package. Drives #2542.

- Move `unilab.rl.contracts` -> `unilab.base.contracts` (single owner) and
  delete the old namespace; update all importers.
- Cut env-layer reverse imports of `unilab.rl` (`base/env_factory.py`,
  `envs/manager_based_rl_env.py`).
- Make `unilab.base` lazy so `unilab.base.contracts` imports without pulling
  in `unisim`.
- Move `tensordict`/`rsl-rl-lib`/`wandb`/`tensorboard` into the single
  `unirl` optional extra; `import unilab` no longer triggers them.
- Mark `cli.package_root` and `scripts.train_offpolicy.build_runner` as
  internal (not a public contract).

Validation (final head):
- `uv run pytest -m "not slow"` -> 2869 passed, 34 skipped, 1 xfailed,
  1 failed (pre-existing motrix backend conformance failure, unrelated)
- `uv run ruff check` and `uv run ruff format --check` clean
- `uv lock --check` clean

Co-Authored-By: Claude Code <noreply@anthropic.com>
The training deps (tensordict/rsl-rl-lib/wandb/tensorboard) moved into the
`unirl` optional extra, so CI jobs that exercise the RL/training stack
(test-applications, test-rl, mypy, pyright, tensor-runtime) must install it
or fail to import rsl_rl/tensorboard/onnx. Add `--extra unirl` to those sync
commands and to the Makefile dev sync targets.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@TATP-233
TATP-233 force-pushed the refactor/issue-2542-env-self-contained branch from 8322584 to fcb7aa9 Compare October 28, 2026 13:51
@TATP-233
TATP-233 merged commit 105cc26 into main Oct 28, 2026
12 checks passed
@TATP-233
TATP-233 deleted the refactor/issue-2542-env-self-contained branch October 28, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant