Skip to main content

Griffe Inherited Docstrings

ci documentation pypi version gitter

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

Silver sponsors

FastAPI

Bronze sponsors

Nixtla


ofek samuelcolvin tlambert03 ssbarnea femtomc cmarqu kolenaIO ramnes machow BenHammersley trevorWieland MarcoGorelli analog-cbarber OdinManiac rstudio-sponsorship schlich butterlyn livingbio NemetschekAllplan EricJayHartman 15r10nk activeloopai roboflow cmclaughlin RapidataAI rodolphebarbanneau theSymbolSyndicate blakeNaccarato ChargeStorm Cusp-AI

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)

Source distribution for griffe-inherited-docstrings 1.1.4
File Size Uploaded
griffe_inherited_docstrings-1.1.4.tar.gz 32.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for griffe-inherited-docstrings 1.1.4
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page