Skip to content

chore(release/v26.3): add wheel packaging (pyproject + primus-cli entry)#753

Open
HuangWei-95 wants to merge 11 commits into
release/v26.3from
pkg/wheel-v26.3
Open

chore(release/v26.3): add wheel packaging (pyproject + primus-cli entry)#753
HuangWei-95 wants to merge 11 commits into
release/v26.3from
pkg/wheel-v26.3

Conversation

@HuangWei-95

Copy link
Copy Markdown
Collaborator

Summary

Add the minimal wheel-packaging files to release/v26.3 so a wheel can be built & published for v26.3.x releases.

  • pyproject.toml (hatchling): bundles the runner/ primus-cli toolkit under primus/runner/, exposes primus-cli / primus console scripts, and pins [tool.black] target-version=py38 so requires-python>=3.10 does not trigger a repo-wide black reformat.
  • primus_cli.py: dependency-free entry point that locates and execs the bundled runner/primus-cli.

The release workflow lives on main (release-build-wheel.yml). Publishing a v26.3.x GitHub Release will checkout this tag, run python -m build, and upload the wheel to the release assets.

Note: release-build-wheel.yml does not run pre-commit, so this is independent of code-lint.

Minimal packaging so python -m build produces a wheel bundling the primus-cli runner toolkit, enabling release-build-wheel (on main) to build & upload the wheel for v26.3.x releases. Mirrors #750. black target pinned to py38 in pyproject so requires-python>=3.10 does not trigger a repo-wide reformat.

Co-authored-by: Cursor <cursoragent@cursor.com>
HuangWei-95 and others added 10 commits June 8, 2026 17:00
… the repo

Backport the runner fallback so an installed wheel can run 'primus-cli direct' from any directory: when the default script primus/cli/main.py is absent, fall back to '-m primus.cli.main'; numa_bind.sh also handles the '-m' module form. Adapted to release/v26.3's eval-based launcher.

Co-authored-by: Cursor <cursoragent@cursor.com>
…is branch trigger it

GitHub reads the release-event workflow from the commit the tag points to (GITHUB_SHA = tagged commit), not from main. v26.x release tags target this branch, so release-build-wheel.yml must exist here for 'on: release' to fire. Mirrors main (#750).

Co-authored-by: Cursor <cursoragent@cursor.com>
…iming

Mirror of #757: gen_thirdparty_extras.py injects pip-installable third_party submodules as pinned git+ extras before build; pyproject enables allow-direct-references; release-build-wheel.yml polls the Releases API until the wheel is visible before refreshing the dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ource clone)

git+ extras cannot provide runtime-compiled files (e.g. Megatron datasets Makefile/.so) or nested submodules. Replace with a source-clone bootstrap: gen_thirdparty_lock.py writes primus/_thirdparty.lock (name/url/pinned-commit for all 6 third_party) into the wheel; new 'primus-cli deps sync [--dir]' clones each dep with --recurse-submodules + checkout commit and prints PYTHONPATH. release-build-wheel.yml generates the lock before build (replaces inject-extras); pyproject ships it via artifacts and drops allow-direct-references. Dashboard-refresh timing fix kept.

Co-authored-by: Cursor <cursoragent@cursor.com>
README: add pip install instructions (git URL + index-url with pinned version) and deps sync. primus-cli help: add a deps sync example. primus-cli-deps.sh: default dir -> ~/.cache/Primus/third_party. primus-cli-direct.sh: auto-run deps sync on first use when backend sources are missing (Plan B; PRIMUS_AUTO_DEPS_SYNC=0 to skip) and prepend cloned sources to PYTHONPATH.
Co-authored-by: Cursor <cursoragent@cursor.com>
…ropped it)

The lock is git-ignored, so hatchling's sdist excluded it; python -m build (sdist -> wheel) then produced a wheel without the lock, breaking 'primus-cli deps sync'. Add artifacts to the sdist target so the lock survives the sdist->wheel path, and assert the lock + deps.sh in the wheel-verify step.

Co-authored-by: Cursor <cursoragent@cursor.com>
setup_backend_path() only checked --backend_path / BACKEND_PATH / <repo>/third_party/<name>; for installed wheels that default resolves to site-packages/third_party (absent), so backends fetched by 'primus-cli deps sync' were not found. Add the deps-sync location (PRIMUS_THIRDPARTY_DIR or ~/.cache/Primus/third_party)/<name> as a default candidate.

Co-authored-by: Cursor <cursoragent@cursor.com>
…eels

megatron/torchtitan/maxtext/megatron-bridge prepare hooks defaulted backend path to <primus_path>/third_party/<name>, absent for installed wheels. Add utils.default_backend_path() that falls back to the deps-sync dir (PRIMUS_THIRDPARTY_DIR or ~/.cache/Primus/third_party) and use it in all four hooks, matching backend_adapter.

Co-authored-by: Cursor <cursoragent@cursor.com>
prepare hooks import primus.pretrain.setup_backend_path, whose only fallback was <primus>/../third_party/<name> (site-packages/third_party for installed wheels). Add the deps-sync dir (PRIMUS_THIRDPARTY_DIR or ~/.cache/Primus/third_party) as a candidate, matching backend_adapter and the prepare hooks, plus a deps-sync hint in the error.

Co-authored-by: Cursor <cursoragent@cursor.com>
The lock was git-ignored and generated only in CI, so pip source installs (pip install ., pip install git+..., and sdist) produced a wheel without it, breaking 'primus-cli deps sync'. Track the lock instead, pinned to LF via a new .gitattributes so it stays byte-stable on Windows/Linux.

Turn the CI 'Generate third_party lock' step into a drift check (regenerate + git diff --quiet, fail if stale) and add an always-run pre-commit hook that regenerates the lock from the submodule pins, so it can never drift from .gitmodules + gitlinks.

Co-authored-by: Cursor <cursoragent@cursor.com>
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