Automated release workflow for Python packages, including version bumping, test execution, build, upload, and git tagging.
- 🚀 Automated Release Flow: Handles release lifecycle from version checks to final upload
- 🧪 Integrated Testing: Runs project tests before packaging
- 📦 Build + Upload: Builds distributions and uploads with Twine
- 🔢 Version Management: Supports patch, minor, and major bumps
- 🧰 Interpreter Detection: Finds available Python interpreters and selects highest version
- 🏷️ Git Integration: Commits, pushes, and tags release versions
- 🛟 Dry-Run Support: Preview release actions without changing repository state
pip install kingkybel-pypi-release-toolOr from source:
git clone https://github.com/kingkybel/PyPIReleaseTool.git
cd PyPIReleaseTool
pip install -e .# Default patch release
python release_to_pypi.py
# Minor or major release
python release_to_pypi.py --minor
python release_to_pypi.py --major
# Dry-run only
python release_to_pypi.py --dry-runpython release_to_pypi.py [--repo REPO_DIR] [--minor] [--major] [--dry-run]Options:
--repo,-r: Target repository directory (defaults to current directory)--minor,-m: Increment minor version (x.y.z->x.y+1.0)--major,-M: Increment major version (x.y.z->x+1.0.0)--dry-run: Show actions without changing files, git state, or PyPI
For packaging-only flows aligned with modern publishing practice:
./release.sh --help
./release.sh --testpypi-only
./release.sh --skip-testpypi
./release.sh --skip-uploadPyPIReleaseTool/
├── assets/
│ └── banners/
│ └── pypi-release-tool-banner.svg
├── pypi_release_tool/
│ ├── __init__.py
│ ├── __main__.py
│ └── release_tool.py
├── release_to_pypi.py
├── pyproject.toml
├── setup.py
├── release.sh
├── requirements.txt
└── README.md
- Python 3.8+
- Git configured with push access
- Twine credentials in
~/.secretsusingTWINE_USERNAME/TWINE_PASSWORD, or interactive token entry at upload time
The Python release workflow (release_to_pypi.py) looks for Twine credentials in ~/.secrets first.
Example:
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-AgENdGVzdC5weXBpLm9yZwIk..."Behavior:
- If both
TWINE_USERNAMEandTWINE_PASSWORDare found in~/.secrets, they are used automatically. - If one or both are missing, a warning is shown and you are prompted for the PyPI token/password securely.
- The tool expects a valid
pyproject.tomland package__init__.pywith a__version__field. - The default workflow assumes
mainas the primary git branch.