Introduction
A tool that turns a Python module into a Fumadocs API reference
Fumero is a documentation tool for Python. It reads an importable module with griffe and writes a Fumadocs API reference: one page per module and one per class, alongside the React components that render them.
The reference is generated from the code. Signatures, type annotations and default values are read from the source, and the prose is taken from the docstrings. Nothing is restated by hand, so the reference cannot fall out of step with the code it documents.
What it makes
A function and the docstring already written for it:
def connect(host: str, port: int = 8080) -> Connection:
"""Open a connection to `host`.
Args:
host: The address to connect to.
port: The port to connect on.
Returns:
An open connection.
"""become a page that reads as a reference rather than as a transcript of the source:
Open a connection to host.
parameters
The address to connect to.
The port to connect on.
returns
The types come from the annotations, the default from the signature, and every documented type in it becomes a link to its own page.
Where to go next
Installation
Add fumero to a project and install the components into a docs app.
Generating
Run fumero over a module, and control what reaches the page.
Writing docstrings
The sections fumero reads, and what each one becomes.
Configuration
Every option, and where to declare it.
Fumero documents itself, so the API reference in the sidebar is a worked example of the output as much as it is a reference.