attributes-doc
PEP 224 implementation
What it is and what it does
attributes-doc provides a decorator and utility functions to capture and store docstrings written immediately after class attributes, making them accessible at runtime as special attributes or via helper functions. It implements PEP 224, which proposed a syntax for documenting individual class members. The package works by scanning a class definition, extracting docstrings that follow attribute assignments, and storing them either as `__doc_ATTRNAME__` attributes on the class or in a dictionary returned by a query function.
The package offers four main entry points: a `@attributes_doc` decorator for regular classes, a `get_attributes_doc()` function to extract docs without modifying a class, an `@enum_doc` decorator for Enum classes that attaches docs to individual enum members, and a `get_doc()` helper to retrieve a single attribute's docstring. It has no runtime dependencies and supports Python 3.8 through 3.12.
Use it for:
- Generate API documentation or help text from class attribute docstrings at runtime
- Build introspectable data models where each field carries its own documentation
- Decorate Enum classes to attach descriptions to each enum value for user-facing displays
- Extract attribute metadata for validation, serialization, or schema generation tools
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extracts and stores docstrings for class attributes at runtime, implementing PEP 224 to make attribute documentation programmatically accessible via decorator or function call.
Yes, if you need to attach and retrieve docstrings for class attributes at runtime. The package is lightweight, has no dependencies, and works on current Python versions. The dormant maintenance status is a minor concern for a small, stable utility—suitable for projects that don't require active development, but verify it fits your documentation workflow before adopting.
Install
attributes-doc on PyPI
pip
pip install attributes-docuv
uv add attributes-docpoetry
poetry add attributes-docInstalling attributes-doc
Before you install
Low install friction with no runtime dependencies. Dormant maintenance since January 2024 (948 days), though the repository remains active and supports current Python versions (3.8–3.12).
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open and closed projects.
Quickstart
pip install attributes-doc
from attributes_doc import attributes_doc
@attributes_doc
class Foo:
bar = 1
"""Docstring for bar."""
print(Foo.__doc_bar__)
Verify before relying
- Whether the package is actively maintained or accepting contributions despite dormant status
- Real-world adoption rate beyond the 439416 monthly downloads figure
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 948 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 439,416/month — #6,656 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: attributes_doc-0.4.0-py2.py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
enum-toolsProvides utilities to enhance Python's enum…
copyleft · top 5,000 on PyPI
docformatterAutomatically formats Python docstrings to…
permissive · top 5,000 on PyPI
docrepDocrep provides utilities to intelligently…
permissive · top 15,000 on PyPI
pydocstringformatterAutomatically formats Python docstrings to…
permissive · top 15,000 on PyPI
docstr-coverageMeasures docstring coverage in Python source…
permissive · top 15,000 on PyPI
docstring-inheritanceAutomatically inherits docstrings from parent…
permissive · top 15,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
mkdocstrings-python-legacyA legacy Python documentation handler for…
permissive · top 15,000 on PyPI
nameofRetrieves the name of a variable or attribute…
permissive · top 15,000 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI