-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make < exclusive for non-prerelease markers #1878
Conversation
134f875
to
70112df
Compare
I think (1) and (2) could be "solved" by only applying this logic when pre-releases are already enabled for a given package. |
What if there is a
|
2be8dfe
to
170a2a6
Compare
@mitsuhiko - That's also interesting, it could work, though I still wonder if including the pre-release info is useful in cases in which pre-releases are entirely omitted. |
\cc @Czaki who brought up the idea on GitHub. |
Hm. Why is pre-release even triggered by upper constraint? All time when I would like to test pre-release of some package or see such case, the lower bound is used. But my experience may be not so big. I wil ltry to check code later. |
|
And cannot by uploaded to pypi. |
alas the world is complicated: pypi is not the only source of distributions either way, if the intention is to make another way might be to represent this as something like |
This makes sense, I'll likely change to dev. |
I would just honestly really represent it as something that is not parsable. The |
Have you checked that this also applies to |
170a2a6
to
949de64
Compare
I honestly don't mind representing this (even to users) as |
949de64
to
e5c10a6
Compare
e5c10a6
to
d896315
Compare
d896315
to
dc2460d
Compare
dc2460d
to
4608cab
Compare
Okay, now using @mitsuhiko's suggested approach which I will begrudgingly admit is a better solution :) Now handles all cases correctly, even: apache-airflow[otel]
opentelemetry-exporter-prometheus<0.44 From the brilliant @notatallshaw (thank you for that). |
4608cab
to
d96fabc
Compare
d96fabc
to
b01ad71
Compare
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.
This LGTM, but you'll definitely need to bump the simple cache version in order to invalidate extant caches due to the change in representation of Version
. (Apologies if you did that and I missed it.)
6b2f664
to
3840f1e
Compare
3840f1e
to
9a8d637
Compare
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.
Sweet
## Summary Even when pre-releases are "allowed", per PEP 440, `pydantic<2.0.0` should _not_ include pre-releases. This PR modifies the specifier translation to treat `pydantic<2.0.0` as `pydantic<2.0.0.min0`, where `min` is an internal-only version segment that's invisible to users. Closes astral-sh#1641.
## Summary This PR attempts to use a similar trick to that we added in #1878, but for post-releases. In #1878, we added a fake "minimum" version to enable us to treat `< 1.0.0` as _excluding_ pre-releases of 1.0.0. Today, on `main`, we accept post-releases and local versions in `> 1.0.0`. But per PEP 440, that should _exclude_ post-releases and local versions, unless the specifier is itself a pre-release, in which case, pre-releases are allowed (e.g., `> 1.0.0.post0` should allow `> 1.0.0.post1`). To support this, we add a fake "maximum" version that's greater than all the post and local releases for a given version. This leverages our last remaining free bit in the compact representation.
Summary
Even when pre-releases are "allowed", per PEP 440,
pydantic<2.0.0
should not include pre-releases. This PR modifies the specifier translation to treatpydantic<2.0.0
aspydantic<2.0.0.min0
, wheremin
is an internal-only version segment that's invisible to users.Closes #1641.