Skip to content

Commit 407eeaa

Browse files
max-muotoAvasam
andauthored
Correct types for setuptools.setup (#12791)
Co-authored-by: Avasam <[email protected]>
1 parent a5174d8 commit 407eeaa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

stubs/setuptools/setuptools/__init__.pyi

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from _typeshed import Incomplete, StrPath
22
from abc import abstractmethod
33
from collections.abc import Iterable, Mapping, Sequence
4-
from typing import Any, Literal, TypeVar, overload
4+
from typing import Any, Literal, TypedDict, TypeVar, overload, type_check_only
5+
from typing_extensions import NotRequired
56

67
from ._distutils.cmd import Command as _Command
78
from .command.alias import alias
@@ -45,6 +46,14 @@ __all__ = [
4546

4647
__version__: str
4748

49+
@type_check_only
50+
class _BuildInfo(TypedDict):
51+
sources: list[str] | tuple[str, ...]
52+
obj_deps: NotRequired[dict[str, list[str] | tuple[str, ...]]]
53+
macros: NotRequired[list[tuple[str] | tuple[str, str | None]]]
54+
include_dirs: NotRequired[list[str]]
55+
cflags: NotRequired[list[str]]
56+
4857
# Pytype fails with the following:
4958
# find_packages = PackageFinder.find
5059
# find_namespace_packages = PEP420PackageFinder.find
@@ -85,7 +94,8 @@ def setup(
8594
command_options: Mapping[str, Mapping[str, tuple[Incomplete, Incomplete]]] = ...,
8695
package_data: Mapping[str, list[str]] = ...,
8796
include_package_data: bool = ...,
88-
libraries: list[str] = ...,
97+
# libraries for `Distribution` or `build_clib`, not `Extension`, `build_ext` or `CCompiler`
98+
libraries: list[tuple[str, _BuildInfo]] = ...,
8999
headers: list[str] = ...,
90100
ext_package: str = ...,
91101
include_dirs: list[str] = ...,

0 commit comments

Comments
 (0)