Sphinx extension to auto-generate API tree.
Project description
sphinx-apitree
apitree
is a small library to generate a ready-to-use documentation with minimal friction!
apitree
takes care of everything, so you can only focus on the code.
Usage
In docs/conf.py
, replace everything by:
import apitree
apitree.make_project(
# e.g. `import visu3d as v3d` -> {'v3d': 'visu3d'}
project_name={'alias': 'my_module'},
globals=globals(),
)
Then to generate the doc:
sphinx-build -b html docs/ docs/_build
To add api/my_module/index
somewhere in your toctree, like:
..toctree:
:caption: API
api/my_module/index
Features
- Theme
- Auto-generate the API tree, with better features
- Do not require
__all__
(smart detect of which symbols are documented) - Add expandable toc tree with all symbols
- Do not require
- ...
Installation in a project
-
In
pyproject.toml
[project.optional-dependencies] # Installed through `pip install .[docs]` docs = [ # Install `apitree` with all extensions (sphinx, theme,...) "sphinx-apitree[ext]", ]
-
In
.readthedocs.yaml
sphinx: configuration: docs/conf.py python: install: - method: pip path: . extra_requirements: - docs
Options
By default, apitree
tries to infer everything automatically. However there's sometimes
times where the user want to overwrite the default choices.
-
Package vs module: By default, all
__init__.py
define the public API (imports documented), while the modules (module.py
) define the implementation (imports not documented). You can explicitly mark a module as package, so it's import are documented, by adding in the module definition:__apitree__ = dict( is_package=True, )
Examples of projects using apitree
- https://github.com/google-research/visu3d (https://visu3d.readthedocs.io/)
- https://github.com/google-research/dataclass_array (https://dataclass-array.readthedocs.io/)
- https://github.com/google-research/etils (https://etils.readthedocs.io/)
- https://github.com/google-research/kauldron (https://kauldron.readthedocs.io/)
Generated with:
echo start \
&& cd ../visu3d && sphinx-build -b html docs/ docs/_build \
&& cd ../dataclass_array && sphinx-build -b html docs/ docs/_build \
&& cd ../etils && sphinx-build -b html docs/ docs/_build \
&& cd ../kauldron && sphinx-build -b html docs/ docs/_build \
&& echo finished
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
File details
Details for the file sphinx_apitree-1.4.4.tar.gz
.
File metadata
- Download URL: sphinx_apitree-1.4.4.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79e8ca9131021c7f4084bdd4ec47382c44fa0e7f9d1dbde81da9f95021d78312 |
|
MD5 | 7dc5779ac86545c7c395aca01524f22d |
|
BLAKE2b-256 | e6be2a78b68be42cff694d656bacc36c5abeb388de758da7f70f708e2c4bffc7 |
File details
Details for the file sphinx_apitree-1.4.4-py3-none-any.whl
.
File metadata
- Download URL: sphinx_apitree-1.4.4-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8339641dc2f2fb6a74aab750ab29f1a7bac5d4e501058e69276ee1844b410620 |
|
MD5 | b1738c95387b193dbae5d4f6b020f932 |
|
BLAKE2b-256 | 2d11ad1c96800a8106b2473198b65cf2b8fbcc8d00c9060706ac3ced220b44ac |