Griffe Inherited Docstrings
Griffe extension for inheriting docstrings.
Installation
pip install griffe-inherited-docstrings
Usage
With Python:
import griffe
griffe.load("...", extensions=griffe.load_extensions(["griffe_inherited_docstrings"]))
With MkDocs and mkdocstrings:
plugins:
- mkdocstrings:
handlers:
python:
options:
extensions:
- griffe_inherited_docstrings
The extension will iterate on every class and their members to set docstrings from parent classes when they are not already defined.
The extension accepts a merge option, that when set to true
will actually merge all parent docstrings in the class hierarchy
to the child docstring, if any.
plugins:
- mkdocstrings:
handlers:
python:
options:
extensions:
- griffe_inherited_docstrings:
merge: true
class A:
def method(self):
"""Method in A."""
class B(A):
def method(self):
...
class C(B):
...
class D(C):
def method(self):
"""Method in D."""
class E(D):
def method(self):
"""Method in E."""
With the code above, docstrings will be merged like following:
| Class | Method docstring |
|---|---|
A |
Method in A. |
B |
Method in A. |
C |
Method in A. |
D |
Method in A. Method in D. |
E |
Method in A. Method in D. Method in E. |
WARNING: Limitation This extension runs once on whole packages. There is no way to toggle merging or simple inheritance for specific objects.
Sponsors
And 4 more private sponsor(s).
Metadata
Release files for griffe-inherited-docstrings 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| griffe_inherited_docstrings-1.1.4.tar.gz | 32.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| griffe_inherited_docstrings-1.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.4 kB
Release files / griffe_inherited_docstrings-1.1.4.tar.gz
| Download URL | griffe_inherited_docstrings-1.1.4.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac98890a4505d986254302325959de6c82716968ec499aca009cb91c1d75eecb
|
|
BLAKE2b-256 checksum How to use checksums |
32611dd4a7c59618c5e9ee0f61eb9fb934ba11163fa66932c8e2cc99d74f3d7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / griffe_inherited_docstrings-1.1.4-py3-none-any.whl
| Download URL | griffe_inherited_docstrings-1.1.4-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c813c567f6f7396d6e1a78575fb7ad0d5b472fc02c1b782f830fcf26ab7254d
|
|
BLAKE2b-256 checksum How to use checksums |
3435364ed24b4cba404a6f02998b381c872f99480a26f0c57687537578d4b5ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|