This document describes the release process for the CANNs library.
The CANNs project uses a centralized version management system that ensures consistency across all components:
- Git tags: Source of truth for version numbers (format:
v0.5.1) - Package version: Automatically derived from git tags using
uv-dynamic-versioning - Documentation: Automatically syncs with package version
- GitHub releases: Automatically triggered by git tags
-
Ensure all changes are committed and the
masterbranch is up to date:git checkout master git pull origin master
-
Run tests to ensure everything is working:
pytest tests/
-
Update documentation if needed and test notebooks:
cd docs sphinx-build -b html . _build/html
-
Sync version across all files (optional, for consistency):
python scripts/sync_version.py 0.5.2 # Replace with your target version -
Review and commit any changes:
git add -A git commit -m "Bump version to 0.5.2"
-
Create and push git tag:
git tag v0.5.2 git push origin v0.5.2
-
The automated systems will handle the rest:
- GitHub Actions will build and publish to PyPI
- Documentation will be updated on ReadTheDocs
- GitHub release will be created with changelog
If you prefer to create releases manually through GitHub UI:
- Go to GitHub Releases
- Click "Create a new release"
- Choose the tag (or create new one):
v0.5.2 - Fill in release title:
Release 0.5.2 - The automation will still trigger PyPI publication
- Build package and verify version consistency
- Publish to PyPI (requires
PYPI_API_TOKENsecret) - Update documentation on ReadTheDocs
- Create GitHub release with auto-generated changelog
- Build docs to check for errors
- Test notebooks for syntax issues
- Upload artifacts for review
The system uses multiple fallbacks to ensure version consistency:
- Git tags (primary source):
git describe --tags --abbrev=0 - Package metadata:
importlib.metadata.version("canns") - Fallback: Hardcoded version in source files
pyproject.toml: Dynamic versioning configurationdocs/conf.py: Documentation version detection.github/workflows/publish.yml: PyPI publish (auto onrelease.published, manual viaworkflow_dispatch)scripts/sync_version.py: Version synchronization tool
For full automation, configure these GitHub repository secrets:
PYPI_API_TOKEN: PyPI API token for package publishingREADTHEDOCS_TOKEN: ReadTheDocs API token (optional)
If you encounter version mismatches, run:
python scripts/sync_version.py $(git describe --tags --abbrev=0 | sed 's/v//')- Check that
PYPI_API_TOKENis correctly configured - Ensure version doesn't already exist on PyPI
- Verify package builds correctly:
python -m build
- Test locally:
cd docs && sphinx-build -b html . _build/html - Check ReadTheDocs build logs
- Verify all dependencies are in
docs/requirements.txt
v0.5.1: Current stable releasev0.5.0: Major feature additionsv0.4.1: Bug fixes and improvementsv0.4.0: Initial public release
- Semantic Versioning: Follow SemVer (MAJOR.MINOR.PATCH)
- Clear Changelog: Document what changed in each release
- Test Before Release: Always run full test suite
- Documentation Updates: Keep docs in sync with code changes
- Breaking Changes: Bump major version for API changes
This release process ensures consistent, automated, and reliable software delivery.