Skip to content

Release

Maintainer guide to bump, tag, and publish mrjk.clak to PyPI.

Overview

Step Command
Preview task pre-release-show / task release-show / task changelog-show
Bump + changelog + commit + tag task pre-release / task release
Push task release-push (git push --follow-tags)
Publish Release workflow on v* tags (or task publish_pypi manually)
All of the above from GitHub Actions → Release → Run workflow (details)

Releases are driven by commitizen (config: [tool.commitizen] in pyproject.toml). One cz bump call:

  1. Computes the next version from the commits since the last tag (commit convention)
  2. Writes it to pyproject.toml and uv.lock (version_provider = "uv")
  3. Prepends a generated section to CHANGELOG.md
  4. Commits bump: version vX.Y.Z and creates the annotated tag vX.Y.Z

Version lives only in pyproject.toml. clak.__version__ is read on first access from installed package metadata (importlib.metadata.version("mrjk.clak")).

Pushing a v* tag runs the Release workflow (.github/workflows/release.yml): test gate, then task publish_pypi. Requires a GitHub environment named pypi with secret PYPI_TOKEN (PyPI API token).

Prerequisites

  • Clean git working tree (commitizen refuses to bump otherwise; untracked files are fine)
  • uv project deps on the daily Python 3.12 env (in-project .venv/ via uv sync; commitizen is in the dev group)
  • Stable releases: checkout main or master
  • Pre-releases: any branch except main/master (usually develop)
  • For CI publish: GitHub environment pypi + secret PYPI_TOKEN
  • For local/manual publish: a PyPI API token (UV_PUBLISH_TOKEN)

Supported runtime range for users: Python 3.10–3.13; 3.14 should work but is not officially supported yet (see Development setup).

Typical flows

Next pre-release on develop

task pre-release-show      # check the proposed version and changelog section
task pre-release           # e.g. 0.7.0a2 -> 0.7.0a3
task release-push          # CI publishes on the v* tag

Pre-release phases (a → b → rc):

task pre-release -- beta   # 0.7.0a3 -> 0.7.0b0
task pre-release -- rc     # 0.7.0b0 -> 0.7.0rc0

Phases only move forward: once on b, task pre-release (alpha) keeps bumping the beta number.

Stable release

git checkout main && git pull
task release-show
task release               # e.g. 0.7.0rc1 -> 0.7.0, or 0.7.0 -> 0.7.1 / 0.8.0
task release-push

The increment is detected from the commits (see below). Override it with task release -- --increment PATCH|MINOR|MAJOR.

Explicit version

uv run cz bump 0.7.0a2              # version + commit + tag, CHANGELOG untouched
uv run cz bump --changelog 0.7.0a2  # same, with a generated changelog section

Release from GitHub

Actions → Release → Run workflow (.github/workflows/release.yml) does the same from a button. The branch picks the mode:

Input Default Meaning
Use workflow from – main/master → stable release; any other branch (usually develop) → pre-release
dry_run on Bump, build, and show the next version and changelog section in the run summary; tests are skipped, nothing is pushed or published
phase alpha Pre-release phase (alpha, beta, rc); phases only move forward; ignored on main/master
increment auto Override the increment detected from commits (PATCH, MINOR, MAJOR)

Jobs

  1. Test (skipped on dry run): full test gate, reused from the CI workflow (ci.yml, Python 3.10–3.13)
  2. Bump and Tag (button only): cz bump on the runner, uv build (uploaded as the dist-vX.Y.Z artifact), run summary; if not a dry run, pushes the commit and tag together (git push --atomic)
  3. Publish to PyPI (skipped on dry run): checks out the tag and publishes it to PyPI (pypi environment, PYPI_TOKEN)

On a v* tag push, only Test and Publish to PyPI run.

Notes:

  • Tags pushed by the button do not start a second Release run (GitHub does not start workflows from GITHUB_TOKEN pushes), so nothing is published twice. If Publish to PyPI fails after the push, use Re-run failed jobs on that run: it checks out the same tag.
  • If main is protected (branch protection or ruleset), allow GitHub Actions to bypass it, or the push is rejected.
  • After a stable release on main, merge main back into develop; otherwise the next pre-release starts from the old version in develop's pyproject.toml.
  • Release notes: if CHANGELOG.md has a hand-written ## Unreleased section, the workflow and the local tasks rename it to ## v<next> (<date>) and bump without --changelog, so the section is kept as written. Without one, cz bump --changelog generates the section from commits.

Commit messages

Commits follow Conventional Commits: type(scope): subject, with an optional ! for breaking changes (refactor(views)!: ..., or a BREAKING CHANGE: footer).

Type Changelog section Version bump (pre-1.0)
feat Added minor
fix Fixed patch
refactor Changed patch
perf Performance patch
! / BREAKING CHANGE: footer under its own type minor (major_version_zero)
docs, test, build, ci, chore, style not listed none

Use the scope for the area instead of a custom type: feat(views):, fix(help):, test:, build(taskfile):. Commits with other types are ignored by the changelog and by the version detection.

task hooks-install adds a commit-msg git hook that rejects messages that do not follow the format (cz check).

Changelog

CHANGELOG.md is updated incrementally: each bump adds a section above the latest one and leaves the rest of the file untouched. Releases up to v0.7.0a2 were written by hand.

To add prose (upgrade notes, highlights) to a generated section, edit it right after the bump, before pushing:

task pre-release
$EDITOR CHANGELOG.md
git commit --amend --no-edit CHANGELOG.md
git tag -f -a -m "vX.Y.Z" vX.Y.Z   # move the tag to the amended commit
task release-push

PyPI authentication

CI (default)

Configure once in the GitHub repo:

  1. Environment: pypi
  2. Environment secret (not a variable): PYPI_TOKEN
  3. Value: a PyPI API token from pypi.org/manage/account/token (must start with pypi-; not a password; not a TestPyPI token)

On v* tag push, the workflow exports it as UV_PUBLISH_TOKEN and runs task publish_pypi (uv build + uv publish).

If publish fails with 403 Invalid or non-existent authentication information, the secret is usually missing/empty, misnamed, stored as a variable, or not a live pypi-… token for pypi.org.

Local / manual

export UV_PUBLISH_TOKEN=pypi-AgEIcHlwaS5vcmc...
task publish_pypi

If you see HTTP 403 / access denied, the token is missing or revoked.

TestPyPI

task publish_pypi_test publishes to the testpypi index declared in pyproject.toml ([[tool.uv.index]]). You still need a token:

export UV_PUBLISH_TOKEN=pypi-...   # token from test.pypi.org
task publish_pypi_test