ansible-doc-extractor


Nameansible-doc-extractor JSON
Version 0.1.11 PyPI version JSON
download
home_pagehttps://github.com/xlab-steampunk/ansible-doc-extractor
SummaryExtract Ansible module documentation
upload_time2024-02-27 07:07:18
maintainer
docs_urlNone
authorXLAB Steampunk
requires_python>=3.6
license
keywords ansible documentation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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``.

.. note::
   Always extract documentation from installed collection. Documentation
   fragment loader fails to combine various parts of the documentation
   otherwise.

------------------------
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`_.


.. _PyPI: https://pypi.org/
.. _`default Jinja2 template for rst`: https://github.com/xlab-si/ansible-doc-extractor/blob/master/src/ansible_doc_extractor/templates/module.rst.j2
.. _`default Jinja2 template for markdown`: https://github.com/xlab-si/ansible-doc-extractor/blob/master/src/ansible_doc_extractor/templates/module.md.j2


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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xlab-steampunk/ansible-doc-extractor",
    "name": "ansible-doc-extractor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "ansible,documentation",
    "author": "XLAB Steampunk",
    "author_email": "steampunk@xlab.si",
    "download_url": "https://files.pythonhosted.org/packages/2a/13/8255e94554c3157ea3502ae4322cbb9ce909ad47fe20d5523541a75fd3d6/ansible-doc-extractor-0.1.11.tar.gz",
    "platform": null,
    "description": "Ansible Collection API Documentation Extractor\n==============================================\n\nThis package contains code for Ansible collection documentation extractor. Its\nmain audience are Ansible collection maintainers that would like to publish\nAPI docs in the HTML form without having to manually copy the data already\npresent in the module's metadata.\n\n\nQuickstart\n----------\n\nDocumentation extractor is published on PyPI_ and we can install it using\n``pip``::\n\n   $ pip install ansible-doc-extractor  # If we already have ansible installed\n   $ pip install ansible-doc-extractor[ansible]  # To also install ansible\n   $ pip install ansible-doc-extractor[base]  # To also install ansible-base\n   $ pip install ansible-doc-extractor[core]  # To also install ansible-core\n\nIf the previous command did not fail, we are ready to start extracting the\ndocumentation::\n\n   $ ansible-doc-extractor \\\n       /tmp/output-folder \\\n       ~/.ansible/collections/ansible_collections/my/col/plugins/modules/*.py\n\nThis will extract the documentation from modules in ``my.col`` collection and\nplace resulting rst files into ``/tmp/output-folder``.\n\n.. note::\n   Always extract documentation from installed collection. Documentation\n   fragment loader fails to combine various parts of the documentation\n   otherwise.\n\n------------------------\nRST and Markdown support\n------------------------\n\nBy 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.\n\n---------------\nCustom template\n---------------\n`ansible-doc-extractor` supports a custom Jinja2 template file via ``--template``. The following variables\nare sent to the template:\n\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| Variable name      | Type       | Description                                                                         | Module's documentation key                       |\n+====================+============+=====================================================================================+==================================================+\n| short_description  | str        | Short description of a module.                                                      | short_description                                |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| description        | str / list | Longer description of a module, type depends on the module's `description` type.    | description                                      |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| requirements       | list       | Requirements needed on the host that executes this module.                          | requirements                                     |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| options            | dict       | All module options, often called parameters or arguments.                           | options                                          |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| notes              | list       | Module's additional notes.                                                          | notes                                            |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| seealso            | list       | Details of any important information that doesn\u2019t fit in one of the above sections. | seealso                                          |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| deprecated         | str        | Marks modules that will be removed in future releases                               | deprecated                                       |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| author             | str / list | Author of the module, type can vary depending on how many authors module has.       | author                                           |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| metadata           | dict       | This section provides information about the module                                  | Refers to ANSIBLE_METADATA block in the module.  |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| examples           | str        | Code examples                                                                       | Refers to EXAMPLES block in the module.          |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n| returndocs         | dict       | This section documents the information the module returns.                          | Refers to RETURN block in the module.            |\n+--------------------+------------+-------------------------------------------------------------------------------------+--------------------------------------------------+\n\nThe output files will use the same file extension as the custom template file.\n\n\nYou can always refer to the `default Jinja2 template for rst`_ and the `default Jinja2 template for markdown`_.\n\n\n.. _PyPI: https://pypi.org/\n.. _`default Jinja2 template for rst`: https://github.com/xlab-si/ansible-doc-extractor/blob/master/src/ansible_doc_extractor/templates/module.rst.j2\n.. _`default Jinja2 template for markdown`: https://github.com/xlab-si/ansible-doc-extractor/blob/master/src/ansible_doc_extractor/templates/module.md.j2\n\n\nDevelopment setup\n-----------------\n\nGetting development environment up and running is relatively simple::\n\n   $ python3 -m venv venv\n   $ . venv/bin/activate\n   (venv) $ pip install -e .\n\nTo test the extractor, we can run::\n\n   $ ansible-doc-extractor\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Extract Ansible module documentation",
    "version": "0.1.11",
    "project_urls": {
        "Bug Tracker": "https://github.com/xlab-steampunk/ansible-doc-extractor/issues",
        "Homepage": "https://github.com/xlab-steampunk/ansible-doc-extractor"
    },
    "split_keywords": [
        "ansible",
        "documentation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0fc62d6e3f1617ef9dd24f3b843e0256c860a481a366f4405a3ba21331e4534e",
                "md5": "9d79eaceb191372fcb5354558f85cbc5",
                "sha256": "526b336917be331aa8db04cae924547047c16f8831871afa2664b9451902dfba"
            },
            "downloads": -1,
            "filename": "ansible_doc_extractor-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d79eaceb191372fcb5354558f85cbc5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 20435,
            "upload_time": "2024-02-27T07:07:14",
            "upload_time_iso_8601": "2024-02-27T07:07:14.613339Z",
            "url": "https://files.pythonhosted.org/packages/0f/c6/2d6e3f1617ef9dd24f3b843e0256c860a481a366f4405a3ba21331e4534e/ansible_doc_extractor-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a138255e94554c3157ea3502ae4322cbb9ce909ad47fe20d5523541a75fd3d6",
                "md5": "a63a36baebc828a72421fe3102e91437",
                "sha256": "65afdb030ab5e78cf30ef44c55b8202c761f6666f9cb340b7ac1813acb1c1d3f"
            },
            "downloads": -1,
            "filename": "ansible-doc-extractor-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "a63a36baebc828a72421fe3102e91437",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 27897,
            "upload_time": "2024-02-27T07:07:18",
            "upload_time_iso_8601": "2024-02-27T07:07:18.270589Z",
            "url": "https://files.pythonhosted.org/packages/2a/13/8255e94554c3157ea3502ae4322cbb9ce909ad47fe20d5523541a75fd3d6/ansible-doc-extractor-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-27 07:07:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xlab-steampunk",
    "github_project": "ansible-doc-extractor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ansible-doc-extractor"
}
        
Elapsed time: 0.19793s