Write resolved constraints to [tool.uv] constraint-dependencies#90
Merged
Conversation
…traint-dependencies
erral
approved these changes
May 31, 2026
Contributor
erral
left a comment
There was a problem hiding this comment.
Tested and OK.
To include this in cookieplone-templates we would need further discussion because it would mean to remove repoplone part of downloading the dependencies from the equation, and adding a requirements.txt.
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.
Summary
The uv hook now writes the fully resolved constraints — including external
-c/-rchains such as Plone release constraints (-c https://dist.plone.org/...) — into[tool.uv] constraint-dependencies. uv itself cannot follow-c URLincludes, so previously theuv syncpath silently lost those pins. mxdev already resolves the whole chain (HTTP + caching + recursion) during the read phase intostate.constraints; this change just consumes that data — no new fetch logic._constraints_to_uv()turns resolved constraint lines into ordered("comment"|"entry", text)items: specifier lines become array entries, comment lines (provenance# begin/end constraints from,# … -> mxdev disabledmarkers) are preserved, decorative####rules / blanks / non-PEP-508 lines dropped._update_pyproject()builds a tomlkit multiline array (managed marker + comments + entries) and fully owns/replaces[tool.uv] constraint-dependencies.constraints-mxdev.txtpassthrough; uv handles conflicts as pip does.[tool.uv] managed = true; opt-out viauv-constraint-dependencies = falsein[settings].version-overridesstay excluded (they come through[tool.uv.sources]/override-dependencies); their disabled-markers are kept as comments.Idempotency (byte-identical rewrites) was de-risked via a tomlkit spike and is covered by a test.
Inspired by Maik Derstappen's uv-import-constraint-dependencies (attribution added to README).
Test Plan
pytest— 223 passed, 4 skipped (pre-existing hg/svn)uvx --with tox-uv tox -e lint— cleanread()+ hook over a local-cchain