Repository navigation
ci: run the checks on locked dependencies - #377
Conversation
Lock all dependencies (runtime, dev and docs extras) in uv.lock, with uv as a dev dependency, so that the lock also pins the uv of CI. The lint, test, chart and docs jobs set up uv from a pinned astral-sh/setup-uv at the locked version and install the lock with `uv sync --locked`; lint checks the lock with `uv lock --check`. Dependabot's pip entry becomes a uv entry, which updates pyproject.toml and uv.lock together. Tests check that these jobs install from the lock and that no job without publishing credentials installs unlocked packages. The development and contributing docs describe the locked setup. Closes #375 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Locked syncs outside the checked jobs may not add `--frozen`, `--no-sources` or index options. The development docs point to uv's installation guide. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe pull request makes lint, test, chart, and docs CI checks reproducible by installing dependencies through a committed uv.lock and locking CI’s uv version, while adding workflow tests to enforce the installation policy. Dependabot, pre-commit configuration, and contributor documentation are updated to maintain and explain the new lockfile-based workflow. Sequence diagram for locked CI dependency setupsequenceDiagram
participant Job as CI job
participant Setup as setup-uv
participant Lock as uv.lock
participant UV as uv
participant Venv as .venv
Job->>Setup: version-file: uv.lock
Setup->>Lock: Read locked uv version
Setup-->>Job: Install pinned uv
Job->>UV: uv lock --check
UV->>Lock: Validate lock matches pyproject.toml
Job->>UV: uv sync --locked --extra dev
UV->>Lock: Resolve exact versions and hashes
UV->>Venv: Install app and dependencies
Job->>Venv: Add .venv/bin to PATH
Flow diagram for locked CI checksflowchart LR
Changes[pyproject.toml or uv.lock change] --> Dependabot[Dependabot uv update]
Dependabot --> Lock[Committed uv.lock]
Lock --> Jobs[Lint, test, chart, and docs jobs]
Jobs --> Setup[setup-uv reads version from uv.lock]
Setup --> Sync[uv sync --locked]
Sync --> Checks[Run reproducible checks]
Lock --> Policy[Workflow tests enforce locked installation]
Policy --> Checks
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #377 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2217 2217
=========================================
Hits 2217 2217 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_workflows.py" line_range="404" />
<code_context>
+# Other installers, and builds that install build requirements
+INSTALLERS = re.compile(
+ r"\b(pipx|pipenv|easy_install|uvx|pip-sync|poetry|pdm|hatch|conda|mamba"
+ r"|micromamba|uv\s+(pip|tool|sync|run|add|build|venv)"
+ r"|python[0-9.]*\s+-m\s+build)\b"
+)
</code_context>
<issue_to_address>
**Unlocked uv runs pass**
When a workflow uses a uv global option before an installer subcommand, such as `uv --offline run pytest`, `INSTALLERS` only matches `uv` when a listed subcommand immediately follows it, and `PIP` does not match `uv --offline run pytest`. `test_no_unlocked_installs` therefore skips the install-policy assertion for that command, even though `uv run` can resolve and install dependencies.
Recognize uv global options before installer subcommands, or parse the command arguments before applying the install policy.
</issue_to_address>Linked issues
#375 ci: run the checks on locked dependencies · 5 of 6 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Lock runtime, dev, and docs dependencies, pin CI's uv version in the lock, and check the lock against pyproject.toml. | ✅ Met | uv is added as a dev dependency; the lock is used to select CI's uv version, and lint runs uv lock --check. |
| 2 | Install locked dependencies in the lint, test, chart, and docs jobs with the appropriate extras. | ✅ Met | Each job sets up uv from uv.lock and uses uv sync --locked with its dev or docs extra. |
| 3 | Have Dependabot update pyproject.toml and uv.lock together. | ✅ Met | The Dependabot Python entry now uses the uv ecosystem. |
| 4 | Run checks on Dependabot pull requests that update the lock. | ✅ Met | Dependabot targets dev, and the CI workflow runs on pull requests targeting dev. |
| 5 | Test that the relevant jobs use the lock and that no job installs unlocked packages. | 🟡 Partly met | The tests check the four dependency-installing jobs, but exclude jobs identified as having publishing credentials; the PR says “#376 covers them.” |
| 6 | Document development setup using uv sync --locked. |
✅ Met | The development docs describe the locked setup and how to update and check the lock. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/test_workflows.py:404
`uv --offline run` and similar commands with global options before the subcommand are now checked as installers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#375 ci: run the checks on locked dependencies · 4 of 5 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Lock runtime, dev and docs dependencies with uv, pin CI's uv in the lock, and check the lock against pyproject.toml. | ✅ Met | uv is added as a dev dependency, uv.lock is added, and lint runs uv lock --check. |
| 2 | Install the lock in the lint, test, chart and docs jobs using pinned setup-uv and the appropriate extras. | ✅ Met | Each job uses setup-uv with version-file: uv.lock and uv sync --locked with its required extra. |
| 3 | Replace Dependabot's pip entry with uv so it updates pyproject.toml and uv.lock together. | ✅ Met | The Dependabot entry now uses the uv package ecosystem. |
| 4 | Test that jobs install from the lock and no job installs unlocked packages. | 🟡 Partly met | The install-policy test skips jobs classified as holding publishing credentials; the PR says, “The jobs with credentials are excluded here; #376 covers them.” |
| 5 | Update the developer docs to set up the environment with uv sync --locked. |
✅ Met | The development setup and dependency-update instructions use the lock. |
Summary
The lint, test (both entries), chart and docs jobs of
ci.ymlinstalled the app withpip install -e ".[dev]"/".[docs]", i.e. the newest versions in the ranges ofpyproject.toml; the repo had no lock. Following cloud-registry#306 (#291 there):uv.locklocks all dependencies (runtime,dev,docs), 130 packages; uv is a dev dependency (uv>=0.13, locked 0.13.6), so the lock pins CI's uv too.astral-sh/setup-uvpinned by commit (v10.3.3, as in cloud-registry;version-file: uv.lock) and runuv sync --locked --extra dev(--extra docsindocs) with setup-python's Python,.venv/binon thePATH.lintalso runsuv lock --checkfirst. setup-python's pip cache is dropped.pipentry is now auventry (same ignores and groups), updatingpyproject.tomlanduv.locktogether.check-added-large-filesexcludesuv.lock(518 KB).tests/test_workflows.py): the four jobs install from the lock with their extra; no job without publishing credentials runs a pip install or another installer exceptuv sync --locked(without--frozen,--no-sourcesor index options), pinnedpipx run --specandpython -m build; every setup-uv step reads the version fromuv.lock. The jobs with credentials are excluded here; ci: hash-check setuptools-scm in the push job #376 covers them.docs/development.md(setup withuv sync --locked, a new Dependencies section, docs build),docs/contributing/index.md(Packaging), comment in.readthedocs.yaml(Read the Docs still installs from ranges).Not on the lock, on purpose: the image (#365), the editable app's build requirements (isolated build, as before; no credentials in these jobs), cffconvert via
pipx run, Read the Docs.Closes #375
Verification
uv sync --locked --extra dev(uv 0.13.6, Python 3.13),coverage run -m pytest -W ignore::DeprecationWarning: 1108 passed, 177 skipped, 100% coverage.tests/test_workflows.py: 63 passed; againstdev'sci.ymlthe new tests fail (7 failures).pre-commit run --all-filesandgitleaks-all: passed.uv sync --locked --extra dev --extra docs,mkdocs build --strict: passed;python -m buildfrom the uv-created.venv: sdist and wheel built.Push image/Publish imageskipped on pull requests, as intended). Sourcery: two threads, one fixed (uv global options), one answered (credential jobs are ci: hash-check setuptools-scm in the push job #376).Declined review findings
test_jobs_on_lockguards drift.uv>=0.13without an upper bound; split the test module (quality, low): kept, matching cloud-registry.🤖 Generated with Claude Code