-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: typing support for helpers (#2588)
* feat: basic typing support * docs: mention syncing as suggested by @rwgk * docs: update changelog * docs: copy of warning in limitations
- Loading branch information
Showing
15 changed files
with
114 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
recursive-include pybind11/include/pybind11 *.h | ||
recursive-include pybind11 *.py | ||
recursive-include pybind11 py.typed | ||
recursive-include pybind11 *.pyi | ||
include pybind11/share/cmake/pybind11/*.cmake | ||
include LICENSE README.rst pyproject.toml setup.py setup.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import Union, Tuple | ||
|
||
def _to_int(s: str) -> Union[int, str]: ... | ||
|
||
__version__: str | ||
version_info: Tuple[Union[int, str], ...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# IMPORTANT: Should stay in sync with setup_helpers.py (mostly checked by CI / | ||
# pre-commit). | ||
|
||
from typing import Any, Iterator, Optional, Type, TypeVar, Union | ||
from types import TracebackType | ||
|
||
from distutils.command.build_ext import build_ext as _build_ext # type: ignore | ||
from distutils.extension import Extension as _Extension | ||
import distutils.ccompiler | ||
import contextlib | ||
|
||
WIN: bool | ||
PY2: bool | ||
MACOS: bool | ||
STD_TMPL: str | ||
|
||
class Pybind11Extension(_Extension): | ||
def _add_cflags(self, *flags: str) -> None: ... | ||
def _add_lflags(self, *flags: str) -> None: ... | ||
def __init__( | ||
self, *args: Any, cxx_std: int = 0, language: str = "c++", **kwargs: Any | ||
) -> None: ... | ||
@property | ||
def cxx_std(self) -> int: ... | ||
@cxx_std.setter | ||
def cxx_std(self, level: int) -> None: ... | ||
|
||
@contextlib.contextmanager | ||
def tmp_chdir() -> Iterator[str]: ... | ||
def has_flag(compiler: distutils.ccompiler.CCompiler, flag: str) -> bool: ... | ||
def auto_cpp_level(compiler: distutils.ccompiler.CCompiler) -> Union[int, str]: ... | ||
|
||
class build_ext(_build_ext): # type: ignore | ||
def build_extensions(self) -> None: ... | ||
|
||
T = TypeVar("T", bound="ParallelCompile") | ||
|
||
class ParallelCompile: | ||
def __init__( | ||
self, envvar: Optional[str] = None, default: int = 0, max: int = 0 | ||
): ... | ||
def function(self) -> Any: ... | ||
def install(self: T) -> T: ... | ||
def __enter__(self: T) -> T: ... | ||
def __exit__( | ||
self, | ||
exc_type: Optional[Type[BaseException]], | ||
exc_value: Optional[BaseException], | ||
traceback: Optional[TracebackType], | ||
) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,7 @@ ignore = | |
N813 | ||
# Black conflict | ||
W503, E203 | ||
|
||
[mypy] | ||
files = pybind11 | ||
strict = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters