This document describes the release process for py_template.
py_template uses automated GitHub Actions workflows for releases. The release process includes:
- Building distribution packages (source and wheel)
- Creating GitHub releases with changelog
- Optional: Publishing to PyPI or private repository
- Notification and summary
Before creating a release:
- ✅ All tests pass on
mainbranch - ✅ Code quality checks pass
- ✅ CHANGELOG.md is updated with release notes
- ✅ Version number is bumped in
src/py_template/__version__.py - ✅ All changes are committed and pushed
Create and push a version tag to trigger automatic release:
# 1. Update version
vim src/py_template/__version__.py
# Change __version__ = "0.2.0"
# 2. Update CHANGELOG.md
vim CHANGELOG.md
# Add new version section with changes
# 3. Commit changes
git add src/py_template/__version__.py CHANGELOG.md
git commit -m "Bump version to 0.2.0"
# 4. Create and push tag
git tag -a v0.2.0 -m "Release version 0.2.0"
git push origin main
git push origin v0.2.0The workflow will automatically:
- Build distribution packages
- Create GitHub release with changelog
- Upload artifacts (
.tar.gzand.whlfiles)
Trigger release manually from GitHub Actions UI:
- Go to Actions → Release workflow
- Click Run workflow
- Select branch:
main - Enter version:
0.2.0(without 'v' prefix) - Click Run workflow
Follow Semantic Versioning:
MAJOR.MINOR.PATCH
Examples:
- 0.1.0 → 0.2.0 (new features, backward compatible)
- 0.2.0 → 0.2.1 (bug fixes, backward compatible)
- 0.2.1 → 1.0.0 (major changes, potentially breaking)
Pre-release versions:
0.1.0-alpha.1- Alpha release0.1.0-beta.1- Beta release0.1.0-rc.1- Release candidate
-
build - Build distribution packages
- Installs dependencies
- Builds source distribution (
.tar.gz) - Builds wheel distribution (
.whl) - Validates packages with
twine check - Uploads artifacts
-
publish-github - Create GitHub release
- Downloads build artifacts
- Extracts version from tag
- Generates changelog from CHANGELOG.md
- Creates GitHub release with artifacts
- Marks release as published
-
publish-pypi (Optional, commented out)
- Publishes to PyPI
- Requires
PYPI_API_TOKENsecret
-
publish-private (Optional, commented out)
- Publishes to private repository
- Requires repository URL and credentials
-
notify - Send notification
- Generates release summary
- Updates GitHub Step Summary
If you want to publish to PyPI, uncomment the publish-pypi job in .github/workflows/release.yml:
-
Create PyPI API token:
- Go to https://pypi.org/manage/account/token/
- Create new token with scope: "Entire account" or specific to "py_template"
- Copy the token (starts with
pypi-)
-
Add token to GitHub Secrets:
- Go to repository Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
PYPI_API_TOKEN - Value: Your PyPI token
- Click Add secret
-
Uncomment the
publish-pypijob in workflow
Since py_template is proprietary software:
- DO NOT publish to public PyPI
- Use private package repository instead
- Or distribute via GitHub releases only
For proprietary software, use a private package repository:
# Configure pip to use GitHub Packages
pip install --index-url https://pypi.pkg.github.com/your-org/ py_template-
Set up your private repository
-
Add secrets to GitHub:
PRIVATE_REPO_URL- Your repository URLPRIVATE_REPO_USERNAME- UsernamePRIVATE_REPO_PASSWORD- Password/Token
-
Uncomment
publish-privatejob in workflow
To build packages locally without releasing:
# Install build tools
uv add --dev build twine
# Build packages
uv run python -m build
# Check packages
uv run twine check dist/*
# View contents
tar -tzf dist/py_template-0.1.0.tar.gz
unzip -l dist/py_template-0.1.0-py3-none-any.whlBuilt packages will be in dist/ directory:
py_template-0.1.0.tar.gz- Source distributionpy_template-0.1.0-py3-none-any.whl- Wheel distribution
After successful release:
- ✅ Verify GitHub release is created
- ✅ Download and test distribution packages
- ✅ Update documentation if needed
- ✅ Announce release (if applicable)
- ✅ Close related issues/PRs
- ✅ Plan next release
If you need to rollback a release:
# Delete tag locally
git tag -d v0.2.0
# Delete tag on remote
git push origin :refs/tags/v0.2.0
# Delete release on GitHub UI
# Go to Releases → Click release → Delete# Revert to previous version
git revert <commit-hash>
git push origin mainIssue: Build job fails with dependency errors
Solution:
# Test build locally first
uv sync --extra dev
uv run python -m buildIssue: Version in package doesn't match tag
Solution: Ensure src/py_template/__version__.py is updated before tagging
Issue: Release has "See CHANGELOG.md for details"
Solution: Add version section to CHANGELOG.md:
## [0.2.0] - YYYY-MM-DD
### Added
- New feature XIssue: Workflow fails with permission error
Solution: Check repository settings → Actions → Workflow permissions → Enable write permissions
# Fix bugs, commit changes
git add .
git commit -m "fix: resolve issue #123"
# Update version: 0.1.0 → 0.1.1
vim src/py_template/__version__.py
# Update changelog
vim CHANGELOG.md
# Add:
# ## [0.1.1] - YYYY-MM-DD
# ### Fixed
# - Resolve issue #123
# Commit and tag
git add src/py_template/__version__.py CHANGELOG.md
git commit -m "Bump version to 0.1.1"
git tag -a v0.1.1 -m "Release version 0.1.1"
git push origin main --tags# Develop features, commit changes
git add .
git commit -m "feat: add new transformer"
# Update version: 0.1.1 → 0.2.0
vim src/py_template/__version__.py
# Update changelog
vim CHANGELOG.md
# Add:
# ## [0.2.0] - YYYY-MM-DD
# ### Added
# - New transformer for data processing
# Commit and tag
git add src/py_template/__version__.py CHANGELOG.md
git commit -m "Bump version to 0.2.0"
git tag -a v0.2.0 -m "Release version 0.2.0"
git push origin main --tags# Implement breaking changes
git add .
git commit -m "feat!: redesign API structure"
# Update version: 0.2.0 → 1.0.0
vim src/py_template/__version__.py
# Update changelog with migration guide
vim CHANGELOG.md
# Add:
# ## [1.0.0] - YYYY-MM-DD
# ### Changed (BREAKING)
# - Redesigned API structure
# ### Migration Guide
# - Update imports: old → new
# Commit and tag
git add src/py_template/__version__.py CHANGELOG.md
git commit -m "Bump version to 1.0.0"
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin main --tags-
Test Before Release
- Run full test suite
- Test installation from built packages
- Verify CLI commands work
-
Document Changes
- Keep CHANGELOG.md up-to-date
- Use conventional commit messages
- Include migration guides for breaking changes
-
Version Carefully
- Follow semantic versioning strictly
- Never reuse version numbers
- Use pre-release versions for testing
-
Communication
- Announce releases to users
- Provide upgrade instructions
- Maintain release notes
-
Automation
- Let CI/CD handle builds
- Don't manually edit releases
- Use consistent tagging conventions