Skip to content

Commit 228aef1

Browse files
committed
Document the usage of the subprocess protocol for type checking
1 parent 375b8fc commit 228aef1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/pyproject_hooks.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ It is possible to provide a custom subprocess runner, that behaves differently.
3434

3535
:rtype: None
3636

37+
Since this codebase is currently Python 3.7-compatible, the type annotation for this protocol is only available to type checkers. To annotate a variable as a subprocess runner, you can do something along the lines of:
38+
39+
.. code-block:: python
40+
41+
from typing import TYPE_CHECKING
42+
43+
if TYPE_CHECKING:
44+
from pyproject_hooks import SubprocessRunner
45+
46+
# Example usage
47+
def build(awesome_runner: "SubprocessRunner") -> None:
48+
...
49+
3750
Exceptions
3851
----------
3952

0 commit comments

Comments
 (0)