Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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)

@@ -228,7 +223,7 @@ def reinitialize_command(
) -> _Command:
cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
vars(cmd).update(kw)
return cmd
return cmd # pyright: ignore[reportReturnType] # pypa/distutils#307
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch 2 times, most recently from 9faad5f to 508b17e Compare October 25, 2024 18:13
@Avasam Avasam force-pushed the statically-alias-distutils-stubs-to-setuptools._distutils branch 2 times, most recently from 89f1bf5 to 1733d12 Compare October 25, 2024 18:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Vendor distutils stubs
1 participant