TickYouOff
Back
🐍

PyPI Publishing

Hard 15 items · 1 hour
testuser's avatar
testuser Published 3 days ago

This checklist walks you through packaging and publishing a Python project: pyproject.toml setup, docs and metadata, testing across Python versions, building distributions, TestPyPI verification, and final PyPI release with GitHub tagging. It’s for developers preparing a release of an open-source or internal Python library who want a repeatable, test-first workflow.

Progress
0 / 15
  1. Create pyproject.toml with project metadata and build-system — Include name, version, authors, description, and [build-system] per PEP 517/621.
  2. Set long_description and content-type from README in pyproject.toml — Point long_description to README.md and set content-type to text/markdown.
  3. Add LICENSE file and update trove classifiers in pyproject.toml — Pick a SPDX license and add matching classifiers for Python versions and license.
  4. Configure package inclusion rules and package_data — Ensure packages, include/exclude, and package_data cover modules and data files you want published.
  5. Update the package version using semantic versioning — Bump the version in pyproject.toml (or your version file) to the next release number.
  6. Update CHANGELOG.md with user-facing release notes — Record added, changed, fixed items and reference the new version.
  7. Run the test suite locally with pytest and fix failures — Run pytest and ensure all tests pass before multi-env testing.
  8. Configure and run tox for multi-version testing — Define tox envs for supported Python versions and run tox to verify compatibility.
  9. Add or update CI workflow to run tests and build on push/PR — Create GitHub Actions to run tests, lint, and build artifacts automatically.
  10. Build source and wheel distributions locally — Run python -m build to produce sdist and wheel in dist/.
  11. Validate distributions with twine check — Run twine check dist/* to catch metadata or long_description issues.
  12. Upload distributions to TestPyPI using twine and an API token — Use twine upload --repository testpypi dist/* and secure credentials via env vars.
  13. Install the package from TestPyPI in a fresh virtualenv and smoke-test — pip install --index-url https://test.pypi.org/simple/ your-package and import/check core behavior.
  14. Upload distributions to production PyPI with twine — After TestPyPI verification, run twine upload dist/* to PyPI using a token.
  15. Create and push a Git tag, then publish a GitHub release with changelog — Tag the release (git tag -a vX.Y.Z), push tag, and create a GitHub release with notes.
Sign in to save
📝 My Notes