Pydoctor

25.10.1 · active · verified Thu Apr 16

Pydoctor is a standalone API documentation generator that works by static analysis. It was primarily written to replace epydoc for the Twisted project, especially due to epydoc's difficulties with `zope.interface`. It aims to provide comprehensive API documentation for Python projects, supporting various docstring formats like epytext, reStructuredText, Google, and Numpy styles. The current version is 25.10.1 and it is actively maintained.

Common errors

Warnings

Install

Quickstart

Pydoctor is primarily a command-line interface (CLI) tool. This quickstart demonstrates how to create a minimal Python project and generate its API documentation using the `pydoctor` command-line utility. The `--html-output` option specifies the output directory, and the positional arguments are the paths to the Python source to be documented.

# 1. Create a dummy Python package/module
mkdir -p my_project/src/my_lib
echo """"""A simple library.""""" > my_project/src/my_lib/__init__.py
echo """"""A simple module.
def greet(name: str) -> str:
    """Greets the given name.

    :param name: The name to greet.
    :type name: str
    :return: A greeting message.
    :rtype: str
    """
    return f'Hello, {name}!'
""" > my_project/src/my_lib/greeting.py

# 2. Run pydoctor to generate documentation
cd my_project
pydoctor --project-name="My Project API" \
         --project-version="1.0.0" \
         --html-output=docs/api \
         src/my_lib

# 3. View the generated documentation (e.g., open docs/api/index.html)

view raw JSON →