Releasing
PyPI releases are immutable. Changes to package metadata, including optional
extras such as test, require a new version and cannot be added to an
existing release.
Trusted Publisher setup
CompactObject uses the dedicated .github/workflows/publish.yaml workflow
for PyPI publishing. A PyPI project owner must authorize it once:
Open the
CompactObject-TOVproject on PyPI.Select Manage, then Publishing.
Add a GitHub Actions trusted publisher with these values:
Owner:
ChunHuangPhyRepository:
CompactObjectWorkflow name:
publish.yamlEnvironment name:
pypi
The environment name must match exactly. Configure the pypi environment in
the GitHub repository with required maintainer approval before deployment.
PyPI’s Trusted Publisher documentation describes the
one-time project configuration.
This setup uses a short-lived OpenID Connect credential. It does not require a PyPI API token to be stored in the repository.
Publishing a version
Before creating a release:
Update the version in
pyproject.tomlanddocs/source/conf.py.Run
python -m pytest.Build and validate the distributions:
python -m build python -m twine check dist/*
Commit and push the release changes.
Create a Git tag whose name is
vfollowed by the package version.Publish a GitHub release from that tag.
For version 2.1.1, the expected tag is v2.1.1. Publishing that GitHub
release starts the PyPI workflow. The workflow verifies that the tag and
pyproject.toml version match, builds and checks both distributions, and
uploads them to PyPI.