{"id":21044,"library":"class-doc","title":"class-doc","description":"A library to extract attributes docstrings defined in various ways, such as class attributes, NamedTuple fields, or dataclass fields. Current version 0.2.6, released 2025-01-29, maintained infrequently.","status":"active","version":"0.2.6","language":"python","source_language":"en","source_url":"https://github.com/danields761/class-doc","tags":["docstrings","attributes","type-annotations","metadata-extraction"],"install":[{"cmd":"pip install class-doc","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Used for Literal type in older Python versions","package":"typing_extensions","optional":true}],"imports":[{"wrong":"from class_doc import attr_doc","symbol":"extract_docs","correct":"from class_doc import extract_docs"},{"symbol":"extract_all_attr_docstrings","correct":"from class_doc import extract_all_attr_docstrings"},{"symbol":"UniversalAssign","correct":"from class_doc import UniversalAssign"}],"quickstart":{"code":"from class_doc import attr_doc\n\nclass Employee:\n    name: str = 'default'  # Employee name\n    age: int = 0           # Age in years\n\n# Extract docstrings\ndocs = attr_doc(Employee)\nprint(docs)\n# {'name': 'Employee name', 'age': 'Age in years'}","lang":"python","description":"Basic usage: annotate class attributes with a comment after a type annotation, then call attr_doc to extract them."},"warnings":[{"fix":"Ensure each attribute is defined as 'name: type = default  # docstring'. The comment must be at the end of the line.","message":"Attribute docstrings must be on the same line as the type annotation and value, after the comma or default value. They are not standard docstrings but trailing comments.","severity":"gotcha","affected_versions":"all"},{"fix":"Add type annotations to all attributes you want to extract docstrings from.","message":"Only works with type-annotated attributes (PEP 526). Attributes without type hints or with only a comment before the variable will be ignored.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternative libraries like 'docstring_parser' or using 'typing.get_type_hints' with comments manually.","message":"The library may not be actively maintained; last release was in 2025. No known deprecations.","severity":"deprecated","affected_versions":"0.2.6"}],"env_vars":null,"search_vec":"'-01':28 '-29':29 '0.2.6':25 '2025':27 'annot':36 'attribut':8,17,33 'class':2,16 'class-doc':1 'current':23 'dataclass':21 'defin':10 'doc':3 'docstr':9,32 'extract':7,39 'field':19,22 'infrequ':31 'librari':5 'maintain':30 'metadata':38 'metadata-extract':37 'namedtupl':18 'releas':26 'type':35 'type-annot':34 'various':12 'version':24 'way':13","created_at":"2026-04-27T16:57:48.003185+00:00","updated_at":"2026-04-27T16:57:48.003185+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.6","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/danields761/class-doc","docs":null,"changelog":null,"pypi":"https://pypi.org/project/class-doc/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}