diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index 843be7a5133b..ca4fb3265324 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -3,9 +3,10 @@ from abc import abstractmethod from collections.abc import Callable, Iterable from distutils.dist import Distribution from distutils.file_util import _BytesPathT, _StrPathT -from typing import Any, ClassVar, Literal, overload +from typing import Any, ClassVar, Literal, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack +_CommandT = TypeVar("_CommandT", bound=Command) _Ts = TypeVarTuple("_Ts") class Command: @@ -22,13 +23,16 @@ class Command: def announce(self, msg: str, level: int = 1) -> None: ... def debug_print(self, msg: str) -> None: ... def ensure_string(self, option: str, default: str | None = None) -> None: ... - def ensure_string_list(self, option: str | list[str]) -> None: ... + def ensure_string_list(self, option: str) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... def get_finalized_command(self, command: str, create: bool | Literal[0, 1] = 1) -> Command: ... - def reinitialize_command(self, command: Command | str, reinit_subcommands: bool | Literal[0, 1] = 0) -> Command: ... + @overload + def reinitialize_command(self, command: str, reinit_subcommands: bool | Literal[0, 1] = 0) -> Command: ... + @overload + def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool | Literal[0, 1] = 0) -> _CommandT: ... def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index c3a88c8776fb..a044e09d3726 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete, StrPath from abc import abstractmethod from collections.abc import Iterable, Mapping, Sequence -from typing import Any +from typing import Any, TypeVar, overload from ._distutils.cmd import Command as _Command from .depends import Require as Require @@ -9,6 +9,8 @@ from .dist import Distribution as Distribution from .extension import Extension as Extension from .warnings import SetuptoolsDeprecationWarning as SetuptoolsDeprecationWarning +_CommandT = TypeVar("_CommandT", bound=_Command) + __all__ = [ "setup", "Distribution", @@ -76,8 +78,11 @@ 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 | list[str]) -> None: ... - def reinitialize_command(self, command: _Command | str, reinit_subcommands: bool = False, **kw: Any) -> _Command: ... # type: ignore[override] + def ensure_string_list(self, option: str) -> None: ... + @overload # type: ignore[override] # Extra **kw param + def reinitialize_command(self, command: str, reinit_subcommands: bool = False, **kw) -> _Command: ... + @overload + def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False, **kw) -> _CommandT: ... @abstractmethod def initialize_options(self) -> None: ... @abstractmethod diff --git a/stubs/setuptools/setuptools/_distutils/cmd.pyi b/stubs/setuptools/setuptools/_distutils/cmd.pyi index 950a5c5a7373..42310b8cfb08 100644 --- a/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -8,6 +8,7 @@ from .dist import Distribution _StrPathT = TypeVar("_StrPathT", bound=StrPath) _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath) +_CommandT = TypeVar("_CommandT", bound=Command) _Ts = TypeVarTuple("_Ts") class Command: @@ -25,13 +26,16 @@ class Command: def announce(self, msg: str, level: int = ...) -> None: ... def debug_print(self, msg: str) -> None: ... def ensure_string(self, option: str, default: str | None = ...) -> None: ... - def ensure_string_list(self, option: str | list[str]) -> None: ... + def ensure_string_list(self, option: str) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... def get_finalized_command(self, command: str, create: bool = True) -> Command: ... - def reinitialize_command(self, command: Command | str, reinit_subcommands: bool = False) -> Command: ... + @overload + def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ... + @overload + def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool = False) -> _CommandT: ... def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi index edeb0e6a5284..0d699298314b 100644 --- a/stubs/setuptools/setuptools/_distutils/command/bdist.pyi +++ b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi @@ -13,7 +13,7 @@ class ListCompat(dict[str, tuple[str, str]]): class bdist(Command): description: ClassVar[str] - user_options: ClassVar[list[tuple[str | None, str | None, str | None]]] + user_options: ClassVar[list[tuple[str, str | None, str | None]]] boolean_options: ClassVar[list[str]] help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]] no_format_option: ClassVar[tuple[str, ...]] diff --git a/stubs/setuptools/setuptools/build_meta.pyi b/stubs/setuptools/setuptools/build_meta.pyi index 4f3ae04151f9..758a2bdb9b6a 100644 --- a/stubs/setuptools/setuptools/build_meta.pyi +++ b/stubs/setuptools/setuptools/build_meta.pyi @@ -30,22 +30,18 @@ class Distribution(dist.Distribution): class _BuildMetaBackend: def run_setup(self, setup_script: str = "setup.py") -> None: ... - def get_requires_for_build_wheel(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... - def get_requires_for_build_sdist(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... - def prepare_metadata_for_build_wheel( - self, metadata_directory: str, config_settings: _ConfigSettings | None = None - ) -> str: ... + 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 build_wheel( - self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: StrPath | None = None + self, wheel_directory: StrPath, config_settings: _ConfigSettings = None, metadata_directory: StrPath | None = None ) -> str: ... - def build_sdist(self, sdist_directory: StrPath, config_settings: _ConfigSettings | None = None) -> str: ... + def build_sdist(self, sdist_directory: StrPath, config_settings: _ConfigSettings = None) -> str: ... def build_editable( - self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: str | None = None - ) -> str: ... - def get_requires_for_build_editable(self, config_settings: _ConfigSettings | None = None) -> list[str]: ... - def prepare_metadata_for_build_editable( - self, metadata_directory: str, config_settings: _ConfigSettings | None = None + 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: ... class _BuildMetaLegacyBackend(_BuildMetaBackend): def run_setup(self, setup_script: str = "setup.py") -> None: ... diff --git a/stubs/setuptools/setuptools/command/build_py.pyi b/stubs/setuptools/setuptools/command/build_py.pyi index fe71ff6c0a9e..cefb13f55ca0 100644 --- a/stubs/setuptools/setuptools/command/build_py.pyi +++ b/stubs/setuptools/setuptools/command/build_py.pyi @@ -11,14 +11,14 @@ class build_py(orig.build_py): package_data: dict[str, list[str]] exclude_package_data: dict[Incomplete, Incomplete] def finalize_options(self) -> None: ... - def copy_file( # type: ignore[override] + def copy_file( # type: ignore[override] # No overload, str support only self, infile: StrPath, outfile: _StrPathT, preserve_mode: bool = True, preserve_times: bool = True, link: str | None = None, - level=1, + level: int = 1, ) -> tuple[_StrPathT | str, bool]: ... def run(self) -> None: ... data_files: list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]] @@ -26,7 +26,7 @@ class build_py(orig.build_py): def build_module(self, module, module_file, package): ... def get_data_files_without_manifest(self) -> list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]]: ... def find_data_files(self, package, src_dir): ... - def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override] + def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override] # Using a real boolean instead of 0|1 def build_package_data(self) -> None: ... manifest_files: dict[Incomplete, Incomplete] def get_output_mapping(self) -> dict[str, str]: ... diff --git a/stubs/setuptools/setuptools/command/easy_install.pyi b/stubs/setuptools/setuptools/command/easy_install.pyi index 73b296a24f4e..6db9d45d6848 100644 --- a/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/stubs/setuptools/setuptools/command/easy_install.pyi @@ -1,9 +1,10 @@ from _typeshed import Incomplete from collections.abc import Iterable, Iterator -from typing import ClassVar, TypedDict +from typing import Any, ClassVar, Literal, TypedDict, type_check_only from typing_extensions import Self from pkg_resources import Environment +from setuptools.package_index import PackageIndex from .. import Command, SetuptoolsDeprecationWarning @@ -15,7 +16,7 @@ class easy_install(Command): user_options: ClassVar[list[tuple[str, str | None, str]]] boolean_options: ClassVar[list[str]] negative_opt: ClassVar[dict[str, str]] - create_index: Incomplete + create_index: ClassVar[type[PackageIndex]] user: bool zip_ok: Incomplete install_dir: Incomplete @@ -36,22 +37,22 @@ class easy_install(Command): install_data: Incomplete install_base: Incomplete install_platbase: Incomplete - install_userbase: Incomplete - install_usersite: Incomplete + install_userbase: str | None + install_usersite: str | None no_find_links: Incomplete package_index: Incomplete pth_file: Incomplete site_dirs: Incomplete installed_projects: Incomplete - verbose: Incomplete + verbose: bool | Literal[0, 1] def initialize_options(self) -> None: ... def delete_blockers(self, blockers) -> None: ... - config_vars: Incomplete + config_vars: dict[str, Any] script_dir: Incomplete - all_site_dirs: Incomplete - shadow_path: Incomplete - local_index: Incomplete - outputs: Incomplete + all_site_dirs: list[str] + shadow_path: list[str] + local_index: Environment + outputs: list[Incomplete] def finalize_options(self) -> None: ... def expand_basedirs(self) -> None: ... def expand_dirs(self) -> None: ... @@ -98,7 +99,7 @@ def get_exe_prefixes(exe_filename): ... class PthDistributions(Environment): dirty: bool filename: Incomplete - sitedirs: Incomplete + sitedirs: list[str] basedir: Incomplete paths: list[str] def __init__(self, filename, sitedirs=()) -> None: ... @@ -108,9 +109,10 @@ class PthDistributions(Environment): def make_relative(self, path): ... class RewritePthDistributions(PthDistributions): - prelude: Incomplete - postlude: Incomplete + prelude: str + postlude: str +@type_check_only class _SplitArgs(TypedDict, total=False): comments: bool posix: bool diff --git a/stubs/setuptools/setuptools/command/editable_wheel.pyi b/stubs/setuptools/setuptools/command/editable_wheel.pyi index 97a4573a6783..3d8f73bcc0b6 100644 --- a/stubs/setuptools/setuptools/command/editable_wheel.pyi +++ b/stubs/setuptools/setuptools/command/editable_wheel.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, StrPath -from collections.abc import Iterator +from collections.abc import Iterator, Mapping from enum import Enum from pathlib import Path from types import TracebackType @@ -28,45 +28,45 @@ class editable_wheel(Command): project_dir: Incomplete mode: Incomplete def initialize_options(self) -> None: ... - package_dir: Incomplete + package_dir: dict[Incomplete, Incomplete] def finalize_options(self) -> None: ... def run(self) -> None: ... class EditableStrategy(Protocol): - def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]) -> None: ... + def __call__(self, wheel: _WheelFile, files: list[str], mapping: Mapping[str, str]) -> None: ... def __enter__(self): ... def __exit__( self, _exc_type: type[BaseException] | None, _exc_value: BaseException | None, _traceback: TracebackType | None ) -> None: ... class _StaticPth: - dist: Incomplete - name: Incomplete - path_entries: Incomplete + dist: Distribution + name: str + path_entries: list[Path] def __init__(self, dist: Distribution, name: str, path_entries: list[Path]) -> None: ... - def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]): ... + 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: ... class _LinkTree(_StaticPth): - auxiliary_dir: Incomplete - build_lib: Incomplete + auxiliary_dir: Path + build_lib: Path 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 __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: ... class _TopLevelFinder: - dist: Incomplete - name: Incomplete + dist: Distribution + name: str def __init__(self, dist: Distribution, name: str) -> None: ... def template_vars(self) -> tuple[str, str, dict[str, str], dict[str, list[str]]]: ... def get_implementation(self) -> Iterator[tuple[str, bytes]]: ... - def __call__(self, wheel: _WheelFile, files: list[str], mapping: dict[str, str]): ... + 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 @@ -77,7 +77,7 @@ class _NamespaceInstaller(namespaces.Installer): src_root: Incomplete installation_dir: Incomplete editable_name: Incomplete - outputs: Incomplete + outputs: list[Incomplete] dry_run: bool def __init__(self, distribution, installation_dir, editable_name, src_root) -> None: ... diff --git a/stubs/setuptools/setuptools/command/egg_info.pyi b/stubs/setuptools/setuptools/command/egg_info.pyi index fe931303f734..c318c8134638 100644 --- a/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/stubs/setuptools/setuptools/command/egg_info.pyi @@ -28,7 +28,6 @@ class egg_info(InfoCommon, Command): egg_name: Incomplete egg_info: Incomplete egg_version: Incomplete - broken_egg_info: bool def initialize_options(self) -> None: ... @property def tag_svn_revision(self) -> None: ... @@ -65,7 +64,7 @@ class manifest_maker(sdist): force_manifest: bool def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... - filelist: Incomplete + filelist: FileList def run(self) -> None: ... def write_manifest(self) -> None: ... def warn(self, msg) -> None: ... diff --git a/stubs/setuptools/setuptools/command/install.pyi b/stubs/setuptools/setuptools/command/install.pyi index 8e93bd2b9bd1..d5f499e7403d 100644 --- a/stubs/setuptools/setuptools/command/install.pyi +++ b/stubs/setuptools/setuptools/command/install.pyi @@ -10,7 +10,7 @@ class install(orig.install): # Any to work around variance issues new_commands: list[tuple[str, Callable[[Any], bool]] | None] old_and_unmanageable: Incomplete - single_version_externally_managed: Incomplete + single_version_externally_managed: bool | None def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... path_file: Incomplete diff --git a/stubs/setuptools/setuptools/command/install_lib.pyi b/stubs/setuptools/setuptools/command/install_lib.pyi index 79e3e59e0405..2da4a2e50bc8 100644 --- a/stubs/setuptools/setuptools/command/install_lib.pyi +++ b/stubs/setuptools/setuptools/command/install_lib.pyi @@ -9,9 +9,9 @@ class install_lib(orig.install_lib): self, infile: StrPath, outfile: str, - preserve_mode: bool = True, # type: ignore[override] - preserve_times: bool = True, # type: ignore[override] - preserve_symlinks: bool = False, # type: ignore[override] + preserve_mode: bool = True, + preserve_times: bool = True, + preserve_symlinks: bool = False, level: Unused = 1, ): ... def get_outputs(self): ... diff --git a/stubs/setuptools/setuptools/command/upload_docs.pyi b/stubs/setuptools/setuptools/command/upload_docs.pyi index f8ed816acc95..3e75d483e019 100644 --- a/stubs/setuptools/setuptools/command/upload_docs.pyi +++ b/stubs/setuptools/setuptools/command/upload_docs.pyi @@ -8,7 +8,7 @@ class upload_docs(upload): DEFAULT_REPOSITORY: ClassVar[str] description: ClassVar[str] user_options: ClassVar[list[tuple[str, str | None, str]]] - boolean_options: ClassVar[list[str]] + boolean_options = upload.boolean_options def has_sphinx(self): ... # Any to work around variance issues sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]] diff --git a/stubs/setuptools/setuptools/config/__init__.pyi b/stubs/setuptools/setuptools/config/__init__.pyi index ca745c9194b9..dbb468cd5d8c 100644 --- a/stubs/setuptools/setuptools/config/__init__.pyi +++ b/stubs/setuptools/setuptools/config/__init__.pyi @@ -1,9 +1,16 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from collections.abc import Callable from typing import TypeVar +from setuptools.config.setupcfg import AllCommandOptions, ConfigMetadataHandler, ConfigOptionsHandler +from setuptools.dist import Distribution + Fn = TypeVar("Fn", bound=Callable[..., Incomplete]) # noqa: Y001 # Exists at runtime __all__ = ("parse_configuration", "read_configuration") -def read_configuration(filepath, find_others: bool = False, ignore_option_errors: bool = False): ... -def parse_configuration(distribution, command_options, ignore_option_errors: bool = False): ... +def read_configuration( + filepath: StrPath, find_others: bool = False, ignore_option_errors: bool = False +) -> dict[Incomplete, Incomplete]: ... +def parse_configuration( + distribution: Distribution, command_options: AllCommandOptions, ignore_option_errors: bool = False +) -> tuple[ConfigMetadataHandler, ConfigOptionsHandler]: ... diff --git a/stubs/setuptools/setuptools/config/expand.pyi b/stubs/setuptools/setuptools/config/expand.pyi index 0bc46382ef7a..cdd99861e836 100644 --- a/stubs/setuptools/setuptools/config/expand.pyi +++ b/stubs/setuptools/setuptools/config/expand.pyi @@ -12,7 +12,7 @@ _VCo = TypeVar("_VCo", covariant=True) class StaticModule: def __init__(self, name: str, spec: ModuleSpec) -> None: ... - def __getattr__(self, attr): ... + def __getattr__(self, attr: str): ... def glob_relative(patterns: Iterable[str], root_dir: StrPath | None = None) -> list[str]: ... def read_files(filepaths: StrPath | Iterable[StrPath], root_dir: StrPath | None = None) -> str: ... diff --git a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi index 69f75652fae3..e61686654dfe 100644 --- a/stubs/setuptools/setuptools/config/pyprojecttoml.pyi +++ b/stubs/setuptools/setuptools/config/pyprojecttoml.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete, StrPath from types import TracebackType +from typing import Any from typing_extensions import Self from ..dist import Distribution @@ -11,7 +12,7 @@ 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: StrPath, expand: bool = True, ignore_option_errors: bool = False, dist: Distribution | None = None -): ... +) -> dict[str, Any]: ... def expand_configuration( config: dict[Incomplete, Incomplete], root_dir: StrPath | None = None, @@ -20,13 +21,13 @@ def expand_configuration( ) -> dict[Incomplete, Incomplete]: ... class _ConfigExpander: - config: Incomplete - root_dir: Incomplete + config: dict[Incomplete, Incomplete] + root_dir: StrPath project_cfg: Incomplete dynamic: Incomplete setuptools_cfg: Incomplete dynamic_cfg: Incomplete - ignore_option_errors: Incomplete + ignore_option_errors: bool def __init__( self, config: dict[Incomplete, Incomplete], diff --git a/stubs/setuptools/setuptools/config/setupcfg.pyi b/stubs/setuptools/setuptools/config/setupcfg.pyi index e3b88b4b3386..d54e32d5de05 100644 --- a/stubs/setuptools/setuptools/config/setupcfg.pyi +++ b/stubs/setuptools/setuptools/config/setupcfg.pyi @@ -1,12 +1,13 @@ from _typeshed import Incomplete, StrPath -from typing import ClassVar, Generic, TypeVar +from typing import Any, ClassVar, Generic, TypeVar +from typing_extensions import TypeAlias from .._distutils.dist import DistributionMetadata from ..dist import Distribution from . import expand -SingleCommandOptions: Incomplete -AllCommandOptions: Incomplete +SingleCommandOptions: TypeAlias = dict[str, tuple[str, Any]] +AllCommandOptions: TypeAlias = dict[str, SingleCommandOptions] Target = TypeVar("Target", bound=Distribution | DistributionMetadata) # noqa: Y001 # Exists at runtime def read_configuration( @@ -24,10 +25,10 @@ class ConfigHandler(Generic[Target]): section_prefix: str aliases: ClassVar[dict[str, str]] ignore_option_errors: Incomplete - target_obj: Incomplete - sections: Incomplete - set_options: Incomplete - ensure_discovered: Incomplete + target_obj: Target + sections: dict[str, SingleCommandOptions] + set_options: list[str] + ensure_discovered: expand.EnsurePackagesDiscovered def __init__( self, target_obj: Target, @@ -45,8 +46,8 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): section_prefix: str aliases: ClassVar[dict[str, str]] strict_mode: bool - package_dir: Incomplete - root_dir: Incomplete + package_dir: dict[Incomplete, Incomplete] | None + root_dir: StrPath def __init__( self, target_obj: DistributionMetadata, @@ -61,8 +62,8 @@ class ConfigMetadataHandler(ConfigHandler[DistributionMetadata]): class ConfigOptionsHandler(ConfigHandler[Distribution]): section_prefix: str - root_dir: Incomplete - package_dir: Incomplete + root_dir: str | None + package_dir: dict[str, str] def __init__( self, target_obj: Distribution, diff --git a/stubs/setuptools/setuptools/depends.pyi b/stubs/setuptools/setuptools/depends.pyi index c6376a641247..d47ac2d77af5 100644 --- a/stubs/setuptools/setuptools/depends.pyi +++ b/stubs/setuptools/setuptools/depends.pyi @@ -23,5 +23,5 @@ class Require: def is_present(self, paths: Incomplete | None = None): ... def is_current(self, paths: Incomplete | None = None): ... -def get_module_constant(module, symbol, default: int = -1, paths: Incomplete | None = None): ... -def extract_constant(code, symbol, default: int = -1): ... +def get_module_constant(module, symbol, default: str | int = -1, paths: Incomplete | None = None) -> Any: ... +def extract_constant(code, symbol, default: str | int = -1) -> Any: ... diff --git a/stubs/setuptools/setuptools/discovery.pyi b/stubs/setuptools/setuptools/discovery.pyi index d6cb61e70fc2..90f87b8491a3 100644 --- a/stubs/setuptools/setuptools/discovery.pyi +++ b/stubs/setuptools/setuptools/discovery.pyi @@ -1,3 +1,4 @@ +import itertools from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator, Mapping from typing import ClassVar @@ -6,7 +7,7 @@ from typing_extensions import TypeAlias from . import Distribution StrIter: TypeAlias = Iterator[str] -chain_iter: Incomplete +chain_iter = itertools.chain.from_iterable class _Filter: def __init__(self, *patterns: str) -> None: ... diff --git a/stubs/setuptools/setuptools/dist.pyi b/stubs/setuptools/setuptools/dist.pyi index f151b388fa0d..51d4d0e89339 100644 --- a/stubs/setuptools/setuptools/dist.pyi +++ b/stubs/setuptools/setuptools/dist.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator, MutableMapping from . import Command, SetuptoolsDeprecationWarning @@ -13,7 +13,7 @@ class Distribution(_Distribution): def __init__(self, attrs: MutableMapping[str, Incomplete] | None = None) -> None: ... def warn_dash_deprecation(self, opt: str, section: str) -> str: ... def make_option_lowercase(self, opt: str, section: str) -> str: ... - def parse_config_files(self, filenames: Iterable[str] | None = None, ignore_option_errors: bool = False) -> 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 get_egg_cache_dir(self) -> str: ... def fetch_build_egg(self, req): ... diff --git a/stubs/setuptools/setuptools/modified.pyi b/stubs/setuptools/setuptools/modified.pyi index 3148cc626dc6..0437d4efc3ed 100644 --- a/stubs/setuptools/setuptools/modified.pyi +++ b/stubs/setuptools/setuptools/modified.pyi @@ -1,8 +1,3 @@ -from ._distutils._modified import ( - newer as newer, - newer_group as newer_group, - newer_pairwise as newer_pairwise, - newer_pairwise_group as newer_pairwise_group, -) +from ._distutils._modified import newer, newer_group, newer_pairwise, newer_pairwise_group __all__ = ["newer", "newer_pairwise", "newer_group", "newer_pairwise_group"] diff --git a/stubs/setuptools/setuptools/msvc.pyi b/stubs/setuptools/setuptools/msvc.pyi index daac625fab3b..6376fa5d36f0 100644 --- a/stubs/setuptools/setuptools/msvc.pyi +++ b/stubs/setuptools/setuptools/msvc.pyi @@ -93,7 +93,7 @@ class EnvironmentInfo: pi: Incomplete ri: Incomplete si: Incomplete - def __init__(self, arch, vc_ver: Incomplete | None = None, vc_min_ver: int = 0) -> None: ... + def __init__(self, arch, vc_ver: Incomplete | None = None, vc_min_ver: float = 0) -> None: ... @property def vs_ver(self): ... @property diff --git a/stubs/setuptools/setuptools/warnings.pyi b/stubs/setuptools/setuptools/warnings.pyi index b75a929b68db..6bb52b66dc9c 100644 --- a/stubs/setuptools/setuptools/warnings.pyi +++ b/stubs/setuptools/setuptools/warnings.pyi @@ -1,10 +1,14 @@ +from typing_extensions import TypeAlias + +_DueDate: TypeAlias = tuple[int, int, int] # time tuple + class SetuptoolsWarning(UserWarning): @classmethod def emit( cls, summary: str | None = None, details: str | None = None, - due_date: tuple[int, int, int] | None = None, + due_date: _DueDate | None = None, see_docs: str | None = None, see_url: str | None = None, stacklevel: int = 2,