From 83bf6771b7cd7efa73d525348d7f3cb9f925505e Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 14 May 2025 23:09:37 -0400 Subject: [PATCH 1/2] Bump setuptools to 80.7.* --- stubs/setuptools/METADATA.toml | 3 +-- stubs/setuptools/setuptools/__init__.pyi | 1 - stubs/setuptools/setuptools/command/bdist_egg.pyi | 2 +- stubs/setuptools/setuptools/command/build_ext.pyi | 1 - stubs/setuptools/setuptools/dist.pyi | 3 ++- stubs/setuptools/setuptools/installer.pyi | 15 ++++++++++++++- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index 3000300b6f35..cda6196e2c96 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,10 +1,9 @@ -version = "80.4.*" +version = "80.7.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ Given that `pkg_resources` is typed since `setuptools >= 71.1`, \ it is no longer included with `types-setuptools`. """ -requires = ["setuptools"] # For pkg_resources [tool.stubtest] # darwin is equivalent to linux for OS-specific methods diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index 815e1336ce50..d8d0b22c3048 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -109,7 +109,6 @@ class Command(_Command): distribution: Distribution # Any: Dynamic command subclass attributes def __init__(self, dist: Distribution, **kw: Any) -> None: ... - def ensure_string_list(self, option: str) -> None: ... # Note: Commands that setuptools doesn't re-expose are considered deprecated (they must be imported from distutils directly) # So we're not listing them here. This list comes directly from the setuptools/command folder. Minus the test command. @overload # type: ignore[override] diff --git a/stubs/setuptools/setuptools/command/bdist_egg.pyi b/stubs/setuptools/setuptools/command/bdist_egg.pyi index 762976ad5949..264052cda2af 100644 --- a/stubs/setuptools/setuptools/command/bdist_egg.pyi +++ b/stubs/setuptools/setuptools/command/bdist_egg.pyi @@ -17,7 +17,7 @@ class bdist_egg(Command): user_options: ClassVar[list[tuple[str, str | None, str]]] boolean_options: ClassVar[list[str]] bdist_dir: Incomplete - plat_name: Incomplete + plat_name: str keep_temp: bool dist_dir: Incomplete skip_build: bool diff --git a/stubs/setuptools/setuptools/command/build_ext.pyi b/stubs/setuptools/setuptools/command/build_ext.pyi index 6f4e74424a27..85c477b0366e 100644 --- a/stubs/setuptools/setuptools/command/build_ext.pyi +++ b/stubs/setuptools/setuptools/command/build_ext.pyi @@ -9,7 +9,6 @@ have_rtld: bool use_stubs: bool libtype: str -def if_dl(s): ... def get_abi3_suffix(): ... class build_ext(_build_ext): diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index 4cdbdec2a494..fb04a7b41ce9 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator, MutableMapping +from importlib import metadata from typing import Literal, TypeVar, overload from . import Command, SetuptoolsDeprecationWarning @@ -39,7 +40,7 @@ class Distribution(_Distribution): setup_requires: list[str] def __init__(self, attrs: MutableMapping[str, Incomplete] | None = None) -> None: ... def parse_config_files(self, filenames: Iterable[StrPath] | None = None, ignore_option_errors: bool = False) -> None: ... - def fetch_build_eggs(self, requires: str | Iterable[str]): ... + def fetch_build_eggs(self, requires: str | Iterable[str]) -> list[metadata.Distribution]: ... def get_egg_cache_dir(self) -> str: ... def fetch_build_egg(self, req): ... # NOTE: Commands that setuptools doesn't re-expose are considered deprecated (they must be imported from distutils directly) diff --git a/stubs/setuptools/setuptools/installer.pyi b/stubs/setuptools/setuptools/installer.pyi index 0d3eaf68c0c4..b57af3e669e8 100644 --- a/stubs/setuptools/setuptools/installer.pyi +++ b/stubs/setuptools/setuptools/installer.pyi @@ -1,2 +1,15 @@ -def fetch_build_egg(dist, req): ... +from importlib import metadata +from typing_extensions import deprecated + +@deprecated( + """ + `setuptools.installer` and `fetch_build_eggs` are deprecated. + Requirements should be satisfied by a PEP 517 installer. + If you are using pip, you can try `pip install --use-pep517`. + """ +) +def fetch_build_egg(dist, req) -> metadata.Distribution | metadata.PathDistribution: ... + +# Returns packaging.requirements.Requirement +# But since this module is deprecated, we avoid declaring a dependency on packaging def strip_marker(req): ... From 4a62555344cd6798b809c44af2bef033abaf54d4 Mon Sep 17 00:00:00 2001 From: Avasam Date: Thu, 15 May 2025 10:02:36 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Sebastian Rittau --- stubs/setuptools/setuptools/installer.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stubs/setuptools/setuptools/installer.pyi b/stubs/setuptools/setuptools/installer.pyi index b57af3e669e8..b53a7f6fcc2e 100644 --- a/stubs/setuptools/setuptools/installer.pyi +++ b/stubs/setuptools/setuptools/installer.pyi @@ -1,4 +1,5 @@ from importlib import metadata +from typing import Any from typing_extensions import deprecated @deprecated( @@ -12,4 +13,4 @@ def fetch_build_egg(dist, req) -> metadata.Distribution | metadata.PathDistribut # Returns packaging.requirements.Requirement # But since this module is deprecated, we avoid declaring a dependency on packaging -def strip_marker(req): ... +def strip_marker(req) -> Any: ...