more_autodoc.typevars¶
Documenter for module level typing.TypeVar's, similar to Sphinx’s
autotypevar but with a different appearance.
New in version 1.3.0.
Enable sphinx_toolbox.more_autodoc.typevars by adding the following
to the extensions variable in your conf.py:
extensions = [
...
'sphinx_toolbox.more_autodoc.typevars',
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .
Configuration¶
-
all_typevars¶ - Type:
boolDefault: FalseDocument all
typing.TypeVars, even if they have no docstring.
-
no_unbound_typevars¶ - Type:
boolDefault: TrueOnly document
typing.TypeVars that have a constraint of are bound.This option has no effect if
all_typevarsis False.
Usage¶
-
.. autotypevar::¶ Directive to automatically document a
typing.TypeVar.The output is based on the
autodatadirective, and takes all of its options plus these additional ones:-
:no-value:¶ Don’t show the value of the variable.
-
:value:value (string)¶ Show this instead of the value taken from the Python source code.
-
:no-type:¶ Don’t show the type of the variable.
-
API Reference¶
Classes:
|
Alternative version of |
Functions:
|
Unskip undocumented |
|
-
class
TypeVarDocumenter(directive, name, indent='')[source]¶ Bases:
VariableDocumenterAlternative version of
sphinx.ext.autodoc.TypeVarDocumenterwith better type hint rendering.Specialized Documenter subclass for
typing.TypeVars.Methods:
can_document_member(member, membername, ...)Called to see if a member can be documented by this documenter.
resolve_type(forward_ref)Resolve a
typing.ForwardRefusing the module theTypeVarbelongs to.add_content(more_content[, no_docstring])Add content from docstrings, attribute documentation and user.
add_directive_header(sig)Add the directive's header and options to the generated content.
get_doc([encoding, ignore])Decode and return lines of the docstring(s) for the object.
-
classmethod
can_document_member(member, membername, isattr, parent)[source]¶ Called to see if a member can be documented by this documenter.
-
resolve_type(forward_ref)[source]¶ Resolve a
typing.ForwardRefusing the module theTypeVarbelongs to.- Parameters:
forward_ref (
ForwardRef)- Return type:
-
add_content(more_content, no_docstring=False)[source]¶ Add content from docstrings, attribute documentation and user.
-
classmethod
-
unskip_typevars(app, what, name, obj, skip, options)[source]¶ Unskip undocumented
typing.TypeVars ifall_typevarsisTrue.- Parameters:
app (
Sphinx) – The Sphinx application.what (
str) – The type of the object which the docstring belongs to (one of'module','class','exception','function','method','attribute').name (
str) – The fully qualified name of the object.obj (
Any) – The object itself.skip (
bool) – A boolean indicating if autodoc will skip this member if the user handler does not override the decision.options (
Dict[str,Any]) – The options given to the directive: an object with attributesinherited_members,undoc_members,show_inheritanceandnoindexthat are true if the flag option of same name was given to the auto directive.
- Return type:
-
setup(app)[source]¶ Setup
sphinx_toolbox.more_autodoc.typevars.- Parameters:
app (
Sphinx) – The Sphinx application.- Return type: