Summary
There is growing interest in being able to install Primus's preflight cluster diagnostic from this branch — and ideally the primus-cli entry point — as a standalone Python package (wheel / sdist on an internal index or PyPI), rather than always having to git clone the full Primus repository.
Today the repo appears to have no Python packaging at all.
We might want to start by packaging the code for pre-flight checks without a container from this branch: dev/preflight-direct-test (we plan to merge this branch to main later)
Motivation
- Easier deployment on cluster nodes.
pip install primus-preflight
(from an internal index or PyPI) is much cleaner than asking ops to clone
a multi-GB repo with submodules (third_party/Megatron-LM,
torchtitan, maxtext, ...).
- Versioning and reproducibility. Sites that gate node acceptance on a
specific preflight version could pin to a wheel rather than a git SHA.
Proposed scope (for discussion)
A few options, roughly in order of effort:
-
Minimal: primus-preflight wheel only.
- New top-level package (e.g.
primus_preflight/) or a pyproject.toml
that builds a subset of primus/tools/preflight/ (+ the small required
helpers from primus/tools/utils.py).
- Optional dependency extras:
[pdf] (markdown2, weasyprint),
[plot] (matplotlib).
console_scripts entry point: primus-preflight = ...:main.
- Keep the existing in-tree
primus-cli preflight working unchanged.
-
Also package primus-cli itself as a Python entry point.
- Replace (or complement) the bash
primus-cli wrapper with a
console_scripts entry point so pip install primus-cli (or
primus) gives users primus-cli on $PATH without a clone.
- This is more involved because the current launcher is bash and shells
out to mode-specific scripts (runner/primus-cli-{slurm,container,direct}.sh),
which would need to be either shipped inside the wheel or rewritten.
-
Full repo packaging.
- One
pyproject.toml for the whole primus/ package, with optional
extras for backends (megatron / torchtitan / jax). Probably out of
scope for a first pass given the third-party submodules.
Open questions
- Distribution target: internal AMD index, public PyPI, or both?
- How do we keep the in-tree path (
primus/tools/preflight/) and the
packaged path in sync? Single source of truth via a pyproject.toml at
repo root that just packages the existing tree is probably easiest.
- Wheel build & publish CI: add a job to
.github/workflows/ that runs on
tags?
Acceptance criteria (suggested)
Summary
There is growing interest in being able to install Primus's preflight cluster diagnostic from this branch — and ideally the
primus-clientry point — as a standalone Python package (wheel / sdist on an internal index or PyPI), rather than always having togit clonethe full Primus repository.Today the repo appears to have no Python packaging at all.
We might want to start by packaging the code for pre-flight checks without a container from this branch:
dev/preflight-direct-test(we plan to merge this branch to main later)Motivation
pip install primus-preflight(from an internal index or PyPI) is much cleaner than asking ops to clone
a multi-GB repo with submodules (
third_party/Megatron-LM,torchtitan,maxtext, ...).specific preflight version could pin to a wheel rather than a git SHA.
Proposed scope (for discussion)
A few options, roughly in order of effort:
Minimal:
primus-preflightwheel only.primus_preflight/) or apyproject.tomlthat builds a subset of
primus/tools/preflight/(+ the small requiredhelpers from
primus/tools/utils.py).[pdf](markdown2, weasyprint),[plot](matplotlib).console_scriptsentry point:primus-preflight = ...:main.primus-cli preflightworking unchanged.Also package
primus-cliitself as a Python entry point.primus-cliwrapper with aconsole_scriptsentry point sopip install primus-cli(orprimus) gives usersprimus-clion$PATHwithout a clone.out to mode-specific scripts (
runner/primus-cli-{slurm,container,direct}.sh),which would need to be either shipped inside the wheel or rewritten.
Full repo packaging.
pyproject.tomlfor the wholeprimus/package, with optionalextras for backends (megatron / torchtitan / jax). Probably out of
scope for a first pass given the third-party submodules.
Open questions
primus/tools/preflight/) and thepackaged path in sync? Single source of truth via a
pyproject.tomlatrepo root that just packages the existing tree is probably easiest.
.github/workflows/that runs ontags?
Acceptance criteria (suggested)
pyproject.toml(PEP 517/518) lands that can build at least aprimus-preflightwheel.pip install <wheel>followed byprimus-preflight --helpworks in aclean venv with no Primus checkout on disk.
docs/preflight-direct.mdupdatedto include the
pip installroute alongside the current clone-and-runpath.