Registry / testing / docstring-inheritance

docstring-inheritance

JSON →
library3.0.0pypypi✓ verified 85d ago

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.

pip install docstring-inheritance
INSTALL
IMPORT
SIG · DOCSTRING-INHERITA
D
docstring-inheritance
testingpythonv3.0.0
Install
1.6s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

inherit_google_docstring
✓ from docstring_inheritance import inherit_google_docstring
✗ from docstring_inheritance import inherit_docstrings
inherit_numpy_docstring
✓ from docstring_inheritance import inherit_numpy_docstring
✗ from docstring_inheritance import inherit_docstrings
GoogleDocstringInheritanceMeta
✓ from docstring_inheritance import GoogleDocstringInheritanceMeta
✗ from docstring_inheritance import inherit_docstrings

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.

from docstring_inheritance import inherit_docstrings class Base: def method(self, x: int, y: str) -> bool: """Do something. Parameters ---------- x : int First parameter. y : str Second parameter. Returns ------- bool Result. """ return True @inherit_docstrings class Child(Base): def method(self, x: int, y: str) -> bool: # Only the extra information is added here; docstring is inherited. return True print(Child.method.__doc__)
Debug
Known issues
breakingIn 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.
fix
Apply @inherit_docstrings to each class that should inherit docstrings. Or set a global flag if supported (check docs).
affects: >=3.0.0
deprecatedThe 'inherit_docstring' (singular) function was deprecated in favor of 'inherit_docstrings' (plural) in version 2.x and removed in 3.0.0.
fix
Use 'from docstring_inheritance import inherit_docstrings' instead.
affects: >=3.0.0
gotchaThe 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.
fix
Apply @inherit_docstrings to the class definition, not to individual methods.
affects: All
Upgrade
Version history
3.0.0latest on PyPI · released Dec 11, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
docstring-inheritance — pip install docstring-inheritance · libregistry