Skip to content

Commit

Permalink
Deprecated the profiler hook
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Oct 22, 2019
1 parent 4f948d0 commit 81f309c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Three principal ways to do type checking are provided, each with its pros and co

* automatically type checks yields and sends of returned generators (regular and async)
* adds an extra frame to the call stack for every call to a decorated function
#. the stack profiler hook (``with TypeChecker('packagename'):``):
#. the stack profiler hook (``with TypeChecker('packagename'):``) (deprecated):

* emits warnings instead of raising ``TypeError``
* requires very few modifications to the code
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ yields and sends of an async generator (annotated with :class:`~typing.AsyncGene
Using the profiler hook
-----------------------

.. deprecated:: 2.6
Use the import hook instead. The profiler hook will be removed in v3.0.

This type checking approach requires no code changes, but does come with a number of drawbacks.
It relies on setting a profiler hook in the interpreter which gets called every time a new Python
stack frame is entered or exited.
Expand Down
1 change: 1 addition & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This library adheres to `Semantic Versioning 2.0 <https://semver.org/#semantic-v
**UNRELEASED**

- Added a :pep:`302` import hook for annotating functions and classes with ``@typechecked``
- Deprecated ``TypeChecker`` (will be removed in v3.0)

**2.5.1** (2019-09-26)

Expand Down
3 changes: 3 additions & 0 deletions typeguard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,9 @@ class TypeChecker:
:param all_threads: ``True`` to check types in all threads created while the checker is
running, ``False`` to only check in the current one
:param forward_refs_policy: how to handle unresolvable forward references in annotations
.. deprecated:: 2.6
Use :func:`~.importhook.install_import_hook` instead. This class will be removed in v3.0.
"""

def __init__(self, packages: Union[str, Sequence[str]], *, all_threads: bool = True,
Expand Down

0 comments on commit 81f309c

Please sign in to comment.