diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index 8c0909b170c3..a1b63cca526f 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -111,8 +111,6 @@ setuptools._distutils.dir_util setuptools._distutils.fancy_getopt setuptools._distutils.file_util setuptools._distutils.log -setuptools._distutils.msvc9compiler -setuptools._distutils.msvccompiler setuptools._distutils.spawn setuptools._distutils.text_file setuptools._distutils.unixccompiler diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index 3f9c8d1afe9d..00c640ecdbd0 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "73.0.*" +version = "74.0.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ If using `setuptools >= 71.1` *only* for `pkg_resources`, diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index a683594ab01d..a4cd7df6396c 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -115,6 +115,10 @@ def fixup_namespace_packages(path_item: str, parent: str | None = None) -> None: class WorkingSet: entries: list[str] + entry_keys: dict[str | None, list[str]] + by_key: dict[str, Distribution] + normalized_to_canonical_keys: dict[str, str] + callbacks: list[Callable[[Distribution], object]] def __init__(self, entries: Iterable[str] | None = None) -> None: ... def add_entry(self, entry: str) -> None: ... def __contains__(self, dist: Distribution) -> bool: ... @@ -428,6 +432,7 @@ class Distribution(NullProvider): def requires(self, extras: Iterable[str] = ()) -> list[Requirement]: ... def activate(self, path: list[str] | None = None, replace: bool = False) -> None: ... def egg_name(self) -> str: ... # type: ignore[override] # supertype's egg_name is a variable, not a method + def __getattr__(self, attr: str) -> Any: ... # Delegate all unrecognized public attributes to .metadata provider @classmethod def from_filename(cls, filename: StrPath, metadata: _MetadataType = None, *, precedence: int = 3) -> Distribution: ... def as_requirement(self) -> Requirement: ... diff --git a/stubs/setuptools/setuptools/command/easy_install.pyi b/stubs/setuptools/setuptools/command/easy_install.pyi index 2195dca91452..08129d8a55de 100644 --- a/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/stubs/setuptools/setuptools/command/easy_install.pyi @@ -1,6 +1,6 @@ from _typeshed import Incomplete -from collections.abc import Iterable, Iterator -from typing import Any, ClassVar, Literal, TypedDict, type_check_only +from collections.abc import Callable, Iterable, Iterator +from typing import Any, ClassVar, Literal, TypedDict, TypeVar, type_check_only from typing_extensions import Self from pkg_resources import Environment @@ -8,6 +8,8 @@ from setuptools.package_index import PackageIndex from .. import Command, SetuptoolsDeprecationWarning +_T = TypeVar("_T") + __all__ = ["easy_install", "PthDistributions", "extract_wininst_cfg", "get_exe_prefixes"] class easy_install(Command): @@ -112,6 +114,8 @@ class RewritePthDistributions(PthDistributions): prelude: str postlude: str +# Must match shutil._OnExcCallback +def auto_chmod(func: Callable[..., _T], arg: str, exc: BaseException) -> _T: ... @type_check_only class _SplitArgs(TypedDict, total=False): comments: bool diff --git a/stubs/setuptools/setuptools/command/editable_wheel.pyi b/stubs/setuptools/setuptools/command/editable_wheel.pyi index 3d8f73bcc0b6..482e679d30c3 100644 --- a/stubs/setuptools/setuptools/command/editable_wheel.pyi +++ b/stubs/setuptools/setuptools/command/editable_wheel.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, StrPath +from _typeshed import Incomplete, StrPath, Unused from collections.abc import Iterator, Mapping from enum import Enum from pathlib import Path @@ -34,7 +34,7 @@ class editable_wheel(Command): class EditableStrategy(Protocol): def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]) -> None: ... - def __enter__(self): ... + def __enter__(self) -> Self: ... def __exit__( self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None ) -> None: ... @@ -46,9 +46,7 @@ class _StaticPth: def __init__(self, dist: Distribution, name: str, path_entries: list[Path]) -> None: ... def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]): ... def __enter__(self) -> Self: ... - def __exit__( - self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None - ) -> None: ... + def __exit__(self, _exc_type: Unused, _exc_value: Unused, _traceback: Unused) -> None: ... class _LinkTree(_StaticPth): auxiliary_dir: Path @@ -56,9 +54,7 @@ class _LinkTree(_StaticPth): def __init__(self, dist: Distribution, name: str, auxiliary_dir: StrPath, build_lib: StrPath) -> None: ... def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]): ... def __enter__(self) -> Self: ... - def __exit__( - self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None - ) -> None: ... + def __exit__(self, _exc_type: Unused, _exc_value: Unused, _traceback: Unused) -> None: ... class _TopLevelFinder: dist: Distribution @@ -68,9 +64,7 @@ class _TopLevelFinder: def get_implementation(self) -> Iterator[tuple[str, bytes]]: ... def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]): ... def __enter__(self) -> Self: ... - def __exit__( - self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None - ) -> None: ... + def __exit__(self, _exc_type: Unused, _exc_value: Unused, _traceback: Unused) -> None: ... class _NamespaceInstaller(namespaces.Installer): distribution: Incomplete diff --git a/stubs/setuptools/setuptools/command/egg_info.pyi b/stubs/setuptools/setuptools/command/egg_info.pyi index c318c8134638..1e17156f5f85 100644 --- a/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/stubs/setuptools/setuptools/command/egg_info.pyi @@ -70,7 +70,6 @@ class manifest_maker(sdist): def warn(self, msg) -> None: ... def add_defaults(self) -> None: ... def add_license_files(self) -> None: ... - def prune_file_list(self) -> None: ... def write_file(filename, contents) -> None: ... def write_pkg_info(cmd, basename, filename) -> None: ... diff --git a/stubs/setuptools/setuptools/command/sdist.pyi b/stubs/setuptools/setuptools/command/sdist.pyi index 46aa3f8de6d6..84589f740711 100644 --- a/stubs/setuptools/setuptools/command/sdist.pyi +++ b/stubs/setuptools/setuptools/command/sdist.pyi @@ -17,6 +17,7 @@ class sdist(orig.sdist): def run(self) -> None: ... def initialize_options(self) -> None: ... def make_distribution(self) -> None: ... + def prune_file_list(self) -> None: ... def check_readme(self) -> None: ... def make_release_tree(self, base_dir, files) -> None: ... def read_manifest(self) -> None: ... diff --git a/stubs/setuptools/setuptools/config/expand.pyi b/stubs/setuptools/setuptools/config/expand.pyi index cdd99861e836..78c53c5e641f 100644 --- a/stubs/setuptools/setuptools/config/expand.pyi +++ b/stubs/setuptools/setuptools/config/expand.pyi @@ -38,7 +38,7 @@ class EnsurePackagesDiscovered: def __call__(self) -> None: ... def __enter__(self) -> Self: ... def __exit__( - self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... @property def package_dir(self) -> Mapping[str, str]: ... diff --git a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi index e61686654dfe..f44ffcdb95d4 100644 --- a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi +++ b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi @@ -44,7 +44,7 @@ class _EnsurePackagesDiscovered(expand.EnsurePackagesDiscovered): def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ): ... + ) -> None: ... class _BetaConfiguration(SetuptoolsWarning): ... class _InvalidFile(SetuptoolsWarning): ... diff --git a/stubs/setuptools/setuptools/monkey.pyi b/stubs/setuptools/setuptools/monkey.pyi index f31d2563ba50..ba3f50fe98da 100644 --- a/stubs/setuptools/setuptools/monkey.pyi +++ b/stubs/setuptools/setuptools/monkey.pyi @@ -1,12 +1,15 @@ -from typing import TypeVar +from types import FunctionType +from typing import TypeVar, overload _T = TypeVar("_T") - +_UnpatchT = TypeVar("_UnpatchT", type, FunctionType) __all__: list[str] = [] -def get_unpatched(item: _T) -> _T: ... -def get_unpatched_class(cls): ... +@overload +def get_unpatched(item: _UnpatchT) -> _UnpatchT: ... # type: ignore[overload-overlap] +@overload +def get_unpatched(item: object) -> None: ... +def get_unpatched_class(cls: type[_T]) -> type[_T]: ... def patch_all() -> None: ... def patch_func(replacement, target_mod, func_name) -> None: ... def get_unpatched_function(candidate): ... -def patch_for_msvc_specialized_compiler(): ... diff --git a/stubs/setuptools/setuptools/msvc.pyi b/stubs/setuptools/setuptools/msvc.pyi deleted file mode 100644 index 6376fa5d36f0..000000000000 --- a/stubs/setuptools/setuptools/msvc.pyi +++ /dev/null @@ -1,141 +0,0 @@ -import sys -from _typeshed import Incomplete -from typing import Final - -PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]] - -def msvc14_get_vc_env(plat_spec: str) -> dict[str, Incomplete]: ... - -class PlatformInfo: - current_cpu: Incomplete - arch: Incomplete - def __init__(self, arch) -> None: ... - @property - def target_cpu(self): ... - def target_is_x86(self): ... - def current_is_x86(self): ... - def current_dir(self, hidex86: bool = False, x64: bool = False): ... - def target_dir(self, hidex86: bool = False, x64: bool = False): ... - def cross_dir(self, forcex86: bool = False): ... - -class RegistryInfo: - if sys.platform == "win32": - HKEYS: Final[tuple[int, int, int, int]] - else: - HKEYS: Final[tuple[None, None, None, None]] - - pi: Incomplete - def __init__(self, platform_info) -> None: ... - @property - def visualstudio(self): ... - @property - def sxs(self): ... - @property - def vc(self): ... - @property - def vs(self): ... - @property - def vc_for_python(self): ... - @property - def microsoft_sdk(self): ... - @property - def windows_sdk(self): ... - @property - def netfx_sdk(self): ... - @property - def windows_kits_roots(self): ... - def microsoft(self, key, x86: bool = False): ... - def lookup(self, key, name): ... - -class SystemInfo: - WinDir: Incomplete - ProgramFiles: Incomplete - ProgramFilesx86: Incomplete - ri: Incomplete - pi: Incomplete - known_vs_paths: Incomplete - vs_ver: Incomplete - def __init__(self, registry_info, vc_ver: Incomplete | None = None) -> None: ... - def find_reg_vs_vers(self): ... - def find_programdata_vs_vers(self): ... - @property - def VSInstallDir(self): ... - @property - def VCInstallDir(self): ... - @property - def WindowsSdkVersion(self): ... - @property - def WindowsSdkLastVersion(self): ... - @property - def WindowsSdkDir(self): ... - @property - def WindowsSDKExecutablePath(self): ... - @property - def FSharpInstallDir(self): ... - @property - def UniversalCRTSdkDir(self): ... - @property - def UniversalCRTSdkLastVersion(self): ... - @property - def NetFxSdkVersion(self): ... - @property - def NetFxSdkDir(self): ... - @property - def FrameworkDir32(self): ... - @property - def FrameworkDir64(self): ... - @property - def FrameworkVersion32(self): ... - @property - def FrameworkVersion64(self): ... - -class EnvironmentInfo: - pi: Incomplete - ri: Incomplete - si: Incomplete - def __init__(self, arch, vc_ver: Incomplete | None = None, vc_min_ver: float = 0) -> None: ... - @property - def vs_ver(self): ... - @property - def vc_ver(self): ... - @property - def VSTools(self): ... - @property - def VCIncludes(self): ... - @property - def VCLibraries(self): ... - @property - def VCStoreRefs(self): ... - @property - def VCTools(self): ... - @property - def OSLibraries(self): ... - @property - def OSIncludes(self): ... - @property - def OSLibpath(self): ... - @property - def SdkTools(self): ... - @property - def SdkSetup(self): ... - @property - def FxTools(self): ... - @property - def NetFxSDKLibraries(self): ... - @property - def NetFxSDKIncludes(self): ... - @property - def VsTDb(self): ... - @property - def MSBuild(self): ... - @property - def HTMLHelpWorkshop(self): ... - @property - def UCRTLibraries(self): ... - @property - def UCRTIncludes(self): ... - @property - def FSharp(self): ... - @property - def VCRuntimeRedist(self): ... - def return_env(self, exists: bool = True): ... diff --git a/stubs/setuptools/setuptools/package_index.pyi b/stubs/setuptools/setuptools/package_index.pyi index 833741ac7602..802486e2ae20 100644 --- a/stubs/setuptools/setuptools/package_index.pyi +++ b/stubs/setuptools/setuptools/package_index.pyi @@ -4,6 +4,7 @@ from _typeshed import Incomplete from hashlib import _Hash from re import Pattern from typing import ClassVar +from typing_extensions import NamedTuple from pkg_resources import Environment @@ -83,11 +84,9 @@ class PackageIndex(Environment): def info(self, msg, *args) -> None: ... def warn(self, msg, *args) -> None: ... -class Credential: - username: Incomplete - password: Incomplete - def __init__(self, username, password) -> None: ... - def __iter__(self): ... +class Credential(NamedTuple): + username: str + password: str class PyPIConfig(configparser.RawConfigParser): def __init__(self) -> None: ... diff --git a/stubs/setuptools/setuptools/sandbox.pyi b/stubs/setuptools/setuptools/sandbox.pyi index a1c47b0eb7c0..54b155308fbc 100644 --- a/stubs/setuptools/setuptools/sandbox.pyi +++ b/stubs/setuptools/setuptools/sandbox.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import Unused from types import TracebackType from typing import ClassVar, Literal from typing_extensions import Self @@ -22,9 +23,7 @@ def run_setup(setup_script, args): ... class AbstractSandbox: def __enter__(self) -> None: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... + def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused) -> None: ... def run(self, func): ... # Dynamically created if sys.platform == "win32":