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

migrate to packaging requirements parsing from deprecated pkg_resources #22033

Merged
merged 12 commits into from
Mar 6, 2025

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Mar 2, 2025

Migrate to use Requirement from packaging instead of the deprecated pkg_resources.

The project_name attribute is called name by packaging.requirements.Requirement so migrate Pants naming to use that, except in lock files where we keep the project_name naming to avoid breaking existing lockfiles.

Note in the release notes that the .* pattern is only permitted with == and != operators. pkg_resources accepted .* patterns with other operators which is not permitted by the current versioning specification.

@tdyas tdyas added category:internal CI, fixes for not-yet-released features, etc. release-notes:not-required PR doesn't require mention in release notes labels Mar 2, 2025
@tdyas tdyas removed the release-notes:not-required PR doesn't require mention in release notes label Mar 5, 2025
@tdyas tdyas requested review from huonw and sureshjoshi March 5, 2025 07:32
@tdyas tdyas marked this pull request as ready for review March 5, 2025 07:32
@tdyas tdyas changed the title [WIP] use packaging requirements instead of pkg_resources migrate to packaging requirements library from deprecated pkg_resources Mar 5, 2025
@tdyas tdyas changed the title migrate to packaging requirements library from deprecated pkg_resources migrate to packaging requirements parsing from deprecated pkg_resources Mar 5, 2025
@tdyas tdyas requested a review from benjyw March 5, 2025 07:34
@@ -490,7 +489,6 @@ def test_partition_into_major_minor_versions(constraints: list[str], expected: l
(["==3.0.*"], (3, 0)),
(["==3.45.*"], (3, 45)),
([">=3.45,<3.46"], (3, 45)),
([">=3.45.*,<3.46.*"], (3, 45)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed since .* syntax with operators other than == and != is not accepted.

@@ -514,7 +512,6 @@ def test_partition_into_major_minor_versions(constraints: list[str], expected: l
([">3.45,<=3.46"], None),
([">3.45,<3.47"], None),
(["===3.45"], None),
([">=3.45,<=3.45.*"], None),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed since .* syntax with operators other than == and != is not accepted.

Copy link
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

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

Thanks for doing the heavy lifting on this!

@tdyas tdyas merged commit 3cb3b8b into pantsbuild:main Mar 6, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants