Skip to content

Commit

Permalink
Docs and changelog for TypedDict tracing.
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Nov 7, 2019
1 parent aebe7de commit 43c98f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
master
------

* Trace per-key value types for dictionaries (up to a configured max size) and
if the traced types are consistent, output a TypedDict in the stub instead of
a homogenous dict. Thanks Pradeep Kumar Srinivasan. Merge of #143, fixes
#105.

* Fix crash with empty tuples. Thanks akayunov for the report, Christophe
Simonis for the simplest-case repro. Fixes #136.

Expand Down
9 changes: 9 additions & 0 deletions doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ Subclassing ``Config`` or ``DefaultConfig``
.. _context manager: https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers
.. _contextlib.contextmanager: https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager

.. method:: max_typed_dict_size() -> int

The maximum size of string-keyed dictionary for which per-key value types
will be stored, and (if the traced keys and value types are consistent), a
`TypedDict` will be emitted instead of `Dict`. Return `0` to disable per-key
type tracking and TypedDict generation.

Defaults to 10.

.. class:: DefaultConfig()

``DefaultConfig`` is the config MonkeyType uses if you don't provide your own;
Expand Down

0 comments on commit 43c98f7

Please sign in to comment.