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

Improve compatibility with future versions of setuptools #638

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

abravalheri
Copy link
Contributor

While working on the implementation of PEP 643, I realised that if we implement a new version of metadata in setuptools, once the current version of wheel.bdist_wheel runs in deprecated scenarios, it will produce invalid metadata.

We can also expand this reasoning to other fixes and/or PEP implementations. A recent example was the fix for pypa/setuptools#1825, proposed in pypa/setuptools#4647, which caused some trouble and required the implementation of a very intrusive workaround: pypa/setuptools#4684 (comment).

I was thinking if there was any way we could address that while maintaining as much as possible a backwards compatible API (in both setuptools and wheel) so that we minimise the amount of disruption in the community while going forward1. So I came up with the idea for this PR.

Please let me know your thoughts on the subject.

Footnotes

  1. Unfortunately there are many packages in the ecosystem that are widespread but have low maintenance. It is possible that a small amount of those will never address the deprecation warning...

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.18%. Comparing base (9254a4f) to head (e2ca58b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/wheel/bdist_wheel.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #638      +/-   ##
==========================================
+ Coverage   71.11%   71.18%   +0.06%     
==========================================
  Files          14       14              
  Lines        1087     1093       +6     
==========================================
+ Hits          773      778       +5     
- Misses        314      315       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@henryiii
Copy link
Contributor

henryiii commented Oct 24, 2024

Would it make sense to still produce the warning though, to hopefully encourage packages to update to using setuptools directly?

@abravalheri
Copy link
Contributor Author

abravalheri commented Oct 24, 2024

Would it make sense to still produce the warning though, to hopefully encourage packages to update to using setuptools directly?

Yeah, 100%. It is better if packages are compelled to handle the deprecation explicitly.

@agronholm
Copy link
Contributor

Would you mind adding a changelog note?

@henryiii
Copy link
Contributor

Ahh, I thought this was only warning if it was using the internal version. I now see the warning is in the correct spot. 👍

@abravalheri
Copy link
Contributor Author

abravalheri commented Oct 25, 2024

Thank you @agronholm. I added some release notes, please feel free to modify the text to your liking.


A related comment:

After this change, we may be templated to just import the setuptools version elsewhere in wheel (like here) and simply delete the wheel._bdist_wheel module.

While that is a valid possibility to consider, it may involve coordinating integration tests with setuptools so that we don't introduce error in the way wheel works.

Just as an example: in pypa/setuptools#4701, as a preparation for implementing PEP 685, we are proposing to simply preserve the contents of PKG-INFO into METADATA instead of post-processing it (like wheel does).

This makes sense in the setuptools code-base because we know that the installed version of setuptools will always produce the acceptable metadata. However, the wheel CLI may be used to convert old .egg files that have old and incompatible PKG-INFO.

So there are 2 options, preserve the implementation of wheel._bdist_wheel, or coordinate with setuptools adding some forms of integration tests to avoid changes in setuptools breaking the way wheel converts old .egg files.

@agronholm
Copy link
Contributor

I have a half-done local branch where I'm removing the setuptools dependency for egg conversion.

@agronholm agronholm merged commit 28c1ba1 into pypa:main Oct 25, 2024
17 of 18 checks passed
@abravalheri abravalheri deleted the setuptools-compat branch October 25, 2024 10:14
@abravalheri
Copy link
Contributor Author

Perfect, thank you very much.

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.

3 participants