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

Remove setuptools/pkg_resources #13369

Merged
merged 6 commits into from
Mar 4, 2025

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 6, 2025

Closes #12398

@Avasam Avasam added the stubs: removal Pending removal of third-party distributions label Jan 6, 2025

This comment has been minimized.

This comment has been minimized.

"""
requires = ["setuptools"] # For pkg_resources
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, a stub can't depend on the library it stubs >.<
Since this restriction is in place for security reasons, would it make sense to allow types-Foo to require Foo ?

stub_uploader.metadata.InvalidRequires: Expected dependency setuptools to be listed in setuptools's requires_dist or the sdist's *.egg-info/requires.txt

This comment has been minimized.

Copy link
Contributor

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

scipy (https://github.com/scipy/scipy)
- scipy/_build_utils/_generate_blas_wrapper.py:31: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ scipy/_build_utils/tempita/_tempita.py:1041: error: Library stubs not installed for "pkg_resources"  [import-untyped]
+ scipy/_build_utils/tempita/_tempita.py:1041: note: Hint: "python3 -m pip install types-setuptools"
+ scipy/_build_utils/tempita/_tempita.py:1041: note: (or run "mypy --install-types" to install all missing stub packages)
+ scipy/_build_utils/tempita/_tempita.py:1041: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
+ scipy/_lib/unuran/get_and_clean_unuran.py:8: error: Library stubs not installed for "pkg_resources"  [import-untyped]

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/exception.py:51: error: Library stubs not installed for "pkg_resources"  [import-untyped]
+ pwndbg/exception.py:51: note: Hint: "python3 -m pip install types-setuptools"
+ pwndbg/exception.py:51: note: (or run "mypy --install-types" to install all missing stub packages)

@Avasam
Copy link
Collaborator Author

Avasam commented Feb 14, 2025

The primer hits should be fixed by hauntsaninja/mypy_primer#131 (CC @hauntsaninja )

stub_uploader support is added in typeshed-internal/stub_uploader#159

If using `setuptools >= 71.1` *only* for `pkg_resources`,
you don't need `types-setuptools` since `pkg_resources` is now typed.\
Given that `pkg_resources` is typed since `setuptools >= 71.1`, \
it is no longer included with `types-setuptools`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternative:

Suggested change
it is no longer included with `types-setuptools`.
`pkg_resources-stubs` is no longer included with `types-setuptools`.

@srittau srittau merged commit 641ca18 into python:main Mar 4, 2025
43 checks passed
@Avasam Avasam deleted the remove-setuptools-pkg_resources branch March 4, 2025 11:57
wmfgerrit pushed a commit to wikimedia/operations-software-pywmflib that referenced this pull request Mar 11, 2025
Version 75.8.2.20250305 (2025-03-05) removed setuptools/pkg_resources:
python/typeshed#13369

Since we still require to support Python 3.7 from Debian Buster, we need
to keep using pkg_resources.

Cap types-setuptools version to the versions before pkg_resources types
got removed.

Change-Id: Ic9c26144337687bd5db2010eab32d4554afb9d02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: removal Pending removal of third-party distributions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove pkg_resources package from types-setuptools, not before January 2025
3 participants