Document parameters, class attributes, return types, and variables inline, with Annotated.
Actively maintained. Last release 12 days ago, commits in 18 of the last 26 weeks. A safe choice.
pip install annotated-docAnnotated Doc
Document parameters, class attributes, return types, and variables inline, with Annotated.
Installation
pip install annotated-doc
Or with uv:
uv add annotated-doc
Usage
Import Doc and pass a single literal string with the documentation for the specific parameter, class attribute, return type, or variable.
For example, to document a parameter name in a function hi you could do:
from typing import Annotated
from annotated_doc import Doc
def hi(name: Annotated[str, Doc("Who to say hi to")]) -> None:
print(f"Hi, {name}!")
You can also use it to document class attributes:
from typing import Annotated
from annotated_doc import Doc
class User:
name: Annotated[str, Doc("The user's name")]
age: Annotated[int, Doc("The user's age")]
The same way, you could document return types and variables, or anything that could have a type annotation with Annotated.
Who Uses This
annotated-doc was made for: