diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index 580c46f519b9..4595928ea56d 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "75.2.*" +version = "75.3.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ If using `setuptools >= 71.1` *only* for `pkg_resources`, diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index c2a24d44ce03..8bba3da5b5ad 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -31,7 +31,7 @@ from .dist import Distribution as Distribution from .extension import Extension as Extension from .warnings import SetuptoolsDeprecationWarning as SetuptoolsDeprecationWarning -_CommandT = TypeVar("_CommandT", bound=Command) +_CommandT = TypeVar("_CommandT", bound=_Command) __all__ = [ "setup", diff --git a/stubs/setuptools/setuptools/build_meta.pyi b/stubs/setuptools/setuptools/build_meta.pyi index 758a2bdb9b6a..bfc403ef9e77 100644 --- a/stubs/setuptools/setuptools/build_meta.pyi +++ b/stubs/setuptools/setuptools/build_meta.pyi @@ -32,7 +32,7 @@ class _BuildMetaBackend: def run_setup(self, setup_script: str = "setup.py") -> None: ... def get_requires_for_build_wheel(self, config_settings: _ConfigSettings = None) -> list[str]: ... def get_requires_for_build_sdist(self, config_settings: _ConfigSettings = None) -> list[str]: ... - def prepare_metadata_for_build_wheel(self, metadata_directory: str, config_settings: _ConfigSettings = None) -> str: ... + def prepare_metadata_for_build_wheel(self, metadata_directory: StrPath, config_settings: _ConfigSettings = None) -> str: ... def build_wheel( self, wheel_directory: StrPath, config_settings: _ConfigSettings = None, metadata_directory: StrPath | None = None ) -> str: ... @@ -41,7 +41,9 @@ class _BuildMetaBackend: self, wheel_directory: StrPath, config_settings: _ConfigSettings = None, metadata_directory: StrPath | None = None ) -> str: ... def get_requires_for_build_editable(self, config_settings: _ConfigSettings = None) -> list[str]: ... - def prepare_metadata_for_build_editable(self, metadata_directory: str, config_settings: _ConfigSettings = None) -> str: ... + def prepare_metadata_for_build_editable( + self, metadata_directory: StrPath, config_settings: _ConfigSettings = None + ) -> str: ... class _BuildMetaLegacyBackend(_BuildMetaBackend): def run_setup(self, setup_script: str = "setup.py") -> None: ... diff --git a/stubs/setuptools/setuptools/command/bdist_egg.pyi b/stubs/setuptools/setuptools/command/bdist_egg.pyi index 6120d3b6c2ff..02e498367689 100644 --- a/stubs/setuptools/setuptools/command/bdist_egg.pyi +++ b/stubs/setuptools/setuptools/command/bdist_egg.pyi @@ -1,9 +1,12 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from collections.abc import Generator -from typing import ClassVar, Final +from typing import ClassVar, Final, TypeVar +from zipfile import _ZipFileMode from .. import Command +_StrPathT = TypeVar("_StrPathT", bound=StrPath) + def strip_module(filename): ... def sorted_walk(dir) -> Generator[Incomplete, None, None]: ... def write_stub(resource, pyfile) -> None: ... @@ -48,5 +51,10 @@ def can_scan(): ... INSTALL_DIRECTORY_ATTRS: Final[list[str]] def make_zipfile( - zip_filename, base_dir, verbose: bool = False, dry_run: bool = False, compress: bool = True, mode: str = "w" -): ... + zip_filename: _StrPathT, + base_dir, + verbose: bool = False, + dry_run: bool = False, + compress: bool = True, + mode: _ZipFileMode = "w", +) -> _StrPathT: ... diff --git a/stubs/setuptools/setuptools/command/bdist_wheel.pyi b/stubs/setuptools/setuptools/command/bdist_wheel.pyi index 4bba3e97406c..70025a98b5a8 100644 --- a/stubs/setuptools/setuptools/command/bdist_wheel.pyi +++ b/stubs/setuptools/setuptools/command/bdist_wheel.pyi @@ -40,7 +40,7 @@ class bdist_wheel(Command): owner: Incomplete | None group: Incomplete | None universal: bool - compression: int | str + compression: str | int python_tag: str build_number: str | None py_limited_api: str | Literal[False] diff --git a/stubs/setuptools/setuptools/command/build_py.pyi b/stubs/setuptools/setuptools/command/build_py.pyi index 77a2821d5c9f..64eca7a74c70 100644 --- a/stubs/setuptools/setuptools/command/build_py.pyi +++ b/stubs/setuptools/setuptools/command/build_py.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, StrPath +from _typeshed import Incomplete, StrPath, Unused from typing import ClassVar from setuptools.dist import Distribution @@ -21,7 +21,7 @@ class build_py(orig.build_py): preserve_mode: bool = True, preserve_times: bool = True, link: str | None = None, - level: int = 1, + level: Unused = 1, ) -> tuple[_StrPathT | str, bool]: ... def run(self) -> None: ... data_files: list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]] diff --git a/stubs/setuptools/setuptools/command/editable_wheel.pyi b/stubs/setuptools/setuptools/command/editable_wheel.pyi index 482e679d30c3..bcbec3e17ad6 100644 --- a/stubs/setuptools/setuptools/command/editable_wheel.pyi +++ b/stubs/setuptools/setuptools/command/editable_wheel.pyi @@ -33,11 +33,11 @@ class editable_wheel(Command): def run(self) -> None: ... class EditableStrategy(Protocol): - def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]) -> None: ... + def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]) -> Unused: ... def __enter__(self) -> Self: ... def __exit__( self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None - ) -> None: ... + ) -> Unused: ... class _StaticPth: dist: Distribution diff --git a/stubs/setuptools/setuptools/command/install.pyi b/stubs/setuptools/setuptools/command/install.pyi index 99472f199758..064c11a6dd69 100644 --- a/stubs/setuptools/setuptools/command/install.pyi +++ b/stubs/setuptools/setuptools/command/install.pyi @@ -11,7 +11,7 @@ class install(orig.install): user_options: ClassVar[list[tuple[str, str | None, str]]] boolean_options: ClassVar[list[str]] # Any to work around variance issues - new_commands: list[tuple[str, Callable[[Any], bool]] | None] + new_commands: ClassVar[list[tuple[str, Callable[[Any], bool]] | None]] old_and_unmanageable: Incomplete single_version_externally_managed: bool | None def initialize_options(self) -> None: ... diff --git a/stubs/setuptools/setuptools/config/expand.pyi b/stubs/setuptools/setuptools/config/expand.pyi index 78c53c5e641f..c57ed4d46229 100644 --- a/stubs/setuptools/setuptools/config/expand.pyi +++ b/stubs/setuptools/setuptools/config/expand.pyi @@ -8,7 +8,7 @@ from typing_extensions import Self from ..dist import Distribution _K = TypeVar("_K") -_VCo = TypeVar("_VCo", covariant=True) +_V_co = TypeVar("_V_co", covariant=True) class StaticModule: def __init__(self, name: str, spec: ModuleSpec) -> None: ... @@ -31,7 +31,7 @@ def canonic_package_data(package_data: dict[Incomplete, Incomplete]) -> dict[Inc def canonic_data_files( 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]]: ... +def entry_points(text: str, text_source: str = "entry-points") -> dict[str, dict[str, str]]: ... class EnsurePackagesDiscovered: def __init__(self, distribution: Distribution) -> None: ... @@ -43,8 +43,8 @@ class EnsurePackagesDiscovered: @property def package_dir(self) -> Mapping[str, str]: ... -class LazyMappingProxy(Mapping[_K, _VCo]): - def __init__(self, obtain_mapping_value: Callable[[], Mapping[_K, _VCo]]) -> None: ... - def __getitem__(self, key: _K) -> _VCo: ... +class LazyMappingProxy(Mapping[_K, _V_co]): + def __init__(self, obtain_mapping_value: Callable[[], Mapping[_K, _V_co]]) -> None: ... + def __getitem__(self, key: _K) -> _V_co: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_K]: ... diff --git a/stubs/setuptools/setuptools/config/setupcfg.pyi b/stubs/setuptools/setuptools/config/setupcfg.pyi index d54e32d5de05..7d0cabbd9665 100644 --- a/stubs/setuptools/setuptools/config/setupcfg.pyi +++ b/stubs/setuptools/setuptools/config/setupcfg.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete, StrPath +from collections.abc import Iterable from typing import Any, ClassVar, Generic, TypeVar from typing_extensions import TypeAlias @@ -8,14 +9,14 @@ from . import expand SingleCommandOptions: TypeAlias = dict[str, tuple[str, Any]] AllCommandOptions: TypeAlias = dict[str, SingleCommandOptions] -Target = TypeVar("Target", bound=Distribution | DistributionMetadata) # noqa: Y001 # Exists at runtime +Target = TypeVar("Target", Distribution, DistributionMetadata) # noqa: Y001 # Exists at runtime def read_configuration( filepath: StrPath, find_others: bool = False, ignore_option_errors: bool = False ) -> dict[Incomplete, Incomplete]: ... def apply_configuration(dist: Distribution, filepath: StrPath) -> Distribution: ... def configuration_to_dict( - handlers: tuple[ConfigHandler[Distribution | DistributionMetadata], ...] + handlers: Iterable[ConfigHandler[Distribution] | ConfigHandler[DistributionMetadata]], ) -> dict[Incomplete, Incomplete]: ... def parse_configuration( distribution: Distribution, command_options: AllCommandOptions, ignore_option_errors: bool = False @@ -47,7 +48,7 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): aliases: ClassVar[dict[str, str]] strict_mode: bool package_dir: dict[Incomplete, Incomplete] | None - root_dir: StrPath + root_dir: StrPath | None def __init__( self, target_obj: DistributionMetadata, @@ -55,7 +56,7 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): ignore_option_errors: bool, ensure_discovered: expand.EnsurePackagesDiscovered, package_dir: dict[Incomplete, Incomplete] | None = None, - root_dir: StrPath = ".", + root_dir: StrPath | None = ".", ) -> None: ... @property def parsers(self): ... diff --git a/stubs/setuptools/setuptools/discovery.pyi b/stubs/setuptools/setuptools/discovery.pyi index 90f87b8491a3..9059a381f578 100644 --- a/stubs/setuptools/setuptools/discovery.pyi +++ b/stubs/setuptools/setuptools/discovery.pyi @@ -1,12 +1,10 @@ import itertools from _typeshed import Incomplete, StrPath -from collections.abc import Iterable, Iterator, Mapping +from collections.abc import Iterable, Mapping from typing import ClassVar -from typing_extensions import TypeAlias from . import Distribution -StrIter: TypeAlias = Iterator[str] chain_iter = itertools.chain.from_iterable class _Filter: diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index cbe36414d8e6..ea4bf2a92f81 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -3,6 +3,7 @@ from collections.abc import Iterable, Iterator, MutableMapping from typing import Literal, TypeVar, overload from . import Command, SetuptoolsDeprecationWarning +from ._distutils.cmd import Command as _Command from ._distutils.dist import Distribution as _Distribution from .command.alias import alias from .command.bdist_egg import bdist_egg @@ -26,7 +27,7 @@ from .command.saveopts import saveopts from .command.sdist import sdist from .command.setopt import setopt -_CommandT = TypeVar("_CommandT", bound=Command) +_CommandT = TypeVar("_CommandT", bound=_Command) __all__ = ["Distribution"] diff --git a/stubs/setuptools/setuptools/extension.pyi b/stubs/setuptools/setuptools/extension.pyi index 6cb7d7aad9dd..ff352d3dc6c6 100644 --- a/stubs/setuptools/setuptools/extension.pyi +++ b/stubs/setuptools/setuptools/extension.pyi @@ -1,3 +1,5 @@ +from _typeshed import StrPath + from ._distutils.extension import Extension as _Extension def have_pyrex() -> bool: ... @@ -7,7 +9,7 @@ class Extension(_Extension): def __init__( self, name: str, - sources: list[str], + sources: list[StrPath], include_dirs: list[str] | None = None, define_macros: list[tuple[str, str | None]] | None = None, undef_macros: list[str] | None = None, diff --git a/stubs/setuptools/setuptools/sandbox.pyi b/stubs/setuptools/setuptools/sandbox.pyi index 54b155308fbc..a1c47b0eb7c0 100644 --- a/stubs/setuptools/setuptools/sandbox.pyi +++ b/stubs/setuptools/setuptools/sandbox.pyi @@ -1,5 +1,4 @@ import sys -from _typeshed import Unused from types import TracebackType from typing import ClassVar, Literal from typing_extensions import Self @@ -23,7 +22,9 @@ def run_setup(setup_script, args): ... class AbstractSandbox: def __enter__(self) -> None: ... - def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused) -> None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + ) -> None: ... def run(self, func): ... # Dynamically created if sys.platform == "win32":