-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(providers): add uv_provider #1351
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1351 +/- ##
==========================================
+ Coverage 97.33% 97.58% +0.24%
==========================================
Files 42 56 +14
Lines 2104 2645 +541
==========================================
+ Hits 2048 2581 +533
- Misses 56 64 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3109dda
to
0450542
Compare
@woile @noirbizarre just a gentle ping in case this is missed. thanks 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, the only issue is that it doesn't cover workspace.
[tool.uv.workspace]
members = ["packages/*"]
exclude = ["packages/seeds"]
I'm a bit confused why do we need to cover workspace (I've never used this feature so I might miss some context 🤦♂️) |
It allows to have multiple python projects, as a monorepo. Each package probably (as in, I think it works quite similar to cargo) will add an entry to the lock. I'm working on a fix for cargo. If it works well we can port it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me but I wonder why for uv
we handle the lock while we don't do it for poetry nor any other python provider.
I feel this is introducing a uv
special treatment that could already be handled by relying on the generic PEP621 support we already have and using post_bump_hooks
Note
Maybe the pyproject.toml
formatting should be splitted in a style
commit in another PR as unrelated
I investigated a bit, and neither Given I always use dynamic version with WDYT ? |
Also, as it has been a recurrent issue working with some lock files, I would add lock file version check (cf. https://docs.astral.sh/uv/concepts/resolution/#lockfile-versioning).
|
`uv` copies cargo. I think it's because you may have a repo with multiple
packages (in any of both).
We could just use pep621 and detect all the different lock files, or we
could be explicit, like in this PR, I like it like this
…On Fri, 21 Feb 2025, 18:55 Axel H., ***@***.***> wrote:
Also, as it has been a recurrent issue working with some lock files, I
would add lock file version check (cf.
https://docs.astral.sh/uv/concepts/resolution/#lockfile-versioning).
This would allow to:
- add support for future lockfile versioning while continuing to
support previous format and not having commitizen version tied to uv
version and its lock versioning
- warn when encountering an unsupported lock version, instead of
failing or corrupting it
—
Reply to this email directly, view it on GitHub
<#1351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATXJWCUD4G65NW3DEEZJKT2Q6OD5AVCNFSM6AAAAABWHXPPDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZVGYZDMMJVGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: noirbizarre]*noirbizarre* left a comment
(commitizen-tools/commitizen#1351)
<#1351 (comment)>
Also, as it has been a recurrent issue working with some lock files, I
would add lock file version check (cf.
https://docs.astral.sh/uv/concepts/resolution/#lockfile-versioning).
This would allow to:
- add support for future lockfile versioning while continuing to
support previous format and not having commitizen version tied to uv
version and its lock versioning
- warn when encountering an unsupported lock version, instead of
failing or corrupting it
—
Reply to this email directly, view it on GitHub
<#1351 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATXJWCUD4G65NW3DEEZJKT2Q6OD5AVCNFSM6AAAAABWHXPPDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZVGYZDMMJVGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
But then it means that to have My point does not imply that we shouldn't have explicit support for this (I am all for both explicitness and The way I see it, instead of having: version_provider = "uv" we should have something like: pre_bump_hook = [
"canonical.path.to.hook:uvlock",
] or pre_bump_hook = [
"canonical.path.to.hooks:lock('uv.lock')",
] or if we expose a new hook endpoint: pre_bump_hook = [
"uvlock:uv.lock",
# or
"hooks:uvlock",
] Note I don't know whether it should support parameters or not, that's why I imagine different syntaxes) I see plenty of possibilities with this approach because sometimes, the WDYT ? |
Got it. Yep, maybe we can do it in another PR, and I'll spend some time to look into how it works |
I only have time to browse through the comments. But @noirbizarre 's seems to be a good alternative 🤔 I might need some time to think through it again. But I'll be out for the next 2 weeks 🤦♂️ We can merge it if we want this in earlier. Otherwise, I'll continue to work on it after I'm back. Thanks! |
We might have to think this through a bit better. On one hand, I'd like things to just work. I don't want users to have to configure many different chunks when using something like On the other hand, we have Right now, our provider To me,
So I'd say it's a pretty standard feature. Could we, perhaps, have both, a working The discussion for PEP751 seems to lean towards not including the package version in the lockfile (can someone check that I understood properly?): https://discuss.python.org/t/pep-751-one-last-time/77293/68 |
I'll try to spend some time rereading the PEP and think it through. This is a great discussion 🙌 really like it. |
Agreed, I like this direction this is going. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM until we have file-specific hooks 🚀
Ok, then I'll probably merge this later today. Another thing I'm thinking of is multiple provider? not sure whether it makes sense 🤔 |
I think it is easier to stick with the 1 provider only for the version source but support for multiple hooks for specific files. |
closes: #1349
Description
as title
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
uv.lock should also updated when running
cz bump
Steps to Test This Pull Request
uv init uv add commitizen cz init git add . cz c cz bump
Additional context