From 73b240515488fc93e0d98eaca950e5cab8a122ce Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 21 Apr 2025 12:56:47 -0400 Subject: [PATCH] Add attribute types for setuptools --- distutils/command/install.py | 10 +++++----- distutils/dist.py | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/distutils/command/install.py b/distutils/command/install.py index dc17e56a..50c04f1c 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -264,12 +264,12 @@ def initialize_options(self) -> None: # supplied by the user, they are filled in using the installation # scheme implied by prefix/exec-prefix/home and the contents of # that installation scheme. - self.install_purelib = None # for pure module distributions - self.install_platlib = None # non-pure (dists w/ extensions) - self.install_headers = None # for C/C++ headers + self.install_purelib: str | None = None # for pure module distributions + self.install_platlib: str | None = None # non-pure (dists w/ extensions) + self.install_headers: str | None = None # for C/C++ headers self.install_lib: str | None = None # set to either purelib or platlib - self.install_scripts = None - self.install_data = None + self.install_scripts: str | None = None + self.install_data: str | None = None self.install_userbase = USER_BASE self.install_usersite = USER_SITE diff --git a/distutils/dist.py b/distutils/dist.py index 37b788df..f75b6919 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -45,6 +45,7 @@ # type-only import because of mutual dependence between these modules from .cmd import Command + from .extension import Extension _CommandT = TypeVar("_CommandT", bound="Command") _OptionsList: TypeAlias = list[ @@ -220,18 +221,18 @@ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # no # These options are really the business of various commands, rather # than of the Distribution itself. We provide aliases for them in # Distribution as a convenience to the developer. - self.packages = None + self.packages: list[str] | None = None self.package_data: dict[str, list[str]] = {} - self.package_dir = None - self.py_modules = None + self.package_dir: dict[str, str] | None = None + self.py_modules: list[str] | None = None self.libraries = None self.headers = None - self.ext_modules = None + self.ext_modules: list[Extension] | None = None self.ext_package = None self.include_dirs = None self.extra_path = None self.scripts = None - self.data_files = None + self.data_files: list[str | tuple] | None = None self.password = '' # And now initialize bookkeeping stuff that can't be supplied by