{"id":23625,"library":"docstring-inheritance","title":"docstring-inheritance","description":"Avoid writing and maintaining duplicated docstrings by automatically inheriting and merging docstrings from parent classes. Current version 3.0.0, requires Python >=3.10 <4.0. Active development with infrequent releases.","status":"active","version":"3.0.0","language":"python","source_language":"en","source_url":"https://github.com/AntoineD/docstring-inheritance","tags":["docstring","inheritance","decorator","documentation"],"install":[{"cmd":"pip install docstring-inheritance","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Function name is plural (inherit_docstrings), not singular.","wrong":"from docstring_inheritance import inherit_docstring","symbol":"inherit_docstrings","correct":"from docstring_inheritance import inherit_docstrings"}],"quickstart":{"code":"from docstring_inheritance import inherit_docstrings\n\nclass Base:\n    def method(self, x: int, y: str) -> bool:\n        \"\"\"Do something.\n\n        Parameters\n        ----------\n        x : int\n            First parameter.\n        y : str\n            Second parameter.\n\n        Returns\n        -------\n        bool\n            Result.\n        \"\"\"\n        return True\n\n@inherit_docstrings\nclass Child(Base):\n    def method(self, x: int, y: str) -> bool:\n        # Only the extra information is added here; docstring is inherited.\n        return True\n\nprint(Child.method.__doc__)","lang":"python","description":"Apply the @inherit_docstrings decorator to a class to inherit docstrings from parent classes. Child class methods will automatically merge the parent's docstring with any new content."},"warnings":[{"fix":"Apply @inherit_docstrings to each class that should inherit docstrings. Or set a global flag if supported (check docs).","message":"In version 3.0.0, the default behavior changed to not inherit docstrings automatically unless the @inherit_docstrings decorator is explicitly applied. Previously, in version 2.x, docstring inheritance happened automatically for all subclasses. Update your code to add the decorator.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use 'from docstring_inheritance import inherit_docstrings' instead.","message":"The 'inherit_docstring' (singular) function was deprecated in favor of 'inherit_docstrings' (plural) in version 2.x and removed in 3.0.0.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Apply @inherit_docstrings to the class definition, not to individual methods.","message":"The decorator only works on classes, not on individual methods. If you apply it to a method, it will be silently ignored or raise an error.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from docstring_inheritance import inherit_docstrings' (plural).","cause":"Using the singular import name which was removed in version 3.0.0.","error":"ImportError: cannot import name 'inherit_docstring' from 'docstring_inheritance'"},{"fix":"Apply the decorator to the class definition, e.g., @inherit_docstrings class Child(Base): ...","cause":"Applying @inherit_docstrings to a method instead of a class. The decorator returns None when applied to a method.","error":"TypeError: 'NoneType' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}