fix(pyproject): use uv lock instead of uv add to preserve pyproject.toml#8340
Merged
olblak merged 2 commits intoupdatecli:mainfrom Apr 10, 2026
Merged
Conversation
The pyproject autodiscovery generated shell targets using `uv add --frozen` which modifies both pyproject.toml and uv.lock. This replaces it with `uv lock --upgrade-package PACKAGE==VERSION` which only updates uv.lock, preserving the version constraints in pyproject.toml. Also removes the UvAddGroupFlag (--optional) since uv lock --upgrade-package doesn't need it, and simplifies changedif to only watch uv.lock. Fixes updatecli#8339 Signed-off-by: Loïs Postula <lois@postu.la>
The PEP 440 version filter with wildcard pattern (*) returned pre-release versions (dev, alpha, beta, rc) as the latest match. Per PEP 440 spec, pre-releases should be excluded by default. Now prefers stable versions, falling back to pre-release only when no stable version exists. Signed-off-by: Loïs Postula <lois@postu.la>
3e808a6 to
136b511
Compare
olblak
approved these changes
Apr 10, 2026
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.
Fix #8339
The
pyprojectautodiscovery generated shell targets usinguv add --frozen "PACKAGE>=VERSION"which modifies bothpyproject.tomlanduv.lock. This replaces it withuv lock --upgrade-package PACKAGE==VERSIONwhich only updatesuv.lock, preserving the version constraints inpyproject.toml.Changes:
uv add --frozen→uv lock --upgrade-package PACKAGE==VERSIONchangedifnow only watchesuv.lock(no longer trackspyproject.toml)UvAddGroupFlag(--optional) sinceuv lock --upgrade-packagedoesn't need itPyprojectFilefrom template paramsNote: This PR also fixes PEP 440 wildcard version filtering to exclude pre-release versions (dev, alpha, beta, rc) by default, per PEP 440 spec. Previously,
*would return e.g.1.0.dev3over0.28.1or3.0.0a7over2.57.0. Now prefers stable versions, falling back to pre-release only when no stable version exists.Test
Tested manually against a real project with
uv.lock— onlyuv.lockis modified,pyproject.tomlstays untouched, and pre-release versions are no longer selected.Additional Information
Checklist
Tradeoff
None.
Potential improvement