Releasing
Releasing¶
One version covers both packages: [workspace.package] version in the root Cargo.toml.
The crate lineshapes (crates.io) and the Python package lineshapes (PyPI, version read from the
same place via dynamic = ["version"]) always release together.
To release¶
- Bump
versionin[workspace.package](rootCargo.toml). - Run
cargo update --workspace(refreshesCargo.lock; CI builds with--locked) and commit both. - Push / merge to
main.
.github/workflows/release.yml then: checks that tag vX.Y.Z does not exist yet -> runs the full
test suite (ci.yml) -> builds abi3 wheels (linux x86_64/aarch64, macOS x86_64/arm64, windows x64)
and an sdist -> publishes the crate to crates.io and the wheels to PyPI -> creates tag vX.Y.Z and
a GitHub release with the artifacts attached. Pushes that do not change the version do nothing
(the check job finds the existing tag). Publishing is idempotent: a re-run skips versions already on
crates.io / PyPI, and the tag is only created after both succeed, so a failed release is fixed by
re-running the workflow. workflow_dispatch with dry_run builds everything without publishing.
One-time setup (repository owner)¶
- License: the code is under the Berkeley Lab modified BSD license (
LICENSE,COPYRIGHT; SPDXBSD-3-Clause-LBNL), as for other ALS software. The license and repository metadata are set in the workspaceCargo.tomland inpyproject.toml. Release is subject to Berkeley Lab's required approvals (see the notice inCOPYRIGHT; questions go to IPO@lbl.gov). - crates.io: create an API token scoped to publish
lineshapes, add it as the repository (orcrates-ioenvironment) secretCARGO_REGISTRY_TOKEN. The first publish of a new crate needs a token with thepublish-newscope. - PyPI: add a trusted publisher (pending publisher for a new project) for this repository, workflow
release.yml, environmentpypi. No token is stored. - GitHub: create the environments
pypiandcrates-io(optionally with required reviewers for a manual approval gate before publishing). Allow Actions to create releases (default token hascontents: writeonly in the release job).
Notes¶
- Versions already published cannot be overwritten; to fix a bad release, bump the version.
speedtests are not run in CI (timing on shared runners is noisy). Run them locally withuv run pytest -m speedbefore releasing.