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 numbersfix(calculator): correct divide by zero errorchore(deps): bump ruff to 0.9feat!: 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
- Rename
nameinpyproject.toml, the package directory undersrc/, and imports intests/. - Configure Trusted Publishers on
PyPI and
TestPyPI for your repo, pointing
to the
publish.ymlworkflow and thepypi/testpypienvironments. - Create two GitHub Environments named
testpypiandpypi(optionally add required reviewers onpypias a manual prod gate). - Add an
ANTHROPIC_API_KEYrepository secret (for the Claude review workflow). - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file test_python_package_release-0.2.0.tar.gz.
File metadata
- Download URL: test_python_package_release-0.2.0.tar.gz
- Upload date:
- Size: 45.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e856ed63896dceca30f44061355533ec27afe9bf0dc14d734bda5b37dd36f7ab
|
|
| MD5 |
3d6b90bea4ded930534b9cc7abbee499
|
|
| BLAKE2b-256 |
b00f890aba0a50d8106ba1c6769ed41485110b82692e9948da587318e6a156d6
|
Provenance
The following attestation bundles were made for test_python_package_release-0.2.0.tar.gz:
Publisher:
publish.yml on wozniakos10/test_python_package_release
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
test_python_package_release-0.2.0.tar.gz -
Subject digest:
e856ed63896dceca30f44061355533ec27afe9bf0dc14d734bda5b37dd36f7ab - Sigstore transparency entry: 1675087077
- Sigstore integration time:
-
Permalink:
wozniakos10/test_python_package_release@cbb3303e4ac5fc7a6910ea2bad57f0ea3cdf9380 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wozniakos10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbb3303e4ac5fc7a6910ea2bad57f0ea3cdf9380 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file test_python_package_release-0.2.0-py3-none-any.whl.
File metadata
- Download URL: test_python_package_release-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25a63ba4a42b103029f4362864642e0e89591a4f83cb54b96bb8f8d3da84b61e
|
|
| MD5 |
0e7cd52617e6d25982b6a3cd7087295e
|
|
| BLAKE2b-256 |
0c65af363b3ba5f4cd87ad9b454bfd7aafb84107e68d1b4f395a173c7fcc71a7
|
Provenance
The following attestation bundles were made for test_python_package_release-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on wozniakos10/test_python_package_release
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
test_python_package_release-0.2.0-py3-none-any.whl -
Subject digest:
25a63ba4a42b103029f4362864642e0e89591a4f83cb54b96bb8f8d3da84b61e - Sigstore transparency entry: 1675087101
- Sigstore integration time:
-
Permalink:
wozniakos10/test_python_package_release@cbb3303e4ac5fc7a6910ea2bad57f0ea3cdf9380 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/wozniakos10
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cbb3303e4ac5fc7a6910ea2bad57f0ea3cdf9380 -
Trigger Event:
workflow_dispatch
-
Statement type: