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

fix: Python publishing fails on some Python distributions #4776

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Feb 24, 2025

Our recent jsii-pacmak release contained an update to twine which exhibits a failure when combined with specific versions of packaging.

When reading the bug thread the root cause seems to be setuptools, but the workaround seems to depend on the installed version of packaging.

twine declares a dependency on packaging>=24.0.0 and the bug doesn't appear if 24.2 is installed. As a result, the problem shows on Python distributions that come with [email protected] or [email protected] preinstalled.

If an older version or no version of packaging is preinstalled then pip will install a fresh copy and it will pick 24.2, but older versions match the declared version range and the pre-existing version will be used, which leads to the problem.

To solve, add the required minimum version of packaging to our own dependency file.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Our recent `jsii-pacmak` release contained an update to `twine` which
exhibits a failure when combined with specific versions of `packaging`.

When reading the [bug thread](pypa/twine#1216)
the root cause seems to be `setuptools`, but the workaround seems to
depend on the installed version of `packaging`.

`twine` declares a dependency on `packaging>=24.0.0` and the bug doesn't
appear if `24.2` is installed. As a result, the problem shows on Python
distributions that come with `[email protected]` or `[email protected]`
preinstalled.

If an older version or no version of `packaging` is preinstalled then
`pip` will install a fresh copy and it will pick `24.2`, but older
versions match the declared version range and the pre-existing version
will be used, which leads to the problem.

To solve, add the required minimum version of `packaging` to our own
dependency file.
@rix0rrr rix0rrr requested a review from a team February 24, 2025 10:13
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 24, 2025

# The dependency on packaging is necessary to work around an incompatibility between
# what setuptools generates and what twine expects. <https://github.com/pypa/twine/issues/1216>
packaging >= 24.2
Copy link
Contributor

Choose a reason for hiding this comment

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

nit (maybe): pip is cool with spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is.

Copy link
Contributor

mergify bot commented Feb 24, 2025

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Feb 24, 2025
Copy link
Contributor

mergify bot commented Feb 24, 2025

Merging (with squash)...

@mergify mergify bot merged commit 65c7c10 into main Feb 24, 2025
33 checks passed
@mergify mergify bot deleted the huijbers/upgrade-packaging branch February 24, 2025 10:46
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants