Parse Sphinx-comments above attributes as docstrings.
Project description
Griffe Sphinx
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file griffe_sphinx-0.2.0.tar.gz.
File metadata
- Download URL: griffe_sphinx-0.2.0.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c53e94d3b6c795d46ddba3959e66d8b062176aafef29b8707ec0a09d35b68e5d
|
|
| MD5 |
d3ff6c240fe13ffed659ad9d62e70687
|
|
| BLAKE2b-256 |
c3ded9fe6000fb734fc8a1747cc62c9211a9e370b701dac4fc114f377b68fb8c
|
File details
Details for the file griffe_sphinx-0.2.0-py3-none-any.whl.
File metadata
- Download URL: griffe_sphinx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9599f82c3795e24c00c2e844ce7bf029112a3fab26a3bdada4f10eb85493f7bf
|
|
| MD5 |
f763b77863e4220a4dfc0e5f2f1a97ab
|
|
| BLAKE2b-256 |
9f4c5d4fb1b89f3fed1c7d19bd077263b01d6c16ac7a2f20efbdfae16dfe75da
|