API Reference¶
Demo classes: Speaker and Greeting¶
This package contains minimal examples to demonstrate how Sphinx does and doesn’t allow you to
handle circular imports in type hints, and where mypy may differ in its approach to
the typing.TYPE_CHECKING conditional block versus sphinx-autodoc-typehints (which
turns this flag on when set_type_checking_flag is set to True in docs/conf.py).
sphinx_demo provides a single class Speaker,
with a method, set_new_greeting, which takes an instance of the class
Greeting and stores it in the greeting attribute.
This instance retains a reference to the ‘parent’ instance of
class Speaker, creating a circular type reference which breaks
the Sphinx build when using the sphinx-autodoc-typehints extension.