default_values
Sphinx extension to show default values in documentation.
Docs |
|
---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
Overview
This extension shows the default values in autodoc-formatted docstrings.
The default behaviour of autodoc
is to turn this:
def namedlist(name: str = "NamedList") -> Callable: """ A factory function to return a custom list subclass with a name. :param name: The name of the list. :return: """
into this:
domdf_python_tools.bases.
namedlist
(name='NamedList')A factory function to return a custom list subclass with a name.
- Parameters
name (
str
) – The name of the list.- Return type
Callable
With default_values
enabled, the documentation will now look like this:
domdf_python_tools.bases.
namedlist
(name='NamedList')A factory function to return a custom list subclass with a name.
- Parameters
name (
str
) – The name of the list. Default'NamedList'
.- Return type
Callable
Default values are taken from the function/class signature.
They can be overridden using the default
option in the docstring.
The default value can be suppressed using the no-default
option.
No default value is shown if the argument does not have a default value.
The formatting of the default value can be customised using the
default_description_format
option in conf.py
.
By default this is 'Default %s'
.