Ansible Collection API Documentation Extractor
This package contains code for Ansible collection documentation extractor. Its main audience are Ansible collection maintainers that would like to publish API docs in the HTML form without having to manually copy the data already present in the module’s metadata.
Quickstart
Documentation extractor is published on PyPI and we can install it using pip:
$ pip install ansible-doc-extractor # If we already have ansible installed $ pip install ansible-doc-extractor[ansible] # To also install ansible $ pip install ansible-doc-extractor[base] # To also install ansible-base $ pip install ansible-doc-extractor[core] # To also install ansible-core
If the previous command did not fail, we are ready to start extracting the documentation:
$ ansible-doc-extractor \
/tmp/output-folder \
~/.ansible/collections/ansible_collections/my/col/plugins/modules/*.py
This will extract the documentation from modules in my.col collection and place resulting rst files into /tmp/output-folder.
RST and Markdown support
By default ansible-doc-extractor will output files in .rst format using the built-in Jinja2 template for rst. Pass the --markdown flag to output files in markdown.
Custom template
ansible-doc-extractor supports a custom Jinja2 template file via --template. The following variables are sent to the template:
Variable name |
Type |
Description |
Module’s documentation key |
|---|---|---|---|
short_description |
str |
Short description of a module. |
short_description |
description |
str / list |
Longer description of a module, type depends on the module’s description type. |
description |
requirements |
list |
Requirements needed on the host that executes this module. |
requirements |
options |
dict |
All module options, often called parameters or arguments. |
options |
notes |
list |
Module’s additional notes. |
notes |
seealso |
list |
Details of any important information that doesn’t fit in one of the above sections. |
seealso |
deprecated |
str |
Marks modules that will be removed in future releases |
deprecated |
author |
str / list |
Author of the module, type can vary depending on how many authors module has. |
author |
metadata |
dict |
This section provides information about the module |
Refers to ANSIBLE_METADATA block in the module. |
examples |
str |
Code examples |
Refers to EXAMPLES block in the module. |
returndocs |
dict |
This section documents the information the module returns. |
Refers to RETURN block in the module. |
The output files will use the same file extension as the custom template file.
You can always refer to the default Jinja2 template for rst and the default Jinja2 template for markdown.
Development setup
Getting development environment up and running is relatively simple:
$ python3 -m venv venv $ . venv/bin/activate (venv) $ pip install -e .
To test the extractor, we can run:
$ ansible-doc-extractor
Metadata
Release files for ansible-doc-extractor 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ansible-doc-extractor-0.1.11.tar.gz | 27.9 kB | Without provenance | Details for ansible-doc-extractor-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ansible_doc_extractor-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for ansible_doc_extractor-0.1.11-py3-none-any.whl |
Total release size: 48.3 kB
Release files / ansible-doc-extractor-0.1.11.tar.gz
| Download URL | ansible-doc-extractor-0.1.11.tar.gz |
|---|---|
| Size | 27.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65afdb030ab5e78cf30ef44c55b8202c761f6666f9cb340b7ac1813acb1c1d3f
|
|
BLAKE2b-256 checksum How to use checksums |
2a138255e94554c3157ea3502ae4322cbb9ce909ad47fe20d5523541a75fd3d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Release files / ansible_doc_extractor-0.1.11-py3-none-any.whl
| Download URL | ansible_doc_extractor-0.1.11-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
526b336917be331aa8db04cae924547047c16f8831871afa2664b9451902dfba
|
|
BLAKE2b-256 checksum How to use checksums |
0fc62d6e3f1617ef9dd24f3b843e0256c860a481a366f4405a3ba21331e4534e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Security for ansible-doc-extractor 0.1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.