Skip to content

Publishing WaLSAlib

Releases use the version in pyproject.toml and a matching Git tag named v<version>. The publish.yml workflow supports TestPyPI and PyPI through GitHub Trusted Publishing.

Account and repository configuration

  1. Configure separate PyPI and TestPyPI accounts with verified email addresses and two-factor authentication.
  2. Register a GitHub Trusted Publisher on each index: owner WaLSAteam, repository WaLSAlib, workflow filename publish.yml, and environment pypi or testpypi. Use a pending publisher for a project that does not yet exist.
  3. Create the matching GitHub environments with required reviewers. Select allowed release tags under deployment branches and tags. If a single maintainer starts and approves releases, leave prevent-self-review disabled.
  4. Disable administrator bypass of environment protection rules. Configure branch and tag protection for the project's release policy.

Trusted Publishing uses short-lived credentials; API token secrets are not required.

References: PyPA publishing guide and PyPI Trusted Publishers.

Build and validate

python -m venv .venv
. .venv/bin/activate
pip install '.[build,test,softg]'
python tools/sync_upstreams.py --check
python -m build
python -m twine check --strict dist/*
python tools/check_dist.py dist
pip install --force-reinstall --no-deps dist/*.whl
python -m pytest tests/release

CI validates base installations on Python 3.10, 3.12, and 3.13 and ML integration on Python 3.12. It builds and installs the wheel, rebuilds a wheel from the source distribution, and runs the release suite. GPU and desktop workflows require validation on their target platforms.

Release procedure

  1. Review the public API, numerical validation, dependencies, citations, licenses, and changelog. Set the package version in pyproject.toml.
  2. Merge all approved release changes, including package metadata, to main. Confirm its checks pass, then create a matching v<version> tag at that exact commit. The publishing workflow requires the tag to point to the current main commit.
  3. Open GitHub Actions and manually run Publish reviewed release on the version tag, selecting testpypi.
  4. Approve the TestPyPI environment job. Inspect the uploaded version, author name and email, dependencies, licenses, and distributions, then validate installation in a fresh environment. Install runtime dependencies separately from PyPI; install the TestPyPI wheel with --no-deps --only-binary=:all:.
  5. Run the workflow on the same tag with target pypi. After validation succeeds, approve the production environment job.
  6. Verify installation of the exact published version and the public imports from an empty directory. Create the GitHub release notes and check archive and citation metadata.

The workflow accepts version tags matching pyproject.toml. It builds and validates artifacts before uploading the wheel and source distribution together. Published versions are immutable; use a new version and tag for a subsequent release.

Release tags and development installations

A release tag identifies a fixed source snapshot. Commits on main do not update an existing tag or an uploaded package. Once published, retain the tag and use a new version and tag for corrections. Development on main may continue after publication; it does not change the released version.

Before approving an upload, confirm the workflow's source tag, commit, version, and author metadata. If main advances after a publishing run starts, cancel that run and review the release source again before approval.

An editable installation (pip install -e .) imports code from its source checkout. Pulling another checkout or installing the package in another environment does not update it. To use the published release, use a fresh virtual environment or replace the editable installation with pip install --upgrade WaLSAlib. Confirm the loaded source with WaLSAlib.__file__ and the installed distribution version with importlib.metadata.version("WaLSAlib").