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 Any subclassing in setuptools #9460

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 5, 2023

Reference the docutils stub.

As far as I understand, there's no issue with this if docutils isn't installed. And gives proper type when it is.

Fixes 3 subclassing errors (the same error in setuptools, pyinstaller and Pygments stubs)

Ref: #9491

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2023

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉


_Reporter: TypeAlias = Any # really docutils.utils.Reporter
from ..cmd import Command

# Only defined if docutils is installed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove this comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The comment is still true. I think it has value if someone wonders why its in the stub but not in their runtime.

@AlexWaygood
Copy link
Member

I sort of wonder if we shouldn't just delete the _distutils directory from our setuptools stubs. The frequency of the changes to that directory (and the leading underscore in the name) indicates to me that the maintainers see the whole directory as an implementation detail, and it just causes work for us to keep the directory up to date. I'm also not sure it's very useful keeping the directory around for type-checking purposes, since setuptools does some terrible importlib hack so that you can import the directory just by doing import distutils at runtime -- so there's little reason to ever import anything from setuptools._distutils directly.

But all that's for another issue/PR discussion.

@AlexWaygood AlexWaygood merged commit 9041a92 into python:main Jan 5, 2023
@Avasam Avasam deleted the Fix-Any-subclassing-in-setuptools branch January 5, 2023 10:43
juanamari94 pushed a commit to juanamari94/typeshed that referenced this pull request Jan 6, 2023
juanamari94 pushed a commit to juanamari94/typeshed that referenced this pull request Jan 6, 2023
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