A plugin to automagically create autodoc-based API documentation files on the fly
Project description
sphinx-automagicdoc
Description
This plugin can create API documentation stubs (akin to sphinx-autogen), with the significant difference that the creation is done dynamically and on the fly, and the files remain virtual and are monkey-patched into Sphinx IO routines.
Creating a whole set of files matching the structure of a module violates DRY (don't repeat yourself) and enhances the risk of documentation becoming out of sync during e.g. refactorings. Therefore, sphinx-automagicdoc
can be used to dynamically source the rST structure from the Python source as the single source of truth.
Based upon the monkey patched virtual filesystem, additionally, other files or strings can be injected into the Sphinx tree.
Usage
# e.g. added to conf.py
# name the modules automagicdoc should process
automagic_modules = ["nameOfYourPackage"]
automagic_ignore = ["*test*"]
# README.rst and LICENSE from the root directory (outside of doc directory)
# will appear available as README.rst and LICENSE.rst inside doc/
automagic_copy_files = {
"README.rst", "README.rst",
"LICENSE.rst": "LICENSE",
}
# index.rst's content is based upon a string
automagic_files = {
"index.rst": """
Welcome to the documentation!
=============================
.. toctree::
:maxdepth: 1
:caption: Contents:
README
LICENSE
nameOfYourPackage
"""
}
Example
This repo builds its documentation using sphinx-autopyproject as described in .github/workflows/doc.yml
using Github Actions and deploys to its gh-pages
branch, visible at https://csachs.github.io/sphinx-automagicdoc .
See also
sphinx-autopyproject to use pyproject.toml
instead of conf.py
.
License
MIT
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
Hashes for sphinx-automagicdoc-0.0.1rc1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8ce74b50b2bc88677f69b9bda66826d1431958f39f1750ae883a1bbcbd4b7af |
|
MD5 | 0ff8fb731fee377ad46b1186db107d78 |
|
BLAKE2b-256 | 6ee56b1e9e1e81e65cbc3e63232b564494b902579cfb6ca8a6e01a17e6dcdc6b |
Hashes for sphinx_automagicdoc-0.0.1rc1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e7644f4037f5afd536c029113678800f9b079be9802c4ab39d1adaae60c447f |
|
MD5 | aec165a58a16702e68ad13d42e336728 |
|
BLAKE2b-256 | 56f7b191eb870ded638c97c350eaf4dd4208e3d84f3fc154fe441862f39dc195 |