Skip to content
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

Correct types for setuptools.setup #12791

Merged
merged 7 commits into from
Oct 13, 2024
Merged
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
14 changes: 12 additions & 2 deletions stubs/setuptools/setuptools/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, StrPath
from abc import abstractmethod
from collections.abc import Iterable, Mapping, Sequence
from typing import Any, Literal, TypeVar, overload
from typing import Any, Literal, TypedDict, TypeVar, overload, type_check_only
from typing_extensions import NotRequired

from ._distutils.cmd import Command as _Command
from .command.alias import alias
Expand Down Expand Up @@ -45,6 +46,14 @@ __all__ = [

__version__: str

@type_check_only
class _BuildInfo(TypedDict):
sources: list[str] | tuple[str, ...]
obj_deps: NotRequired[dict[str, list[str] | tuple[str, ...]]]
macros: NotRequired[list[tuple[str] | tuple[str, str | None]]]
include_dirs: NotRequired[list[str]]
cflags: NotRequired[list[str]]

# Pytype fails with the following:
# find_packages = PackageFinder.find
# find_namespace_packages = PEP420PackageFinder.find
Expand Down Expand Up @@ -85,7 +94,8 @@ def setup(
command_options: Mapping[str, Mapping[str, tuple[Incomplete, Incomplete]]] = ...,
package_data: Mapping[str, list[str]] = ...,
include_package_data: bool = ...,
libraries: list[str] = ...,
# libraries for `Distribution` or `build_clib`, not `Extension`, `build_ext` or `CCompiler`
libraries: list[tuple[str, _BuildInfo]] = ...,
max-muoto marked this conversation as resolved.
Show resolved Hide resolved
headers: list[str] = ...,
ext_package: str = ...,
include_dirs: list[str] = ...,
Expand Down