Skip to content

ci: run the checks on locked dependencies - #377

Merged
uniqueg merged 3 commits into
devfrom
ci/locked-deps
Nov 1, 2026
Merged

uniqueg merged 3 commits into
devfrom
ci/locked-deps

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

The lint, test (both entries), chart and docs jobs of ci.yml installed the app with pip install -e ".[dev]" / ".[docs]", i.e. the newest versions in the ranges of pyproject.toml; the repo had no lock. Following cloud-registry#306 (#291 there):

  • uv.lock locks 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.
  • The four jobs set up uv from astral-sh/setup-uv pinned by commit (v10.3.3, as in cloud-registry; version-file: uv.lock) and run uv sync --locked --extra dev (--extra docs in docs) with setup-python's Python, .venv/bin on the PATH. lint also runs uv lock --check first. setup-python's pip cache is dropped.
  • Dependabot's pip entry is now a uv entry (same ignores and groups), updating pyproject.toml and uv.lock together.
  • check-added-large-files excludes uv.lock (518 KB).
  • Tests (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 except uv sync --locked (without --frozen, --no-sources or index options), pinned pipx run --spec and python -m build; every setup-uv step reads the version from uv.lock. The jobs with credentials are excluded here; ci: hash-check setuptools-scm in the push job #376 covers them.
  • Docs: docs/development.md (setup with uv 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; against dev's ci.yml the new tests fail (7 failures).
  • pre-commit run --all-files and gitleaks-all: passed.
  • uv sync --locked --extra dev --extra docs, mkdocs build --strict: passed; python -m build from the uv-created .venv: sdist and wheel built.
  • CI: all checks passed (run 41313664339; Push image/Publish image skipped 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

  • Regex-based install policy over all workflows is brittle (quality, medium): kept, as in cloud-registry, where it guards the same property; ci: hash-check setuptools-scm in the push job #376 extends it to the credential jobs.
  • Install steps repeated in four jobs instead of a composite action (quality, medium): the repo repeats setup steps per job, as cloud-registry does; test_jobs_on_lock guards drift.
  • Read the Docs builds from ranges, not the lock (quality, medium): unchanged from before and documented; same choice as cloud-registry.
  • uv>=0.13 without an upper bound; split the test module (quality, low): kept, matching cloud-registry.

🤖 Generated with Claude Code

uniqueg and others added 2 commits November 1, 2026 14:35
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]>
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The 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 setup

sequenceDiagram
    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
Loading

Flow diagram for locked CI checks

flowchart 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
Loading

File-Level Changes

Change Details Files
Replaced range-based dependency installation in the four non-publishing CI jobs with reproducible uv lockfile synchronization.
  • Added the 130-package uv.lock, including the locked uv development dependency.
  • Pinned setup-uv by commit and configured every job to read uv’s version from uv.lock.
  • Changed lint, test, chart, and docs jobs to run uv sync --locked with the appropriate extra and expose .venv/bin.
  • Added an explicit uv lock --check step to lint and removed pip caching.
.github/workflows/ci.yml
pyproject.toml
uv.lock
Added automated safeguards preventing CI workflows from silently reverting to unlocked or unauthorized Python package installation.
  • Added workflow parsing and command classification for pip and alternative installers.
  • Asserted locked syncs, correct extras, setup ordering, lock validation, and locked uv configuration.
  • Excluded credential-bearing jobs while enforcing installation policy for other workflow jobs.
  • Covered the policy helpers with focused pattern and command-splitting tests.
tests/test_workflows.py
Updated dependency maintenance and repository checks to support the committed uv lockfile.
  • Switched Dependabot from pip to uv so manifest and lock updates are coordinated.
  • Excluded uv.lock from the large-file pre-commit hook.
  • Documented locked development, dependency update, and CI installation procedures.
.github/dependabot.yml
.pre-commit-config.yaml
docs/development.md
docs/contributing/index.md
Documented the remaining intentional use of unlocked dependency ranges outside these CI jobs.
  • Added a Read the Docs comment clarifying that it installs from pyproject.toml ranges.
  • Explained that the image, build requirements, pipx tools, and Read the Docs remain outside uv.lock.
.readthedocs.yaml
docs/development.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@read-the-docs-community

read-the-docs-community Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35559497 | 📁 Comparing 57bae8a against latest (e91ca60)

  🔍 Preview build  

2 files changed
± contributing/index.html
± development/index.html

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e91ca60) to head (57bae8a).
⚠️ Report is 1 commits behind head on dev.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 13:51

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/test_workflows.py Resolved
`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]>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/test_workflows.py Resolved
@uniqueg
uniqueg merged commit 95d58ba into dev Nov 1, 2026
32 checks passed
@uniqueg
uniqueg deleted the ci/locked-deps branch November 1, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: run the checks on locked dependencies

1 participant