Skip to content

Conversation

@Liam-DeVoe
Copy link
Contributor

Closes #767.

@notatallshaw
Copy link
Member

notatallshaw commented Sep 13, 2025

I'm supportive of this PR, I believe it makes packaging closer to PEP 440 compliant, as invalid versions are expressible via arbitrary equality.

You've added tests for Specifier.contains, SpecifierSet.contains, and SpecifierSet.filter, but you are missing tests for Specifier.filter which should be the same ones you added to TestSpecifierSet.test_specifier_filter but for TestSpecifier.test_specifier_filter.

@Liam-DeVoe
Copy link
Contributor Author

Liam-DeVoe commented Oct 4, 2025

Any movement on this and/or #931? I think these are relatively straightforward changes; and if you'd like to see a different approach instead then I'm happy to do so. I'd love to contribute more to packaging and so I've tried to ease myself in with these contributions, but it's hard to motivate myself to contribute more if PRs sit for this long!

@notatallshaw
Copy link
Member

It occurs to me that his will likely need a follow up PR where these method handle arbitrary equality, I've wrote up an issue #943

@notatallshaw notatallshaw self-requested a review October 23, 2025 23:16
@notatallshaw
Copy link
Member

Hi @Liam-DeVoe I just recently became a packaging maintainer and I am willing to review and accept this. Unfortunately though I just merged another PR that has caused this PR to have conflicts, if you are okay fixing those conflicts I will review afterward.

@Liam-DeVoe
Copy link
Contributor Author

Congrats! Yes of course, happy to!

@Liam-DeVoe
Copy link
Contributor Author

(that CI error is a real mypy warning that should have been an error if I had written better tests - I'll investigate and add a covering test)

@Liam-DeVoe
Copy link
Contributor Author

I'm actually confused as to why #767 says that ===foobar should return False for foobar. On my reading of PEP 440, it should match:

An example would be ===foobar which would match a version of foobar.

I think this is what you were pointing out as well in #943 (comment). I can make this PR return False, so that at least it's not erroring, and then I'm guessing you're already planning a followup to properly handle arbitrary equality and return True instead.

@notatallshaw
Copy link
Member

@Liam-DeVoe I agree, it's up to you, you can either fix it or I will make a follow up PR, once I am done with the pip 25.3 release, that fixes it.

@Liam-DeVoe
Copy link
Contributor Author

I don't think I'll have immediate time to dig into this in the next few days, so I would say you should go for it.

@notatallshaw notatallshaw merged commit 9983e4b into pypa:main Oct 25, 2025
39 checks passed
@notatallshaw
Copy link
Member

Thanks @Liam-DeVoe for your contribution to packaging.

@Liam-DeVoe
Copy link
Contributor Author

Thank you Damian! I'm hopeful I can continue to contribute where it makes sense.

@Liam-DeVoe Liam-DeVoe deleted the contains-invalid-version branch October 26, 2025 02:19
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.

Permit contains calls to Specifier[Set] to use arbitrary strings

2 participants