Skip to content

Template 0.1.44: lock files keep the git references the requirements write - #68

Merged
guijacquemet merged 1 commit into
mainfrom
claude/serene-pascal-q9vpxj
Dec 3, 2026
Merged

guijacquemet merged 1 commit into
mainfrom
claude/serene-pascal-q9vpxj

Conversation

@guijacquemet

Copy link
Copy Markdown
Collaborator

Problem

lock_requirements.py writes uv's resolution, and uv replaces each git tag with its commit (name @ git+URL@v1.2.0 → …@<commit>). pip compares git URLs as text. When another git package requires the same package by tag, pip sees two requirements and refuses the lock file with ResolutionImpossible. The conda check of Updates on notebook change then fails and reverts the app's commit.

Found in guijacquemet/LabConstrictor-OpticalFlow3D: its PR #20 pinned morphobricks-preprocessing and -normalization at v0.10.0, and preprocessing requires normalization @v0.10.0. The MorphoBricks bricks all depend on one another this way, so this affects any app that uses two of them.

Change (template 0.1.44)

  • Lock files keep git references. In lock_requirements.py, keep_requested_git_references writes each git package the requirements file names directly with the URL as written (the tag). The commit uv resolved follows as a comment:

    …normalization.git@v0.10.0  # resolved: …@1bdeb81…
    

    Packages named only transitively, commit pins, extras and environment markers are handled.

  • LOCK_FORMAT 3. Every lock file is written again. For apps without git requirements the content is unchanged.

  • Migration 0.1.43 → 0.1.44. It replaces lock_requirements.py when it is still the 0.1.43 template file (the frozen copy is in resources/v0_1_43_to_v0_1_44/previous). A customised file is skipped, with what to change by hand.

  • Design note in .tools/docs/migration_0_1_44.md.

  • Tests.

    • New: test_template_sync_0_1_44.py, with the helper _v0_1_44.py.
    • Updated: the 0.1.41 tests and the 0.1.43 helper now see the 0.1.43 file.

Checks

  • Real reproduction on the OpticalFlow3D requirements, with uv and pip 25:
    • before: pip install --dry-run -r requirements.lock.txt fails with ResolutionImpossible;
    • after: it succeeds and installs normalization 1bdeb81 and preprocessing 0a26b48, the commits uv resolved.
  • python -m pytest tests -q: 608 passed, 2 skipped. ruff check and mypy are clean.

Trade-off: a tag can move, so the lock pins a directly named git package by its tag, not its commit. The comment records the commit it resolved to.


Generated by Claude Code

…write

lock_requirements.py wrote uv's resolution, in which name @ git+URL@v1.2.0 becomes
name @ git+URL@<commit>. pip compares git URLs as text, so when another git package requires the
same package with the tag (morphobricks-preprocessing v0.10.0 requires morphobricks-normalization
@v0.10.0), pip refused the lock file (ResolutionImpossible): the conda check of 'Updates on
notebook change' failed and reverted the app's commit (LabConstrictor-OpticalFlow3D PR #20).

keep_requested_git_references: after uv's resolution, a git package the requirements file names
directly keeps the URL as written (the tag), with the commit uv resolved as a comment; packages
named only transitively, commit pins, extras and markers are handled. LOCK_FORMAT 3 writes every
lock file again. Migration 0.1.43 -> 0.1.44 replaces lock_requirements.py when it is still the
0.1.43 template file (frozen copy in resources/v0_1_43_to_v0_1_44/previous), with a design note
(.tools/docs/migration_0_1_44.md) and tests (test_template_sync_0_1_44.py, helper _v0_1_44.py;
the 0.1.41 tests and the 0.1.43 helper now see the 0.1.43 file through it).

Checked with the OpticalFlow3D requirements, uv and pip 25: before, pip install --dry-run -r
requirements.lock.txt fails with ResolutionImpossible; after, it succeeds and installs the
commits uv resolved. pytest tests: 608 passed; ruff and mypy clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AERqtoqUxiixuPVPV
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.

2 participants