MkDocs plugin providing automatic API reference generation
Project description
mkdocs-autoapi
Description
mkdocs-autoapi
is a MkDocs plugin that automatically generates API
documentation from your project's source code. The idea for the plugin comes
from this recipe
in the MkDocs documentation.
Installation
Requirements
- Python version 3.6 or higher
- MkDocs version 1.4.0 or higher
- mkdocstrings version 0.19.0 or higher
Installation via pip
We recommend installing this package with pip
:
pip install mkdocs-autoapi
Usage
Basic Usage
To use the plugin, add the following configuration to your mkdocs.yml
file:
plugins:
- ... other plugin configuration ...
- mkdocs-autoapi
- mkdocstrings
Setting the Project Root
By default, the plugin will use the current working directory as the project
root. If you would like to use a different directory, you can specify a value
in the project_root
configuration option:
plugins:
- ... other plugin configuration ...
- mkdocs-autoapi:
project_root: /path/to/project/root
- mkdocstrings
Excluding Patterns
You can exclude files and directories from the documentation by specifying a
value in the exclude
configuration option. This option accepts a list of
glob patterns. Note that the following patterns are always excluded:
**/.venv/**/
**/venv/**/
As an example, suppose your project has the following structure:
project/
docs/
index.md
module/
__init__.py
lorem.py
ipsum.py
dolor.py
second_module/
__init__.py
lorem.py
sit.py
amet.py
venv/
mkdocs.yml
README.md
To exclude all files named lorem.py
, you can add the following configuration
to your mkdocs.yml
file:
plugins:
- ... other plugin configuration ...
- mkdocs-autoapi:
exclude:
- "**/lorem.py"
- mkdocstrings
Including API Documentation in Navigation
To include the API documentation created by the plugin in your site's
navigation, you can add the following configuration to your mkdocs.yml
file:
nav:
- ... other navigation sections ...
- API Reference: autoapi/
- ... other navigation sections ...
More information on navigation configuration can be found in the MkDocs User Guide.
Putting It All Together
Again, consider the following project structure:
project/
docs/
index.md
module/
__init__.py
lorem.py
ipsum.py
dolor.py
second_module/
__init__.py
lorem.py
sit.py
amet.py
venv/
mkdocs.yml
README.md
A full mkdocs.yml
for the project might look like this:
site_name: Project
nav:
- Home: index.md
- API Reference: autoapi/
plugins:
- mkdocs-autoapi
- mkdocstrings
theme:
name: readthedocs
More information MkDocs configuration through mkdocs.yml
can be found in the
MkDocs User Guide.
Contributing
Contributions are always welcome! Please submit a pull request or open an issue to get started.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
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 mkdocs_autoapi-0.2.1.tar.gz
.
File metadata
- Download URL: mkdocs_autoapi-0.2.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701684bbc75f435dc5d0a36bd27bc9f5d4f8e90308a5fd1ccef6dc10ac95d04f |
|
MD5 | 734b03906c2dc6c67cb47e0e1b512682 |
|
BLAKE2b-256 | bbad8d11240f697fc725a049062692c726d1b47a423e16e4e3848005115bdfdb |
File details
Details for the file mkdocs_autoapi-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_autoapi-0.2.1-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df9ad684538acdc54dde92fb9aa29b00acfbcb0eb3a2283ba97e1e6d668a7b86 |
|
MD5 | 58db39ad8083a65148185c12f925d570 |
|
BLAKE2b-256 | 2919a9a72e54eb557f6d39ac415e2d5eaa064546765c5311dceb2af254319f11 |