{"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":[{"note":"Correct import path; no known alternative mistakes.","wrong":"from class_doc import attr_doc","symbol":"attr_doc","correct":"from class_doc import attr_doc"}],"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,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from class_doc import attr_doc'.","cause":"Incorrect import path: using 'import class_doc' instead of 'from class_doc import attr_doc'.","error":"AttributeError: module 'class_doc' has no attribute 'attr_doc'"},{"fix":"Upgrade to latest version: pip install class-doc --upgrade","cause":"The parameter was added in a later version; using an older version of class-doc (pre-0.2.0).","error":"TypeError: attr_doc() got an unexpected keyword argument 'include_inherited'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}