Skip to main content

Template library demonstrating Python package release CI/CD

Project description

test-python-package-release

Template repository demonstrating a complete CI/CD pipeline for Python packages published to PyPI.

Quick start

uv sync --group dev
uv run pytest

Project layout

.
├── .github/workflows/   # CI, Claude review, release-please, publish
├── src/                 # library code (src/ layout)
├── tests/               # pytest tests
├── pyproject.toml       # single source of truth: build, deps, ruff, pytest, tox
├── .pre-commit-config.yaml
├── commitlint.config.js
└── CHANGELOG.md         # managed by release-please

Development

# Install hooks (runs ruff + ty pre-commit, conventional commit-msg)
uv run pre-commit install --hook-type pre-commit --hook-type commit-msg

# Run the full test matrix (3.11, 3.12, 3.13)
uv run tox

# Single env
uv run tox -e py313 -- -k calculator

# Lint / format check / type check
uv run ruff check .
uv run ruff format --check .
uv run ty check src

Commits

Every commit MUST follow the Conventional Commits specification.

Examples:

  • feat: add support for negative numbers
  • fix(calculator): correct divide by zero error
  • chore(deps): bump ruff to 0.9
  • feat!: drop Python 3.10 support (breaking change → major bump)

Enforced locally by conventional-pre-commit (commit-msg hook) and in CI by commitlint.

Release flow

PR opened ──▶ ci.yml (lint, ty, pytest matrix, commitlint)
                │
                └─ optional: comment "@claude" ──▶ claude-review.yml

PR merged ──▶ main ──▶ release-please.yml
                          │
                          └─ creates/updates a "Release PR"
                             (bumps version, regenerates CHANGELOG)

Release PR merged ──▶ release-please tags + creates GitHub Release
                          │
                          └─ publish.yml ──▶ uv build
                                            ──▶ TestPyPI (OIDC)
                                            ──▶ PyPI (OIDC, gated env)

First-time setup after cloning the template

  1. Rename name in pyproject.toml, the package directory under src/, and imports in tests/.
  2. Configure Trusted Publishers on PyPI and TestPyPI for your repo, pointing to the publish.yml workflow and the pypi / testpypi environments.
  3. Create two GitHub Environments named testpypi and pypi (optionally add required reviewers on pypi as a manual prod gate).
  4. Add an ANTHROPIC_API_KEY repository secret (for the Claude review workflow).
  5. Settings → Actions → General → Workflow permissions → "Read and write permissions" so release-please can open PRs and push tags.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

test_python_package_release-0.3.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

test_python_package_release-0.3.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file test_python_package_release-0.3.0.tar.gz.

File metadata

File hashes

Hashes for test_python_package_release-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d54ae4fac94b35f98dd408d64587616d036b0647eb46d49c358780e2c6b35f45
MD5 cff9faf8e8b7f673d9b6f878f2cb7200
BLAKE2b-256 f682d95ca79e27e9c46807f25efcb147e7b156f25d58c7a7dad1dfc941b02c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for test_python_package_release-0.3.0.tar.gz:

Publisher: publish.yml on wozniakos10/test_python_package_release

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file test_python_package_release-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for test_python_package_release-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0507daac18dc69f2dfefd8c4b3c5d525cb960706d724e26fb30fdfb37eb904c1
MD5 99c89f42c49e26abbe210074f0ce9a68
BLAKE2b-256 009b4d7c058d73118a888c890d95e09db6772335431c66892486f3cfc8a0ff0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for test_python_package_release-0.3.0-py3-none-any.whl:

Publisher: publish.yml on wozniakos10/test_python_package_release

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page