Release uv projects that pin git dependencies during development.
While several libraries evolve together, it is convenient to pin a dependency
to a git commit in [tool.uv.sources]:
[project]
dependencies = ["mylib>=0.3"]
[tool.uv.sources]
mylib = { git = "https://github.com/org/mylib", rev = "c4580cb" }Sources are only used for the local lock: the published package requires
mylib>=0.3. If the code needs the pinned commit, the release is broken as
soon as mylib 0.3 (or any version without that commit) is installed.
uv-release-manager checks, before releasing, that every git source points to
a released (tagged) version and that the dependency requires at least that
version.
# Can we release? (fails fast, exit code 1 otherwise)
uv-release-manager check
uv-release-manager check --test pytest # also test with the released deps
uv-release-manager check --test pytest --uv-args "--all-extras --group test"
# Move git sources to releases: for each source, choose between the next
# release containing the pinned commit and the latest one containing it
uv-release-manager update
uv-release-manager update --to next # without asking
uv-release-manager update --drop-source # remove the source (use PyPI)
# Set the lower bounds to the released versions of the git sources
uv-release-manager bump
# Check, then create the GitHub release (the publish workflow does the rest);
# without a version, the next one is computed from the conventional commits
uv-release-manager gh-release # e.g. v0.5.0 after a feat: commit
uv-release-manager gh-release 1.0.0 --dry-runcheck (also run by gh-release) verifies that:
- each git source points to a commit tagged with a version (
v1.2.3or1.2.3) that is published on PyPI; the commit is the one locked inuv.lock(what was developed against), or the one the source points to on the remote when the package is not locked - the lower bound of the dependency (main dependencies and extras) is this version: a lower bound below allows older, incompatible releases, and one above requires a version that was not tested
- there is no
pathsource - there are no uncommitted changes,
uv.lockis up to date, andHEADis pushed to the upstream branch - optionally (
--test COMMAND),COMMANDpasses in an isolated environment resolved without the sources (uv run --isolated --no-sources)
Sources of development-only dependencies ([dependency-groups]) and index
sources are ignored, since they are not part of the published metadata.
For each git source (or the ones given on the command line) that is not a
release, update proposes the next release (the first release whose tag
contains the pinned commit) and the latest release containing it. Older
releases are never proposed, since they would drop what the commit brings;
only non pre-release versions published on PyPI are. The source is then
pointed to the release tag (or removed with --drop-source), the lower bounds
are set to the release version, and uv.lock is updated. With --all, sources
already at a release are moved to the latest release containing them.
The tags containing a commit are found in tree-less clones of the
dependencies, cached in ~/.cache/uv-release-manager.
gh-release uses git-cliff to compute the next
version (--bumped-version; v0.1.0 for the first release) and the release
notes, then runs gh release create <tag> --target <HEAD>. The publish
workflow (triggered by the release) builds and uploads the package.
This project is released with itself:
uv run uv-release-manager gh-release --dry-run # version and release notes
uv run uv-release-manager gh-releaseThe GitHub release triggers .github/workflows/python-publish.yml, which runs
uv-release-manager check again and publishes to PyPI (trusted publishing).