sphinx autosummary extension to properly format pandas or xarray accessors
Project description
sphinx-autosummary-accessors
A sphinx extension to properly document pandas or xarray accessors.
sphinx.ext.autosummary is able to create summary and object pages for objects and their methods, but it doesn’t work well with accessor styled properties and methods (obj.accessor.attribute). pandas has accessor documentation built using sphinx.ext.autosummary templates, which xarray recently adopted by copying the templates and all related code.
To avoid even more duplicated code, and to make it easier for projects to document their custom accessors, this project aims to provide this functionality by way of a sphinx extension.
Most of the code was adapted from pandas.
Usage
Using it should be as simple as adding
import sphinx_autosummary_accessors
extensions = [
...,
"sphinx_autosummary_accessors",
]
templates = ["_templates", ..., sphinx_autosummary_accessors.templates_path]
to your conf.py and using the appropriate template:
.. autosummary::
:template: autosummary/accessor_method.rst
Example.test.multiply
Documentation
For more information and examples, see the documentation.
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
Built Distribution
File details
Details for the file sphinx-autosummary-accessors-2022.4.0.tar.gz
.
File metadata
- Download URL: sphinx-autosummary-accessors-2022.4.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7397469cf90a6e81602eccaf9f91015c902a82954f878d853b48971b60db8490 |
|
MD5 | d8b807be4e15ec68d001cdeefd20a473 |
|
BLAKE2b-256 | 56461bca68d509654112f8d3f1ef9a3aad71227c0a4525b5d27d3c2bc87c5c4f |
File details
Details for the file sphinx_autosummary_accessors-2022.4.0-py3-none-any.whl
.
File metadata
- Download URL: sphinx_autosummary_accessors-2022.4.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b0e152deda1fb78244edb4bc8ce3246e00434f807475280fbedc6865f1358d4 |
|
MD5 | 0582b195e13b2f0a0638f5cc66117cba |
|
BLAKE2b-256 | 13294b202d0c77687653c531c62256b18d493892850fa408e547c7c25368e6a9 |