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

Update setuptools to v69 #11066

Closed
wants to merge 5 commits into from
Closed

Update setuptools to v69 #11066

wants to merge 5 commits into from

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Nov 23, 2023

This is an attempt at closing #11049 without needing any stubtest update.

The main point is about removing pkg_resources._vendor and adding packaging to the requirements

Edit: Looks like either stubtest or stub_uploader is gonna need an update to keep the packaging subclassing.


Separatly, I'm not sure how to best handle newer_pairwise_group. typing it as a def stubtest says error: setuptools.modified.newer_pairwise_group is not a function. typing is as partial[Incomplete] looses parameters signature (ref #8703). And pyright seems to have some special handling of functools.partial seeing the following (which also validate correct parameter names and types in the cli):
image
I feel like I should go with an allowlist entry for mypy users.

@@ -1 +1 @@
def newer_pairwise_group(sources_groups, targets): ...
from ._distutils._modified import newer_group as newer_group, newer_pairwise_group as newer_pairwise_group
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This entire module (stubs/setuptools/setuptools/dep_util.pyi) is deprecated in favor of setuptools.modified
I could keep the defs instead of importing from _distutils so I can mark with @deprecated

This comment has been minimized.

Comment on lines +1 to +6
from ._distutils._modified import (
newer as newer,
newer_group as newer_group,
newer_pairwise as newer_pairwise,
newer_pairwise_group as newer_pairwise_group,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could define the methods here instead of in setuptools/_distutils/_modified to avoid a adding a private module

Copy link
Member

Choose a reason for hiding this comment

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

Better to define them where they're defined at runtime imo, as you currently have it

@JelleZijlstra
Copy link
Member

I gather newer_pairwise_group is a functools.partial at runtime? I would agree with stubbing it as an equivalent def function, and allowlisting stubtest if it complains.

This comment has been minimized.

@Avasam
Copy link
Collaborator Author

Avasam commented Nov 24, 2023

I gather newer_pairwise_group is a functools.partial at runtime? I would agree with stubbing it as an equivalent def function, and allowlisting stubtest if it complains.

Yep, if it makes it clearer, this is what it'd look like using functool.partial assignement in stub for pyright (not mypy) to understand: 5946e13#diff-c7f29e111ff63f317e294acc4ea34b5ee0181dfe30dfcbb54cb3fe0c7df53803R9

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/exception.py:8: note: In module imported here:

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/filter.py:8: note: In module imported here:

@Avasam
Copy link
Collaborator Author

Avasam commented Nov 28, 2023

Superseeded by #11069

@Avasam Avasam closed this Nov 28, 2023
@Avasam Avasam deleted the setuptools-69 branch November 28, 2023 00:45
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