Your CD workflow will automatically publish ADCToolbox to PyPI whenever you create a new version tag. This means users can install the latest version with pip install adctoolbox.
- Go to https://pypi.org/account/register/
- Verify your email
- (Optional but recommended) Set up 2FA
- Go to https://pypi.org/manage/account/token/
- Click "Add API token"
- Token name:
GitHub Actions - ADCToolbox - Scope: "Entire account" (or limit to project after first upload)
- Copy the token (you'll only see it once!)
- Go to your GitHub repository
- Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
PYPI_API_TOKEN - Value: Paste your PyPI token (starts with
pypi-) - Click "Add secret"
┌─────────────────────────────────────────────────────────┐
│ Developer Action: Create and Push Version Tag │
│ $ git tag v0.8.0 │
│ $ git push origin v0.8.0 │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ GitHub Actions CD Workflow Triggers │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ Step 1: Build Package │
│ - Builds wheel (.whl) │
│ - Builds source distribution (.tar.gz) │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ Step 2: Check Package │
│ - Validates metadata │
│ - Checks for common errors │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ Step 3: Publish to PyPI │
│ - Uploads to https://pypi.org/project/adctoolbox/ │
│ - Uses secure API token │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ Step 4: Create GitHub Release │
│ - Creates release with tag │
│ - Attaches .whl and .tar.gz files │
│ - Auto-generates release notes from commits │
└─────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────┐
│ Users can install: │
│ $ pip install adctoolbox │
│ $ pip install adctoolbox==0.8.0 │
│ $ pip install --upgrade adctoolbox │
└─────────────────────────────────────────────────────────┘
Edit python/src/adctoolbox/__init__.py:
__version__ = "0.8.0" # ← Update thispython/pyproject.toml reads this value dynamically via
version = {attr = "adctoolbox.__version__"}.
Create/update CHANGELOG.md:
# Changelog
## [0.8.0] - 2026-05-18
### Added
- SAR behavioral model helpers with `sar_convert()`
- Release metadata synchronized to 0.8.0
- MATLAB data generation scripts
### Changed
- Refined spectrum side-bin defaults and near-Nyquist handling
### Fixed
- MATLAB `plotspec.m` Nyquist-bin handlinggit add python/src/adctoolbox/__init__.py CHANGELOG.md
git commit -m "Bump version to 0.8.0"
git push origin main# Create annotated tag (recommended)
git tag -a v0.8.0 -m "Release v0.8.0"
# Or simple tag
git tag v0.8.0
# Push the tag (this triggers CD!)
git push origin v0.8.0- Go to GitHub → Actions tab
- Watch the "CD - Publish to PyPI" workflow
- After ~2 minutes, check:
- PyPI: https://pypi.org/project/adctoolbox/
- GitHub Releases: https://github.com/yourusername/ADCToolbox/releases
cd python
# Build package
python -m build
# Check package
twine check dist/*
# Install locally to test
pip install dist/adctoolbox-0.8.0-py3-none-any.whl
# Test it works
python -c "from adctoolbox import analyze_spectrum, sar_convert; print('Success!')"
adctoolbox-get-examples- Create account at https://test.pypi.org/
- Create API token
- Upload test:
twine upload --repository testpypi dist/* - Install from test:
pip install --index-url https://test.pypi.org/simple/ adctoolbox
Use semantic versioning: MAJOR.MINOR.PATCH
- MAJOR (1.0.0): Breaking API changes
- MINOR (0.8.0): New features, backwards compatible
- PATCH (0.2.2): Bug fixes, backwards compatible
Examples:
v0.7.0→v0.8.0: New features (updated SAR and spectrum tools)v0.8.0→v1.0.0: Major release (API redesign)
- You already published this version to PyPI
- PyPI doesn't allow re-uploading same version
- Solution: Bump version number and create new tag
- Check
PYPI_API_TOKENsecret is set correctly - Verify token hasn't expired
- Ensure token has upload permissions
- Someone else registered
adctoolboxon PyPI - Solution: Choose different name in
pyproject.toml - Or claim the name if you own it
- PyPI couldn't render your README.md
- Solution: Validate with
twine check dist/* - Check markdown syntax
# Delete local tag
git tag -d v0.8.0
# Delete remote tag
git push origin :refs/tags/v0.8.0Note: Can't delete from PyPI once published! Only option is to "yank" the release.
# On PyPI website, or using twine
pip install twine
twine upload --repository pypi --skip-existing dist/*Then on PyPI website → Manage → Options → "Yank this release"
Before publishing v0.8.0 for the first time:
- PyPI account created and verified
- PyPI API token created
- GitHub secret
PYPI_API_TOKENadded - Test build works:
python -m build - Test package works:
twine check dist/* - Test install works:
pip install dist/*.whl - Test examples work:
adctoolbox-get-examples - README.md looks good (will be PyPI description)
- Version number updated in
python/src/adctoolbox/__init__.py - CHANGELOG.md updated (optional)
- All changes committed to main branch
- Tag created:
git tag v0.8.0 - Tag pushed:
git push origin v0.8.0
# Uninstall local version
pip uninstall adctoolbox
# Install from PyPI
pip install adctoolbox
# Test it works
python -c "from adctoolbox import analyze_spectrum, find_coherent_frequency; print('Success!')"
adctoolbox-get-examplesAdd installation badge to README.md:
[](https://badge.fury.io/py/adctoolbox)
[](https://pepy.tech/project/adctoolbox)For beta/alpha releases:
# Update version in python/src/adctoolbox/__init__.py
__version__ = "0.8.0b1" # Beta 1
__version__ = "0.8.0rc1" # Release candidate 1
# Tag and publish
git tag v0.8.0b1
git push origin v0.8.0b1
# Users install with
pip install --pre adctoolboxYour complete CI/CD pipeline:
- CI (on every commit): Tests unit coverage and example smoke tests automatically
- CD (on version tag): Builds and publishes to PyPI automatically
This is production-grade automation used by major Python projects!
# Release workflow
vim python/src/adctoolbox/__init__.py # Update version
git commit -am "Bump version to X.Y.Z"
git push
git tag vX.Y.Z
git push origin vX.Y.Z # Triggers CD!
# Wait 2 minutes, then:
pip install --upgrade adctoolboxDone! 🚀