Annotated Doc

raw JSON →
0.0.4 verified Tue May 12 auth: no python install: verified quickstart: verified

A Python library that enables inline documentation of parameters, class attributes, return types, and variables using the `Annotated` type hint. Current version: 0.0.4. Release cadence: irregular, with the latest release on November 10, 2025.

pip install annotated-doc
error ModuleNotFoundError: No module named 'annotated_doc'
cause The 'annotated-doc' package is not installed or is installed under a different name.
fix
Install the package using 'pip install annotated-doc'.
error ImportError: cannot import name 'Annotated' from 'typing'
cause The 'Annotated' type hint is not available in Python versions earlier than 3.9.
fix
Upgrade to Python 3.9 or later, or install the 'typing-extensions' package and import 'Annotated' from it.
error ImportError: cannot import name 'Doc' from 'annotated_doc'
cause The 'Doc' class is not found in the 'annotated_doc' module, possibly due to an incorrect import statement.
fix
Ensure the correct import statement: 'from annotated_doc import Doc'.
error TypeError: 'type' object is not subscriptable
cause This error typically arises when attempting to use built-in types (e.g., `list`, `dict`) directly as generic types (e.g., `list[int]`) in Python versions prior to 3.9. In such versions, generic types must be imported from the `typing` module (e.g., `typing.List[int]`). Since `annotated-doc` uses `Annotated[Type, Doc(...)]`, an incorrectly subscripted `Type` within `Annotated` for older Python versions will trigger this error.
fix
For Python versions prior to 3.9, use generic types imported from the typing module (e.g., from typing import List, then Annotated[List[int], Doc(...)]). For Python 3.9 and later, list[int] is valid.
breaking The `Doc` class is located in the `annotated_doc` module, not `annotated-doc` as the package name might suggest.
fix Use `from annotated_doc import Doc` to correctly import the `Doc` class.
gotcha The `Doc` class is intended for inline documentation and should be used within type annotations.
fix Ensure that `Doc` is used within type annotations to document parameters, class attributes, return types, and variables.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.00s 17.8M
3.10 slim (glibc) - - 0.00s 18M
3.11 alpine (musl) - - 0.00s 19.6M
3.11 slim (glibc) - - 0.00s 20M
3.12 alpine (musl) - - 0.00s 11.5M
3.12 slim (glibc) - - 0.00s 12M
3.13 alpine (musl) - - 0.00s 11.1M
3.13 slim (glibc) - - 0.00s 12M
3.9 alpine (musl) - - 0.00s 17.3M
3.9 slim (glibc) - - 0.00s 18M

A simple function demonstrating the use of `Doc` for inline documentation

from typing import Annotated
from annotated_doc import Doc

def greet(name: Annotated[str, Doc('The name of the person to greet')]) -> None:
    print(f'Hello, {name}!')

greet('Alice')