Skip to content
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

Warn users on "~=" python-version #8284

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ianpaul10
Copy link
Contributor

Summary

Closes #7426

Second part of #7426, that checks if the python-version uses a tilde eq without a patch version (e.g. ~=3.11, which will be interpreted as >=3.10, ==3.*) and warns the user, asking them to specify a patch version.

Test Plan

Unit tests were added for is_tilde_exact_without_patch

("~=3.11", true),
("~=2.7", true),
("~=3.10, <3.11", false),
("~=3.10, <=3.11", false),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While unlikely, this sort of version should not throw a warning, correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think not)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave it without a warning. It's an odd version specifier to write and likely not what the user intended, but it's not one that specifically matches this case.

@ianpaul10 ianpaul10 force-pushed the feat/warn-on-tilde-eq branch from b49f5bd to 4106f9a Compare October 17, 2024 10:31
@ianpaul10 ianpaul10 force-pushed the feat/warn-on-tilde-eq branch from 4106f9a to 6930710 Compare October 17, 2024 10:57
@zanieb zanieb self-assigned this Oct 17, 2024
@ianpaul10 ianpaul10 changed the title Feat/warn on tilde eq Warn usre on "~=" python-version Oct 18, 2024
@ianpaul10 ianpaul10 changed the title Warn usre on "~=" python-version Warn users on "~=" python-version Oct 18, 2024
@zanieb
Copy link
Member

zanieb commented Nov 12, 2024

Hey @ianpaul10, I updated this with main and added some test cases and it looks like it's not working. It might be transformed before it gets to your logic? Like, when I use ~=3.12 the logs show

Using Python request >=3.12, <4 from requires-python metadata

cc @BurntSushi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn when project defines a requires-python that pins to a .0 patch version
3 participants