Skip to content

docs

Utilities for exporting packaged MADA Tools documentation sources.

Wheels contain a generated mada_tools/_docs resource tree created from the repository's top-level docs/, configs/, and mkdocs.yaml files at build time. This module exposes that packaged MkDocs project to downstream packages without assuming they have a MADA Tools source checkout available.

export_docs(destination)

Copy the packaged documentation source tree to a destination directory.

Parameters:

Name Type Description Default
destination PathLike

Directory that will receive the exported documentation project, including mkdocs.yaml and the docs/ source tree.

required

Returns:

Type Description
Path

The resolved destination path.

Source code in mada_tools/docs.py
def export_docs(destination: PathLike) -> Path:
    """Copy the packaged documentation source tree to a destination directory.

    Args:
        destination: Directory that will receive the exported documentation
            project, including ``mkdocs.yaml`` and the ``docs/`` source tree.

    Returns:
        The resolved destination path.
    """
    destination_path = Path(destination).expanduser().resolve()
    docs_root = resources.files("mada_tools").joinpath(_DOCS_RESOURCE_NAME)

    if not docs_root.is_dir():
        raise FileNotFoundError("Packaged documentation resources were not found.")

    _copy_resource_tree(docs_root, destination_path)
    return destination_path