Pin contributor uv version to CI and document deliberate uv upgrades#2451
uv version to CI and document deliberate uv upgrades#2451Conversation
Documentation build overview
5 files changed ·
|
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
uv version to CI and document deliberate uv upgrades
required-version gates every uv invocation, not only `uv lock`, so pinning it to ==0.10.9 broke every build that ran a different uv: - the Docker build used the floating `0.10` image tag, which now ships 0.10.12 - Read the Docs installed 0.10.3 via asdf - the pre-commit job ran through tox-dev/action-pre-commit-uv, which invokes pre-commit with `--with pre-commit-uv`; that pulls in the latest uv (0.12.7) and puts it ahead of the pinned one on PATH, where our `uv run ...` hooks pick it up Pin the Dockerfile and Read the Docs to 0.10.9, and run pre-commit with plain `--with pre-commit` (all our hooks are `language: system`, so pre-commit-uv has no hook environments to speed up anyway). Also document every place the version is pinned, so a uv bump moves them together, note that `uv self update` is unavailable for pip/brew installs, and fill in the changelog PR number. Signed-off-by: F.N. Claessen <felix@seita.nl>
The documented deploy hook runs 'uv sync --frozen' in a checkout of this repo, so required-version applies there as well. Signed-off-by: F.N. Claessen <felix@seita.nl>
There was a problem hiding this comment.
Pull request overview
Aligns contributor tooling with CI by pinning an exact uv version at the source (pyproject.toml) and documenting the workflow for deliberate uv upgrades, reducing noisy/non-semantic uv.lock diffs.
Changes:
- Enforce an exact
uvversion via[tool.uv].required-versionand update Docker/RTD/CI to match - Update contributor and dependency-management docs to explain the pin and how to upgrade
uvdeliberately - Add a changelog entry describing the new
uvpinning behavior for reproducible lockfile output
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Enforces exact uv version via [tool.uv].required-version |
| documentation/dev/setup-and-guidelines.rst | Adds contributor guidance to pin uv locally |
| documentation/dev/dependency-management.rst | Documents the enforced uv version and the coordinated upgrade procedure |
| documentation/dev/automated-deploy-via-GHActions.rst | Notes server-side uv must match the pinned version |
| documentation/changelog.rst | Adds Infrastructure / Support changelog entry for uv pinning |
| Dockerfile | Pins the uv base image tag to the exact required version |
| .readthedocs.yaml | Pins uv version in Read the Docs build environment |
| .github/workflows/lint-and-test.yml | Runs pre-commit without action-pre-commit-uv to avoid overriding the pinned uv |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
0.10.9 dates from March and predates two minor releases, and pinning it made that the version every contributor, plugin developer, self-hoster and CI job has to run. So bump it to current uv while we are touching all the pin sites anyway. uv.lock is unchanged: 0.12.7 accepts it as up to date and rewrites nothing. Also add .github/workflows/docker-build.yml, which pins setup-uv too, to the list of places to bump (spotted by Copilot), rewrap the new comments so lines break only after punctuation, and say in the changelog who the pin reaches. Signed-off-by: F.N. Claessen <felix@seita.nl>
|
Reviewed and pushed corrections. Two things worth deciding on explicitly before merge. 1. The pin reaches further than contributors.
The issue framed the strict-vs-range trade-off around lockfile writers only. It is wider than that, so the changelog entry now says so. If that reach is unwanted, 2. The version is now What was broken. The pin as originally proposed only covered the place the lock is written, so every build that ran a different
The CI one is the subtle one: All checks are green now. Also documented every place the version is pinned, so a future bump moves them together, and noted that |
uv 0.12.7 writes markers in a more compact canonical form than 0.10.9 did, so the first lockfile write under the new pin reformats the whole file. Do that here, on its own, rather than leaving it to land on top of the next real dependency change, which is the churn issue #2449 is about. No dependency changes: no package is added, removed or moved to another version, and no wheel or sdist entry changes. The diff is entirely uv dropping markers that are redundant given [tool.uv].environments, e.g. { name = "mako", marker = "sys_platform == 'darwin' or sys_platform == 'linux' or sys_platform == 'win32'" } becomes { name = "mako" } Verify with: git show --stat, then git show -- uv.lock | grep -E '^[+-](name|version) = ' # empty Signed-off-by: F.N. Claessen <felix@seita.nl>
The check job ran `uv run --with pre-commit`, which resolves whatever pre-commit is latest at run time, so CI could change behaviour without any commit here (spotted by Copilot). Add pre-commit to the dev dependency group instead, where uv.lock pins it and the periodic dependency-upgrade PR bumps it along with everything else. The dev group is already installed in that job, so the step is just `uv run --no-sync pre-commit run --all-files`. Signed-off-by: F.N. Claessen <felix@seita.nl>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
If one can have multiple uv versions on a system, then I guess the inconvenience to others isn't a big problem. Can one? Also, I'd like to know if @TeaDrinkingProgrammer has an opinion here. |
Context: - Only uv.lock conflicted. Both sides listed flexmeasures' own dependencies, main having added limits and this branch croniter and cron-descriptor. - The two lockfiles were also written by different uv versions, which normalise environment markers differently, so the sides disagreed on nearly every line rather than only on those three packages. Change: - Took main's uv.lock and regenerated it with uv 0.10.9, the version that wrote it (see #2451, which pins this and will later move everything to 0.12.7). That adds cron-descriptor and nothing else: 16 insertions, no deletions, and no package re-versioned. - Resolving it by hand was not viable: keying on the package name drops the Python 3.10 halves of version-split entries such as pint 0.24.4, and keying on the whole line keeps both marker spellings of every package. Signed-off-by: F.N. Claessen <felix@seita.nl>
uv.lockwas being rewritten by contributors using a neweruvthan CI, causing large non-semantic lockfile diffs and avoidable merge/review churn. This makes the requireduvversion part of the project, so that it is enforced where the damage is done rather than caught in review.Note (updated after review): this PR pins
uvto 0.12.7, not to CI's previous0.10.9. That is a deliberate upgrade —0.10.9is from March and two minor releases behind, and pinning it would have frozen every contributor, plugin developer, self-hoster and CI job to it. Alluvpins move together to 0.12.7 here.What it does
Enforce the version at the source (
pyproject.toml):uvthen refuses to run on a mismatch, with an actionable message.Pin every place
uvruns, sincerequired-versiongates everyuvinvocation and not justuv lock:versioninput ofastral-sh/setup-uvinlint-and-test.yml,docker-build.yml,docker-qa.yml,pypi-publish.ymlandactions/setup-test-env/action.ymlARG UV_VERSIONin theDockerfile(it used the floating0.10image tag, which now ships a different patch release)asdfcommands in.readthedocs.yaml(they installed 0.10.3)Regenerate
uv.lockwith the pinneduv, in its own commit. 0.12.7 writes markers in a more compact canonical form, so the first write under the new pin reformats the file. Doing it here means it does not land on top of the next real dependency change — which is exactly the churn Pin uv for contributors too, and make upgrading it a deliberate step #2449 is about. No package is added, removed or re-versioned in that commit:git show ee9c2ea68 -- uv.lock | grep -E '^[+-](name|version) = 'is empty.Run pre-commit without
tox-dev/action-pre-commit-uv. That action runs pre-commit asuv run --with pre-commit-uv ..., andpre-commit-uvdepends onuv>=0.9.1, so the overlay environment put the latestuvahead of the pinned one onPATH— where ourentry: uv run blackhooks picked it up. All our hooks arelanguage: system, so it had no hook environments to speed up anyway.pre-commititself now comes from the locked dev group, so CI does not follow its latest release either.Document it:
dependency-management.rstlists every place the version is pinned so a bump moves them together, notes thatuv self updateis unavailable for pip/brew installs, and the deploy guide notes that servers runninguv sync --frozenneed the pinned version too.Trade-off to be aware of
The pin reaches beyond contributors: anyone running
uvin a FlexMeasures checkout needs that exact version, including plugin developers and self-hosters followingautomated-deploy-via-GHActions.rst. The changelog entry says so. A range like>=0.12,<0.13would be softer, but lets patch-level marker churn back in, which is the thing being prevented.