Preparing a Release of TurboGears

Warning

Release tagging, package publishing, documentation publishing, and release announcements are maintainer-only actions. Contributors should stop after preparing and validating a change, then submit it for maintainer review.

Releases are prepared and published by the prepare_release.sh script in the TG2 Core repository. The script is the only supported release process: it validates the whole release before touching any remote repository and refuses to proceed when something is missing. Do not run the release steps by hand.

Usage

From the root of a TG2 Core checkout:

$ ./scripts/prepare_release.sh MAJOR.MINOR.PATCH[.devN] [--push]

Without --push the script prepares and validates the release locally without touching any remote repository. It prints the path of the retained workspace together with the prepared release commits, master merges, and tg<version> tags, so the result can be inspected before publishing.

With --push the script publishes the release once the validation succeeds.

Prerequisites

  1. uv and twine on the command line, plus gh when using --push. The script checks them before doing any work.

  2. SSH access to GitHub and PyPI credentials for twine.

Before running the script

  1. Write the From <previous version> to <released version> chapter of docs/reference/upgrading.rst in the TG2 Docs repository and push it to the development branch. The script refuses to release without it. .devN releases are covered by the chapter of their base version.

  2. Make sure the TG2 Core and TG2 Devtools development branches hold everything the release should ship and pass their test suites.

What the script does

The script clones TG2 Core, TG2 Devtools, and TG2 Docs into a temporary workspace and then:

  1. Verifies that the upgrading guide has a chapter for the released version.

  2. Bumps the version of both packages, which must already be aligned, updates the TurboGears2 >= constraint of the devtools and of the quickstart templates, fills the new change log section from the commit history of both packages since their previous releases, and opens it in your editor for review; the reviewed section is committed together with the version bump.

  3. Builds the source distribution and wheel of both packages with uv and validates them with twine check, the same rendering validation PyPI applies on upload.

  4. Runs the devtools quickstart test suite against the built wheels and checks that the tests really installed the candidate version.

  5. Prepares the release commits on development, fast-forwards master, and creates the annotated tg<version> tags in all three repositories. The TG2 Docs repository gets no release commit; its tag automatically triggers the workflow that publishes the versioned text documentation.

With --push the script additionally:

  1. Re-checks the remote repositories, then pushes master, development, and the tag of all three repositories.

  2. Creates the GitHub releases of both repositories with auto-generated notes.

  3. Publishes the wheels and source distributions to PyPI with twine.

  4. Waits until PyPI lists the released version.

  5. Updates the latest release version, date, and download link of the TG2 website and pushes the change, which deploys the site through GitHub Pages. .devN releases skip the website.

When something fails

A validation failure aborts the script before the first Git release operation, so a failed run never leaves a half-published release behind. When a failure happens after publishing has started, the script keeps the workspace, reports what was already published, and prints the exact command to finish the remaining step by hand.

After the release

The maintainer curates the auto-generated GitHub release notes and publishes the release announcement.