Repository navigation
Template 0.1.44: lock files keep the git references the requirements write - #68
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
lock_requirements.pywrites 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 withResolutionImpossible. 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_referenceswrites each git package the requirements file names directly with the URL as written (the tag). The commit uv resolved follows as a comment:Packages named only transitively, commit pins, extras and environment markers are handled.
LOCK_FORMAT3. 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.pywhen it is still the 0.1.43 template file (the frozen copy is inresources/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.
test_template_sync_0_1_44.py, with the helper_v0_1_44.py.Checks
pip install --dry-run -r requirements.lock.txtfails withResolutionImpossible;1bdeb81and preprocessing0a26b48, the commits uv resolved.python -m pytest tests -q: 608 passed, 2 skipped.ruff checkandmypyare 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