Skip to main content

Parse Sphinx-comments above attributes as docstrings.

Project description

Griffe Sphinx

ci documentation pypi version gitter

Parse Sphinx-comments above attributes as docstrings.

Installation

pip install griffe-sphinx

Usage

Griffe Sphinx allows reading Sphinx comments above attribute assignments as docstrings.

# your_module.py

#: Summary of your attribute.
#:
#: This is a longer description of your attribute.
#: You can use any markup in here (Markdown, AsciiDoc, rST, etc.).
#:
#: Be careful with indented blocks: they need 4 spaces plus the initial 1-space indent, so 5.
#:
#:     print("hello!")
your_attribute = "Hello Sphinx!"

This works for module attributes as well as class and instance attributes.

class Hello:
    #: Summary of attribute.
    attr1 = "hello"

    def __init__(self):
        #: Summary of attribute.
        self.attr2 = "sphinx"

Trailing comments (appearing at the end of a line) are not supported.

You can now enable the extension when loading data with Griffe on the command-line, in Python code or with MkDocs.

On the command-line:

griffe dump your_package -e griffe_sphinx

In Python code:

import griffe

data = griffe.load("your_package", extensions=griffe.load_extensions("griffe_sphinx"))

With MkDocs:

plugins:
- mkdocstrings:
    handlers:
      python:
        options:
          extensions:
          - griffe_sphinx

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 blaisep RapidataAI rodolphebarbanneau theSymbolSyndicate blakeNaccarato ChargeStorm Alphadelta14 Cusp-AI

And 7 more private sponsor(s).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

griffe_sphinx-0.2.1.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

griffe_sphinx-0.2.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file griffe_sphinx-0.2.1.tar.gz.

File metadata

  • Download URL: griffe_sphinx-0.2.1.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for griffe_sphinx-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ebb939fbc6bfa4595ff963db5cd6ecd43c1c26a07f57f0243b448a1fa1cc5ad6
MD5 9f0518483dd79e12e590a3243cd44a2b
BLAKE2b-256 eb5494f4f78b211c76c62f09a1b7acbd675a193f2b1b4e3317b57cb09c05a4dd

See more details on using hashes here.

File details

Details for the file griffe_sphinx-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: griffe_sphinx-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for griffe_sphinx-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fc40dcc6a2b96aa2331e64833f9f447ec2c46f4b3a7839cf4866027d14bbab5
MD5 a2e4ecaf3b021f3f848031a6f412acee
BLAKE2b-256 6f5832bc4cc6e3c54a993de0b355c438557786a5e245c63be29604eba8184d88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page