Release / Push CUDA image to Docker (push) Canceled after 0s
* feat: split prime-rl-configs into separate workspace package
Goal: make `prime_rl.configs.*` pip-installable on its own (~13 deps)
without pulling the full GPU/ML stack (~329 deps).
Layout — uv workspace with two members:
- root `prime-rl` (heavy stack, unchanged location at src/prime_rl/)
- `packages/prime-rl-configs/` (slim wheel, owns prime_rl.configs.*
and the small slim utils: utils/config.py, utils/logger.py,
utils/validation.py)
Mechanism — both wheels contribute to a PEP 420 namespace package
`prime_rl/` (no __init__.py at the top level, nor under utils/). Each
wheel ships disjoint files; pip merges them at install time.
- `pip install prime-rl-configs` → schema only
- `pip install prime-rl` → full stack (depends on prime-rl-configs)
Code changes:
- Move src/prime_rl/configs/ → packages/prime-rl-configs/src/prime_rl/configs/
- Move utils/{config,logger,validation}.py → packages/prime-rl-configs/src/prime_rl/utils/
- Move rgetattr/rsetattr from utils/utils.py → utils/config.py (was the
only heavy import the configs needed; this breaks the dep)
- Replace `Path(prime_rl.__file__).parent / "templates"` (None on a
namespace package) with `find_package_resource("templates")` which
iterates `prime_rl.__path__` to locate the heavy wheel's data dir
- Delete src/prime_rl/__init__.py; move its `import _compat` side-effect
into the actual entrypoint scripts (orchestrator.py, entrypoints/rl.py,
entrypoints/sft.py — trainer/{rl,sft}/train.py already had it)
- Dockerfile.cuda: also COPY packages/ so the workspace member is
available during `uv sync`
Verified:
- `uv sync --all-extras` resolves and builds both wheels
- 333 unit tests pass (none touched)
- all 6 entrypoints (rl/sft/trainer/orchestrator/env-server/inference)
load and print --help
- fresh `pip install ./packages/prime-rl-configs` (no extras) installs
13 packages, imports all configs, parses examples/.../rl.toml with a
[slurm] section, and sys.modules contains zero of:
torch / transformers / vllm / wandb / ring_flash_attn / verifiers /
prime / datasets / liger_kernel
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: add slim-configs-install job to cpu_tests
Fresh venv → `uv pip install ./packages/prime-rl-configs` → assert that:
- all 6 config modules import
- sys.modules contains zero of: torch, transformers, vllm, wandb,
ring_flash_attn, verifiers, prime, datasets, liger_kernel
- find_package_resource("templates") returns None (the heavy wheel's
data dir isn't shipped on slim)
- a real example config with [slurm] parses; template_path stays None
Guards the slim-import contract against future regressions where
something under prime_rl.configs.* might re-introduce a heavy import.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(ruff): mark prime_rl as first-party for isort
Without this, ruff's import sorter classifies prime_rl.configs.* as
third-party (because those files now live under packages/, not src/),
and groups them apart from prime_rl.utils.* / prime_rl.trainer.* etc.
Telling ruff that prime_rl is a single first-party namespace keeps
all prime_rl.* imports in one block, regardless of which workspace
wheel ships the submodule.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(configs): drop logger dep, use stdlib warnings
Configs were doing get_logger().warning(...) at validation time, which
forced loguru into the slim wheel and a logger.py copy alongside it.
None of these warnings need a configured logger — they're config-time
deprecation notices and misconfiguration hints. Stdlib `warnings.warn`
covers the use case without any runtime infrastructure.
- Replace 7 `get_logger().warning(...)` call sites in configs/rl.py and
configs/orchestrator.py with `warnings.warn(...)`. Deprecation messages
use `DeprecationWarning`; the rest use the default `UserWarning`.
- Move `prime_rl/utils/logger.py` back to the heavy `prime-rl` wheel
(`src/prime_rl/utils/`).
- Drop `loguru` from `prime-rl-configs` deps; add it to `prime-rl`.
- Slim CI: stop importing `prime_rl.utils.logger` (it's no longer in the
slim wheel) and add `loguru` to the forbidden-modules list.
Slim install drops from 13 to 12 packages.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix: import _compat in remaining ring_flash_attn entry points
Integration tests like tests/integration/test_sft_lora.py import
prime_rl.trainer.weights, which transitively pulled ring_flash_attn
(via models layer / utils.cp) without prime_rl._compat ever running,
producing the ImportError that failed CI.
Add `import prime_rl._compat` to the two remaining top-level
ring_flash_attn import sites: utils/cp.py and trainer/models/layers/
ring_attn.py. The trainer entrypoints (rl/sft/train.py) already had
this import.
`# ruff: noqa: I001` on both files because ruff's isort, with
known-first-party=prime_rl, sorts the prime_rl._compat first-party
import after the third-party ring_flash_attn import — which defeats
the patch ordering. The shim must run before ring_flash_attn is
imported, so the file order is intentional.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix: pin pydantic-config to git fork in slim package
The PyPI package named `pydantic-config` is a different project that
doesn't expose BaseConfig / cli (those are in samsja's fork). Without
this pin, plain `pip install prime-rl-configs` resolves the wrong
package and configs.* imports crash with:
ImportError: cannot import name 'BaseConfig' from 'pydantic_config'
uv pip install accidentally worked because it reads the root workspace
pyproject.toml's [tool.uv.sources] when installing from a git
subdirectory, which redirected pydantic-config to the fork. Plain pip
doesn't do that — it only sees the leaf pyproject.toml.
PEP 508 direct reference works for both uv and pip.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: install slim wheel from /tmp to bypass workspace source discovery
The previous step did `uv pip install ./packages/prime-rl-configs` from
inside the cloned repo. uv silently reads the root pyproject.toml's
[tool.uv.sources] in that case and applies the pydantic-config git
override — masking the issue an external pip-only user would hit.
Build the wheel into /tmp/slim-wheel and install it from /tmp so uv
can't discover the workspace. This catches dep-resolution bugs that
only show up in a real external install.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: explain dist-name vs import-path in slim package README
Distribution name (`prime-rl-configs`) and import path
(`prime_rl.configs.*`) are different — easy to trip on.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
prime-rl-configs
Slim config schema for prime-rl, with no GPU or ML deps.
pip install prime-rl-configs gives you prime_rl.configs.* (RL/SFT/inference/orchestrator/trainer/env-server schemas) without pulling in torch, vllm, transformers, wandb, etc. The full training stack lives in prime-rl, which depends on this package.
Install
pip install git+https://github.com/PrimeIntellect-ai/prime-rl.git#subdirectory=packages/prime-rl-configs
Usage
The pip distribution name (prime-rl-configs) and the import path (prime_rl.configs.*) are different on purpose: this package contributes submodules to the shared prime_rl namespace.
from pydantic_config import cli
from prime_rl.configs.rl import RLConfig
config = cli(RLConfig, args=["@", "path/to/rl.toml"])
Other config classes live alongside RLConfig under prime_rl.configs.* (sft, inference, orchestrator, trainer, env_server).
import prime_rl on its own succeeds but is empty — it's a PEP 420 namespace package with no top-level attributes. Always import a submodule.