Skip to content

Improve typing of sysconfig.get_config_var(s) #11454

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 5 commits into from
Feb 22, 2024
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
11 changes: 10 additions & 1 deletion stdlib/distutils/sysconfig.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
from collections.abc import Mapping
from distutils.ccompiler import CCompiler
from typing import Literal, overload
from typing_extensions import deprecated

PREFIX: str
EXEC_PREFIX: str
Expand All @@ -10,8 +12,15 @@ project_base: str
python_build: bool

def expand_makefile_vars(s: str, vars: Mapping[str, str]) -> str: ...
@overload
@deprecated("SO is deprecated, use EXT_SUFFIX. Support is removed in Python 3.11")
def get_config_var(name: Literal["SO"]) -> int | str | None: ...
@overload
def get_config_var(name: str) -> int | str | None: ...
def get_config_vars(*args: str) -> Mapping[str, int | str]: ...
@overload
def get_config_vars() -> dict[str, str | int]: ...
@overload
def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: str | None = None) -> str: ...
Expand Down
7 changes: 6 additions & 1 deletion stdlib/sysconfig.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import IO, Any, Literal, overload
from typing_extensions import deprecated

__all__ = [
"get_config_h_filename",
Expand All @@ -15,11 +16,15 @@ __all__ = [
"parse_config_h",
]

@overload
@deprecated("SO is deprecated, use EXT_SUFFIX. Support is removed in Python 3.11")
def get_config_var(name: Literal["SO"]) -> Any: ...
@overload
def get_config_var(name: str) -> Any: ...
@overload
def get_config_vars() -> dict[str, Any]: ...
@overload
def get_config_vars(arg: str, *args: str) -> list[Any]: ...
def get_config_vars(arg: str, /, *args: str) -> list[Any]: ...
def get_scheme_names() -> tuple[str, ...]: ...

if sys.version_info >= (3, 10):
Expand Down
12 changes: 10 additions & 2 deletions stubs/setuptools/setuptools/_distutils/sysconfig.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from collections.abc import Mapping
from typing import Literal, overload
from typing_extensions import deprecated

from setuptools._distutils.ccompiler import CCompiler

PREFIX: str
EXEC_PREFIX: str

@overload
@deprecated("SO is deprecated, use EXT_SUFFIX. Support will be removed when this module is synchronized with stdlib Python 3.11")
def get_config_var(name: Literal["SO"]) -> int | str | None: ...
@overload
def get_config_var(name: str) -> int | str | None: ...
def get_config_vars(*args: str) -> Mapping[str, int | str]: ...
@overload
def get_config_vars() -> dict[str, str | int]: ...
@overload
def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...
def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ...
Expand Down