dynadocΒΆ
π A Python library package which bridges the gap between rich annotations and automatic documentation generation with configurable renderers and support for reusable fragments.
Key Features βΒΆ
π Docstring Generation: Generation of docstrings for modules, classes, functions, and methods via introspection with fine-grained control.
π§© Fragment System: Reusable documentation snippets for consistent terminology across projects.
π·οΈ Annotation Metadata: Extraction and inclusion of metadata from annotations into generated docstrings.
π Extensible Architecture: Custom renderers, attribute visibility rules, and introspection limiters.
π Sphinx-Compatible Output: Render reStructuredText docstrings that work with Sphinx Autodoc out of the box.
π¨ Configurable Renderers: Ability to extend with other renderers as desired.
Installation π¦ΒΆ
Via uv pip
command:
uv pip install dynadoc
Or, via pip:
pip install dynadoc
Examples π‘ΒΆ
Please see the examples directory.
Function Documentation:
import dynadoc
from typing import Annotated
@dynadoc.with_docstring( )
def process_api_data(
endpoint: Annotated[ str, dynadoc.Doc( "API endpoint URL to query" ) ],
timeout: Annotated[ float, dynadoc.Doc( "Request timeout in seconds" ) ] = 30.0,
) -> Annotated[ dict, dynadoc.Doc( "Processed API response data" ) ]:
''' Process data from API endpoint with configurable timeout. '''
return { }
Which will be turned into the following docstring on the function by the default renderer:
Process data from API endpoint with configurable timeout.
:argument endpoint: API endpoint URL to query
:type endpoint: str
:argument timeout: Request timeout in seconds
:type timeout: float
:returns: Processed API response data
:rtype: dict
Module Documentation:
Document all annotated attributes in current module:
import dynadoc
dynadoc.assign_module_docstring( __name__ )