Skip to content

Commit c53af98

Browse files
authored
Merge pull request #434 from bluetech/typing4
Export pluggy's typing
2 parents 1b1042e + 62da97c commit c53af98

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

changelog/428.feature.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Pluggy now exposes its typings to static type checkers.
2+
3+
As part of this, the following changes are made:
4+
5+
- Renamed ``_Result`` to ``Result``, and exported as :class:`pluggy.Result`.
6+
- Renamed ``_HookRelay`` to ``HookRelay``, and exported as :class:`pluggy.HookRelay`.
7+
- Renamed ``_HookCaller`` to ``HookCaller``, and exported as :class:`pluggy.HookCaller`.
8+
- Exported ``HookImpl`` as :class:`pluggy.HookImpl`.
9+
- Renamed ``_HookImplOpts`` to ``HookimplOpts``, and exported as :class:`pluggy.HookimplOpts`.
10+
- Renamed ``_HookSpecOpts`` to ``HookspecOpts``, and exported as :class:`pluggy.HookspecOpts`.
11+
- Some fields and classes are marked ``Final`` and ``@final``.
12+
- The :ref:`api-reference` is updated to clearly delineate pluggy's public API.
13+
14+
Compatibility aliases are put in place for the renamed types.
15+
We do not plan to remove the aliases, but we strongly recommend to only import from ``pluggy.*`` to ensure future compatibility.
16+
17+
Please note that pluggy is currently unable to provide strong typing for hook calls, e.g. ``pm.hook.my_hook(...)``,
18+
nor to statically check that a hook implementation matches the hook specification's type.

docs/api_reference.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
:orphan:
22

3+
.. _`api-reference`:
4+
35
API Reference
46
=============
57

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ dev =
4242
testing =
4343
pytest
4444
pytest-benchmark
45+
[options.package_data]
46+
pluggy = py.typed
4547

4648
[devpi:upload]
4749
formats=sdist.tgz,bdist_wheel

src/pluggy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
__version__ = "unknown"
77

88
__all__ = [
9+
"__version__",
910
"PluginManager",
1011
"PluginValidationError",
1112
"HookCaller",

src/pluggy/_tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from typing import Tuple
1010

1111

12-
_Writer = Callable[[str], None]
13-
_Processor = Callable[[Tuple[str, ...], Tuple[Any, ...]], None]
12+
_Writer = Callable[[str], object]
13+
_Processor = Callable[[Tuple[str, ...], Tuple[Any, ...]], object]
1414

1515

1616
class TagTracer:

src/pluggy/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)