Skip to content

setuptools._distutils typing improvements from merging types upstream #13534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions stubs/setuptools/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ setuptools._distutils.command.install.INSTALL_SCHEMES
setuptools._distutils.command.install.SCHEME_KEYS
setuptools._distutils.command.install.WINDOWS_SCHEME
setuptools._distutils.command.install_lib.PYTHON_SOURCE_EXTENSION
setuptools._distutils.dist.DistributionMetadata.set_classifiers
setuptools._distutils.dist.DistributionMetadata.set_keywords
setuptools._distutils.dist.DistributionMetadata.set_platforms
setuptools._distutils.dist.fix_help_options
setuptools._distutils.extension.read_setup_file
setuptools._distutils.filelist.findall
Expand Down
2 changes: 1 addition & 1 deletion stubs/setuptools/setuptools/_distutils/archive_util.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ def make_tarball(
owner: str | None = None,
group: str | None = None,
) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False) -> str: ...
def make_zipfile(base_name: str, base_dir: StrPath, verbose: bool = False, dry_run: bool = False) -> str: ...
82 changes: 41 additions & 41 deletions stubs/setuptools/setuptools/_distutils/ccompiler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
_Ts = TypeVarTuple("_Ts")

def gen_lib_options(
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
compiler: CCompiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[str]
) -> list[str]: ...
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
def gen_preprocess_options(macros: Iterable[_Macro], include_dirs: Iterable[str]) -> list[str]: ...
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
def new_compiler(
plat: str | None = None, compiler: str | None = None, verbose: bool = False, dry_run: bool = False, force: bool = False
Expand Down Expand Up @@ -52,33 +52,33 @@ class CCompiler:
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: list[str]) -> None: ...
def detect_language(self, sources: str | list[str]) -> str | None: ...
def find_library_file(self, dirs: list[str], lib: str, debug: bool = False) -> str | None: ...
def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ...
def has_function(
self,
funcname: str,
includes: list[str] | None = None,
include_dirs: list[str] | None = None,
includes: Iterable[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
def runtime_library_dir_option(self, dir: str) -> str: ...
def set_executables(self, **args: str) -> None: ...
def set_executables(self, **kwargs: str) -> None: ...
def compile(
self,
sources: Sequence[StrPath],
output_dir: str | None = None,
macros: list[_Macro] | None = None,
include_dirs: list[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
depends: list[str] | None = None,
depends: list[str] | tuple[str, ...] | None = None,
) -> list[str]: ...
def create_static_lib(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_libname: str,
output_dir: str | None = None,
debug: bool = False,
Expand All @@ -87,89 +87,89 @@ class CCompiler:
def link(
self,
target_desc: str,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_filename: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def link_executable(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_progname: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
target_lang: str | None = None,
) -> None: ...
def link_shared_lib(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_libname: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def link_shared_object(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_filename: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def preprocess(
self,
source: str,
output_file: str | None = None,
source: StrPath,
output_file: StrPath | None = None,
macros: list[_Macro] | None = None,
include_dirs: list[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
extra_postargs: Iterable[str] | None = None,
) -> None: ...
@overload
def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
def executable_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
@overload
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
def executable_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
def library_filename(
self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = ""
) -> str: ...
def object_filenames(
self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = ""
) -> list[str]: ...
@overload
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
def shared_object_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
@overload
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
def execute(
self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
) -> None: ...
def spawn(self, cmd: MutableSequence[str]) -> None: ...
def spawn(self, cmd: MutableSequence[bytes | StrPath]) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
@overload
def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ...
Expand Down
12 changes: 6 additions & 6 deletions stubs/setuptools/setuptools/_distutils/command/bdist_rpm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command

class bdist_rpm(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
Expand Down Expand Up @@ -41,12 +41,12 @@ class bdist_rpm(Command):
conflicts: Incomplete
build_requires: Incomplete
obsoletes: Incomplete
keep_temp: int
use_rpm_opt_flags: int
rpm3_mode: int
no_autoreq: int
keep_temp: bool
use_rpm_opt_flags: bool
rpm3_mode: bool
no_autoreq: bool
force_arch: Incomplete
quiet: int
quiet: bool
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def finalize_package_data(self) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/setuptools/_distutils/command/build.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from ..cmd import Command
def show_compilers() -> None: ...

class build(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
Expand All @@ -20,7 +20,7 @@ class build(Command):
compiler: Incomplete
plat_name: Incomplete
debug: Incomplete
force: int
force: bool
executable: Incomplete
parallel: Incomplete
def initialize_options(self) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/setuptools/_distutils/command/build_clib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from typing import ClassVar
from ..cmd import Command

class build_clib(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str, str]]]
boolean_options: ClassVar[list[str]]
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
Expand All @@ -16,7 +16,7 @@ class build_clib(Command):
define: Incomplete
undef: Incomplete
debug: Incomplete
force: int
force: bool
compiler: Incomplete
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/setuptools/_distutils/command/build_ext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from ..cmd import Command
from ..extension import Extension

class build_ext(Command):
description: str
description: ClassVar[str]
sep_by: Incomplete
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
Expand All @@ -15,7 +15,7 @@ class build_ext(Command):
build_lib: Incomplete
plat_name: Incomplete
build_temp: Incomplete
inplace: int
inplace: bool
package: Incomplete
include_dirs: Incomplete
define: Incomplete
Expand Down
6 changes: 3 additions & 3 deletions stubs/setuptools/setuptools/_distutils/command/build_py.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command

class build_py(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
Expand All @@ -13,8 +13,8 @@ class build_py(Command):
package: Incomplete
package_data: Incomplete
package_dir: Incomplete
compile: int
optimize: int
compile: bool
optimize: bool
force: Incomplete
def initialize_options(self) -> None: ...
packages: Incomplete
Expand Down
10 changes: 5 additions & 5 deletions stubs/setuptools/setuptools/_distutils/command/install.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command

class install(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
Expand All @@ -26,10 +26,10 @@ class install(Command):
compile: Incomplete
optimize: Incomplete
extra_path: Incomplete
install_path_file: int
force: int
skip_build: int
warn_dir: int
install_path_file: bool
force: bool
skip_build: bool
warn_dir: bool
build_base: Incomplete
build_lib: Incomplete
record: Incomplete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command

class install_data(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: Incomplete
install_dir: Incomplete
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, MaybeNone
from typing import ClassVar

from ..cmd import Command

class install_lib(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
install_dir: Incomplete
build_dir: Incomplete
force: int
force: bool
compile: Incomplete
optimize: Incomplete
skip_build: Incomplete
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def build(self) -> None: ...
def install(self) -> list[str]: ...
def install(self) -> list[str] | MaybeNone: ...
def byte_compile(self, files) -> None: ...
def get_outputs(self): ...
def get_inputs(self): ...
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ from typing import ClassVar
from ..cmd import Command

class install_scripts(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
install_dir: Incomplete
force: int
force: bool
build_dir: Incomplete
skip_build: Incomplete
def initialize_options(self) -> None: ...
Expand Down
12 changes: 6 additions & 6 deletions stubs/setuptools/setuptools/_distutils/command/sdist.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class sdist(Command):
READMES: ClassVar[tuple[str, ...]]
template: Incomplete
manifest: Incomplete
use_defaults: int
prune: int
manifest_only: int
force_manifest: int
use_defaults: bool
prune: bool
manifest_only: bool
force_manifest: bool
formats: Incomplete
keep_temp: int
keep_temp: bool
dist_dir: Incomplete
archive_files: Incomplete
metadata_check: int
metadata_check: int # Soon to be updated to boolean upstream
owner: Incomplete
group: Incomplete
def initialize_options(self) -> None: ...
Expand Down
7 changes: 6 additions & 1 deletion stubs/setuptools/setuptools/_distutils/compat/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
def consolidate_linker_args(args: list[str]) -> str | list[str]: ...
from collections.abc import Iterable
from typing import TypeVar

_IterableT = TypeVar("_IterableT", bound=Iterable[str])

def consolidate_linker_args(args: _IterableT) -> _IterableT | str: ...
Loading