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

Statically alias distutils-stubs to setuptools._distutils #4704

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

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Oct 25, 2024

Summary of changes

Closes #4689
This is an alternative to #4691. This makes type-checkers and editors see distutils as basically an alias to setuptools.

Advantage:

  • Less maintenance work, these stubs can be autogenerated when updating the vendored stubs (if a file is removed or added)
  • No need to keep in sync with typeshed
  • Static typing follows directly pypa/distutils without concerns with stdlib/distutils compatibility

Disadvantage:

  • Typing isn't as good or as complete as typeshed's
  • Typing improvements and fixes need to be done "in source" in pypa/distutils. But this is somewhat already the long-term plan (Add type hints to setuptools #2345 (comment) but directly in pypa/distutils)
  • pypa/distutils could accidentally introduce a typing breaking change for setuptools, which probably needs to be ignored with a TODO when updating the vendor.

Pull Request Checklist

  • Changes have tests (existing type-checking tests)
  • News fragment added in newsfragments/. (no need until this is shipped with setuptools)
    (See documentation for details)

setuptools/__init__.py Outdated Show resolved Hide resolved
@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch 5 times, most recently from 1733d12 to f950ecc Compare October 25, 2024 20:33
@abravalheri abravalheri mentioned this pull request Oct 25, 2024
1 task
@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch 4 times, most recently from 7085815 to e66c7ae Compare November 24, 2024 22:53
@Avasam
Copy link
Contributor Author

Avasam commented Nov 25, 2024

I've added a comment at the top of geenrated files to make it clear that they are generated and how to regenerate them.

setuptools/command/install.py Outdated Show resolved Hide resolved
setuptools/command/sdist.py Outdated Show resolved Hide resolved
@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch from 4ed7925 to 5b9d787 Compare December 30, 2024 23:46
@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch from 5b9d787 to 0f98b7e Compare December 30, 2024 23:51
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.

[FR] Vendor distutils stubs
1 participant