This document contains all the steps required to make a new release of Torch Tweak.
As a helper, we use in this guide this variable:
VERSION=0.1.0rc1 # New version, including an optional rc suffix (set here as an example)Note:
Before doing the final release, it's recommended to prepare a pre-release version - a "release candidate" (or "rc" in short). This requires adding, e.g.,
rc1to the VERSION string. When all tests and checks end properly, you can follow up with the final release. If any fix is required, it should be included in another rc version (e.g.,0.1.0rc2).
- Make sure remotes are up-to-date on your machine (
git remote update). - Make changes for the release.
- Create a new tag based on the latest commit - it should follow the format:
v<major>.<minor>.<patch>(e.g.,v0.1.0). - Push the tag and branch to the repository.
- Create a new GitHub release using the tag created in the previous step.
Prepare changes for the release:
- Update remotes
git remote update
- Add a new entry to the
ChangeLog.md- For major releases mention API compatibility with the previous releases
- Update
fallback_versionin[tool.hatch.version] raw-optionsin allpyproject.tomlfiles, including top-level and examples, and refresh theuv.lockfiles- Run commands like:
sed -i -E "s/(fallback_version = \")[^\"]*\"/\1${VERSION}\"/" pyproject.toml examples/*/pyproject.toml git diff --stat # expect one changed line in every pyproject.toml uv lock for example in examples/*/pyproject.toml; do uv lock --directory "$(dirname "${example}")"; done
- The fallback is the last released version, for a build on a machine without access to github's tags
- Run commands like:
- Update
versionanddate-releasedinCITATION.cff - Once all changes are done, build locally from a clean worktree
(and/or verify changes on CI), including:
git status --porcelainprints nothing. The packaging workflow fails when it does not, so a dirty tree is not packed- Verify if scanners/linters/checkers passed
- Make sure packaging workflow builds properly (you can check that on your fork)
- Verify if version is set properly in the package
- Commit these changes and tag the release:
git add uv.lock examples CITATION.cff pyproject.toml ChangeLog.mdgit commit -S -m "chore: release v$VERSION"git tag -a -s -m "Version $VERSION" v$VERSION
- Verify if commit and tag are properly signed:
git verify-commit <commit's sha>git verify-tag v$VERSION
- Push
mainbranch and the new taggit push origin HEAD:main v$VERSION --dry-run- Note
--dry-runin the above command - before actual push, make sure you're using the right remote!
To make the release official:
- Go to GitHub's releases tab:
- Tag version:
v$VERSION - Release title:
Torch Tweak $VERSION - Description: copy entry from
ChangeLog.mdand format it (e.g., no characters limit in line)
- Tag version:
- Announce the release in all appropriate channels
To assure the community that the release is a valid package from Torch Tweak maintainers, it's recommended to sign the release
commit and the tag (-S/-s parameters in commands above). If you require to generate a GPG key follow
these steps.
After that you'd also have to add this new key to your GitHub account - please do the steps in
this guide.