Registry / serialization / annotated-doc

annotated-doc

JSON →
library0.0.4pypypi✓ verified 52d ago

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.

serialization
pip install annotated-doc
Install & Compatibility
Where this runs
tested against v0.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Doc
from annotated_doc import Doc
Ensure correct import path to access the `Doc` class

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')
Debug
Known issues
breakingThe `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.
affects: 0.0.4
gotchaThe `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.
affects: 0.0.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'annotated_doc'
The 'annotated-doc' package is not installed or is installed under a different name.
fix
Install the package using 'pip install annotated-doc'.
ImportError: cannot import name 'Annotated' from 'typing'
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.
ImportError: cannot import name 'Doc' from 'annotated_doc'
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'.
TypeError: 'type' object is not subscriptable
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.
Upgrade
Version history
0.0.4latest on PyPI
Audit
Dependencies
typing-extensionsoptionalProvides support for the `Annotated` type hint in Python versions prior to 3.9
Agent activity
53 hits · last 30 days
node
8
seranking-bot
3
ahrefsbot
2
amazonbot
1
bytedance
1
Resources