Metadata-Version: 2.5
Name: uv-release-manager
Version: 1.0.0
Summary: Release uv projects that pin git dependencies during development
Project-URL: Repository, https://github.com/experimaestro/uv-release-manager
License-Expression: GPL-3.0-or-later
Keywords: dependencies,git,pypi,release,uv
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.11
Requires-Dist: git-cliff>=2.6
Requires-Dist: packaging>=24
Requires-Dist: tomlkit>=0.13
Description-Content-Type: text/markdown

# uv-release-manager

Release [uv](https://docs.astral.sh/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]`:

```toml
[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.

## Commands

```sh
# 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-run
```

### check

`check` (also run by `gh-release`) verifies that:

- each git source points to a commit tagged with a version (`v1.2.3` or
  `1.2.3`) that is published on PyPI; the commit is the one locked in
  `uv.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 `path` source
- there are no uncommitted changes, `uv.lock` is up to date, and `HEAD` is
  pushed to the upstream branch
- optionally (`--test COMMAND`), `COMMAND` passes 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.

### update

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

`gh-release` uses [git-cliff](https://git-cliff.org) 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.

## Release

This project is released with itself:

```sh
uv run uv-release-manager gh-release --dry-run   # version and release notes
uv run uv-release-manager gh-release
```

The GitHub release triggers `.github/workflows/python-publish.yml`, which runs
`uv-release-manager check` again and publishes to PyPI (trusted publishing).
