From 8e2ce00623a027c66ce9b758e5c149d68d0e69b7 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 15 Mar 2024 01:04:34 -0400 Subject: [PATCH] Bump setuptools to 69.2.* (#11603) --- stubs/setuptools/METADATA.toml | 2 +- stubs/setuptools/setuptools/__init__.pyi | 7 ++++--- .../setuptools/command/easy_install.pyi | 2 +- .../setuptools/command/editable_wheel.pyi | 5 ++--- .../setuptools/setuptools/command/rotate.pyi | 2 +- stubs/setuptools/setuptools/compat/py39.pyi | 7 +++++++ stubs/setuptools/setuptools/config/expand.pyi | 20 +++++++++---------- .../setuptools/config/pyprojecttoml.pyi | 19 ++++++++---------- .../setuptools/setuptools/config/setupcfg.pyi | 11 ++++------ stubs/setuptools/setuptools/discovery.pyi | 12 +++++------ stubs/setuptools/setuptools/monkey.pyi | 8 +++++++- 11 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 stubs/setuptools/setuptools/compat/py39.pyi diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index a203eb119..af26853bd 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "69.1.*" +version = "69.2.*" upstream_repository = "https://github.com/pypa/setuptools" [tool.stubtest] diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index 99ad9222e..9b3ff05fd 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -1,10 +1,10 @@ +from _typeshed import StrPath from abc import abstractmethod from collections.abc import Iterable, Mapping, Sequence from typing import Any from ._distutils.cmd import Command as _Command from .depends import Require as Require -from .discovery import _Path from .dist import Distribution as Distribution from .extension import Extension as Extension from .warnings import SetuptoolsDeprecationWarning as SetuptoolsDeprecationWarning @@ -25,8 +25,8 @@ __version__: str # Pytype fails with the following: # find_packages = PackageFinder.find # find_namespace_packages = PEP420PackageFinder.find -def find_packages(where: _Path = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... -def find_namespace_packages(where: _Path = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... +def find_packages(where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... +def find_namespace_packages(where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... def setup( *, name: str = ..., @@ -73,6 +73,7 @@ def setup( class Command(_Command): command_consumes_arguments: bool + distribution: Distribution def __init__(self, dist: Distribution, **kw: Any) -> None: ... def ensure_string_list(self, option: str | list[str]) -> None: ... def reinitialize_command(self, command: _Command | str, reinit_subcommands: int = 0, **kw: Any) -> _Command: ... diff --git a/stubs/setuptools/setuptools/command/easy_install.pyi b/stubs/setuptools/setuptools/command/easy_install.pyi index 4960cd495..cc3b8121a 100644 --- a/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/stubs/setuptools/setuptools/command/easy_install.pyi @@ -116,7 +116,7 @@ class _SplitArgs(TypedDict, total=False): posix: bool class CommandSpec(list[str]): - options: list[Incomplete] + options: list[str] split_args: ClassVar[_SplitArgs] @classmethod def best(cls) -> type[CommandSpec]: ... diff --git a/stubs/setuptools/setuptools/command/editable_wheel.pyi b/stubs/setuptools/setuptools/command/editable_wheel.pyi index 4f527d24a..729739d82 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 +from _typeshed import Incomplete, StrPath from enum import Enum from pathlib import Path from types import TracebackType @@ -11,7 +11,6 @@ from ..warnings import SetuptoolsWarning # Actually from wheel.wheelfile import WheelFile _WheelFile: TypeAlias = Incomplete -_Path: TypeAlias = str | Path class _EditableMode(Enum): STRICT: str @@ -53,7 +52,7 @@ class _StaticPth: class _LinkTree(_StaticPth): auxiliary_dir: Incomplete build_lib: Incomplete - def __init__(self, dist: Distribution, name: str, auxiliary_dir: _Path, build_lib: _Path) -> None: ... + def __init__(self, dist: Distribution, name: str, auxiliary_dir: StrPath, build_lib: StrPath) -> None: ... def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]): ... def __enter__(self) -> Self: ... def __exit__( diff --git a/stubs/setuptools/setuptools/command/rotate.pyi b/stubs/setuptools/setuptools/command/rotate.pyi index 27c11582e..7deb47389 100644 --- a/stubs/setuptools/setuptools/command/rotate.pyi +++ b/stubs/setuptools/setuptools/command/rotate.pyi @@ -5,7 +5,7 @@ from .. import Command class rotate(Command): description: str user_options: Any - boolean_options: Any + boolean_options: list[str] match: Any dist_dir: Any keep: Any diff --git a/stubs/setuptools/setuptools/compat/py39.pyi b/stubs/setuptools/setuptools/compat/py39.pyi new file mode 100644 index 000000000..06fd40663 --- /dev/null +++ b/stubs/setuptools/setuptools/compat/py39.pyi @@ -0,0 +1,7 @@ +import sys +from typing import Final + +if sys.version_info >= (3, 10): + LOCALE_ENCODING: Final = "locale" +else: + LOCALE_ENCODING: Final = None diff --git a/stubs/setuptools/setuptools/config/expand.pyi b/stubs/setuptools/setuptools/config/expand.pyi index ff32f6690..bcdc43fa2 100644 --- a/stubs/setuptools/setuptools/config/expand.pyi +++ b/stubs/setuptools/setuptools/config/expand.pyi @@ -1,15 +1,13 @@ -import os -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from collections.abc import Callable, Iterable, Iterator, Mapping from importlib.machinery import ModuleSpec from types import TracebackType from typing import TypeVar -from typing_extensions import Self, TypeAlias +from typing_extensions import Self from ..dist import Distribution chain_iter: Incomplete -_Path: TypeAlias = str | os.PathLike[Incomplete] _K = TypeVar("_K") _VCo = TypeVar("_VCo", covariant=True) @@ -17,22 +15,22 @@ class StaticModule: def __init__(self, name: str, spec: ModuleSpec) -> None: ... def __getattr__(self, attr): ... -def glob_relative(patterns: Iterable[str], root_dir: _Path | None = None) -> list[str]: ... -def read_files(filepaths: str | bytes | Iterable[_Path], root_dir: Incomplete | None = None) -> str: ... -def read_attr(attr_desc: str, package_dir: Mapping[str, str] | None = None, root_dir: _Path | None = None): ... +def glob_relative(patterns: Iterable[str], root_dir: StrPath | None = None) -> list[str]: ... +def read_files(filepaths: str | bytes | Iterable[StrPath], root_dir: Incomplete | None = None) -> str: ... +def read_attr(attr_desc: str, package_dir: Mapping[str, str] | None = None, root_dir: StrPath | None = None): ... def resolve_class( - qualified_class_name: str, package_dir: Mapping[str, str] | None = None, root_dir: _Path | None = None + qualified_class_name: str, package_dir: Mapping[str, str] | None = None, root_dir: StrPath | None = None ) -> Callable[..., Incomplete]: ... def cmdclass( - values: dict[str, str], package_dir: Mapping[str, str] | None = None, root_dir: _Path | None = None + values: dict[str, str], package_dir: Mapping[str, str] | None = None, root_dir: StrPath | None = None ) -> dict[str, Callable[..., Incomplete]]: ... def find_packages( - *, namespaces: bool = True, fill_package_dir: dict[str, str] | None = None, root_dir: _Path | None = None, **kwargs + *, namespaces: bool = True, fill_package_dir: dict[str, str] | None = None, root_dir: StrPath | None = None, **kwargs ) -> list[str]: ... def version(value: Callable[..., Incomplete] | Iterable[str | int] | str) -> str: ... def canonic_package_data(package_data: dict[Incomplete, Incomplete]) -> dict[Incomplete, Incomplete]: ... def canonic_data_files( - data_files: list[Incomplete] | dict[Incomplete, Incomplete], root_dir: _Path | None = None + data_files: list[Incomplete] | dict[Incomplete, Incomplete], root_dir: StrPath | None = None ) -> list[tuple[str, list[str]]]: ... def entry_points(text: str, text_source: str = "entry-points") -> dict[str, dict[Incomplete, Incomplete]]: ... diff --git a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi index ce56e9bae..69f75652f 100644 --- a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi +++ b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi @@ -1,23 +1,20 @@ -import os -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from types import TracebackType -from typing_extensions import Self, TypeAlias +from typing_extensions import Self from ..dist import Distribution from ..warnings import SetuptoolsWarning from . import expand -_Path: TypeAlias = str | os.PathLike[Incomplete] - -def load_file(filepath: _Path) -> dict[Incomplete, Incomplete]: ... -def validate(config: dict[Incomplete, Incomplete], filepath: _Path) -> bool: ... -def apply_configuration(dist: Distribution, filepath: _Path, ignore_option_errors: bool = False) -> Distribution: ... +def load_file(filepath: StrPath) -> dict[Incomplete, Incomplete]: ... +def validate(config: dict[Incomplete, Incomplete], filepath: StrPath) -> bool: ... +def apply_configuration(dist: Distribution, filepath: StrPath, ignore_option_errors: bool = False) -> Distribution: ... def read_configuration( - filepath: _Path, expand: bool = True, ignore_option_errors: bool = False, dist: Distribution | None = None + filepath: StrPath, expand: bool = True, ignore_option_errors: bool = False, dist: Distribution | None = None ): ... def expand_configuration( config: dict[Incomplete, Incomplete], - root_dir: _Path | None = None, + root_dir: StrPath | None = None, ignore_option_errors: bool = False, dist: Distribution | None = None, ) -> dict[Incomplete, Incomplete]: ... @@ -33,7 +30,7 @@ class _ConfigExpander: def __init__( self, config: dict[Incomplete, Incomplete], - root_dir: _Path | None = None, + root_dir: StrPath | None = None, ignore_option_errors: bool = False, dist: Distribution | None = None, ) -> None: ... diff --git a/stubs/setuptools/setuptools/config/setupcfg.pyi b/stubs/setuptools/setuptools/config/setupcfg.pyi index 222792693..c231699aa 100644 --- a/stubs/setuptools/setuptools/config/setupcfg.pyi +++ b/stubs/setuptools/setuptools/config/setupcfg.pyi @@ -1,21 +1,18 @@ -import os -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from typing import Generic, TypeVar -from typing_extensions import TypeAlias from .._distutils.dist import DistributionMetadata from ..dist import Distribution from . import expand -_Path: TypeAlias = str | os.PathLike[Incomplete] SingleCommandOptions: Incomplete AllCommandOptions: Incomplete Target = TypeVar("Target", bound=Distribution | DistributionMetadata) # noqa: Y001 # Exists at runtime def read_configuration( - filepath: _Path, find_others: bool = False, ignore_option_errors: bool = False + filepath: StrPath, find_others: bool = False, ignore_option_errors: bool = False ) -> dict[Incomplete, Incomplete]: ... -def apply_configuration(dist: Distribution, filepath: _Path) -> Distribution: ... +def apply_configuration(dist: Distribution, filepath: StrPath) -> Distribution: ... def configuration_to_dict( handlers: tuple[ConfigHandler[Distribution | DistributionMetadata], ...] ) -> dict[Incomplete, Incomplete]: ... @@ -57,7 +54,7 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): ignore_option_errors: bool, ensure_discovered: expand.EnsurePackagesDiscovered, package_dir: dict[Incomplete, Incomplete] | None = None, - root_dir: _Path = ".", + root_dir: StrPath = ".", ) -> None: ... @property def parsers(self): ... diff --git a/stubs/setuptools/setuptools/discovery.pyi b/stubs/setuptools/setuptools/discovery.pyi index 15f74d902..3a7635696 100644 --- a/stubs/setuptools/setuptools/discovery.pyi +++ b/stubs/setuptools/setuptools/discovery.pyi @@ -1,11 +1,9 @@ -import os -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator, Mapping from typing_extensions import TypeAlias from . import Distribution -_Path: TypeAlias = str | os.PathLike[Incomplete] StrIter: TypeAlias = Iterator[str] chain_iter: Incomplete @@ -18,7 +16,7 @@ class _Finder: ALWAYS_EXCLUDE: tuple[str, ...] DEFAULT_EXCLUDE: tuple[str, ...] @classmethod - def find(cls, where: _Path = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... + def find(cls, where: StrPath = ".", exclude: Iterable[str] = (), include: Iterable[str] = ("*",)) -> list[str]: ... class PackageFinder(_Finder): ALWAYS_EXCLUDE: Incomplete @@ -40,6 +38,6 @@ class ConfigDiscovery: def remove_nested_packages(packages: list[str]) -> list[str]: ... def remove_stubs(packages: list[str]) -> list[str]: ... -def find_parent_package(packages: list[str], package_dir: Mapping[str, str], root_dir: _Path) -> str | None: ... -def find_package_path(name: str, package_dir: Mapping[str, str], root_dir: _Path) -> str: ... -def construct_package_dir(packages: list[str], package_path: _Path) -> dict[str, str]: ... +def find_parent_package(packages: list[str], package_dir: Mapping[str, str], root_dir: StrPath) -> str | None: ... +def find_package_path(name: str, package_dir: Mapping[str, str], root_dir: StrPath) -> str: ... +def construct_package_dir(packages: list[str], package_path: StrPath) -> dict[str, str]: ... diff --git a/stubs/setuptools/setuptools/monkey.pyi b/stubs/setuptools/setuptools/monkey.pyi index dca3245d3..f31d2563b 100644 --- a/stubs/setuptools/setuptools/monkey.pyi +++ b/stubs/setuptools/setuptools/monkey.pyi @@ -1,4 +1,10 @@ -def get_unpatched(item): ... +from typing import TypeVar + +_T = TypeVar("_T") + +__all__: list[str] = [] + +def get_unpatched(item: _T) -> _T: ... def get_unpatched_class(cls): ... def patch_all() -> None: ... def patch_func(replacement, target_mod, func_name) -> None: ...