skillfed

attributes-doc

PEP 224 implementation

attributes-doc v0.4.0 439.4K downloads/30d#6,656 on PyPI10
Permissive license MIT DORMANT released

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-doc

uv

uv add attributes-doc

poetry

poetry add attributes-doc

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

attribute docstrings runtimePEP 224 implementationclass attribute documentationextract attribute docsenum member docstringsattribute metadata decorator
documentationintrospectionmetadata

More Python Modules packages