sphinx-autoapi/README.rst

140 lines
4.2 KiB
ReStructuredText
Raw Normal View History

2015-05-29 19:37:06 +00:00
Sphinx AutoAPI
==============
2015-06-01 22:32:08 +00:00
.. image:: https://readthedocs.org/projects/sphinx-autoapi/badge/?version=latest
2019-04-07 00:56:05 +00:00
:target: https://sphinx-autoapi.readthedocs.org
:alt: Documentation
2015-06-01 22:32:08 +00:00
.. image:: https://travis-ci.org/rtfd/sphinx-autoapi.svg?branch=master
2019-04-07 00:56:05 +00:00
:target: https://travis-ci.org/rtfd/sphinx-autoapi
:alt: Travis Build Status
2015-06-01 22:32:08 +00:00
2015-08-20 18:13:29 +00:00
.. image:: https://ci.appveyor.com/api/projects/status/5nd33gp2eq7411t1?svg=true
2019-04-07 00:56:05 +00:00
:target: https://ci.appveyor.com/project/ericholscher/sphinx-autoapi
:alt: Appveyor Build Status
2015-08-20 18:13:29 +00:00
2019-04-07 00:56:05 +00:00
.. image:: https://img.shields.io/pypi/v/sphinx-autoapi.svg
:target: https://pypi.org/project/sphinx-autoapi/
:alt: PyPI Version
2015-06-01 22:32:47 +00:00
2019-04-07 00:56:05 +00:00
.. image:: https://img.shields.io/pypi/pyversions/sphinx-autoapi.svg
:target: https://pypi.org/project/sphinx-autoapi/
:alt: Supported Python Versions
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Formatted with Black
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
Sphinx AutoAPI provides "autodoc" style documentation for multiple programming languages
without needing to load, run, or import the project being documented.
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
In contrast to the traditional `Sphinx autodoc <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_,
which is Python-only and uses code imports,
AutoAPI finds and generates documentation by parsing source code.
2018-08-10 16:01:21 +00:00
2019-04-07 00:56:05 +00:00
Language Support
----------------
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
========== ====== ==========================================================
Language Status Parser
========== ====== ==========================================================
Python Stable Custom using `astroid <https://github.com/PyCQA/astroid>`_
Go Alpha `godocjson <https://github.com/rtfd/godocjson>`_
Javascript Alpha `jsdoc <http://usejsdoc.org/>`_
.NET Alpha `docfx <https://dotnet.github.io/docfx/>`_
========== ====== ==========================================================
2015-06-07 15:03:28 +00:00
2019-04-07 00:56:05 +00:00
Getting Started
---------------
2015-06-07 15:03:28 +00:00
2019-04-07 00:56:05 +00:00
The following steps will walk through how to add AutoAPI to an existing Sphinx project.
For instructions on how to set up a Sphinx project,
see Sphinx's documentation on
`Getting Started <https://www.sphinx-doc.org/en/master/usage/quickstart.html>`_.
2015-06-07 15:03:28 +00:00
2019-04-07 00:56:05 +00:00
Installation
~~~~~~~~~~~~
2015-06-07 15:03:28 +00:00
2019-04-07 00:56:05 +00:00
AutoAPI can be installed through pip:
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
.. code-block:: bash
pip install sphinx-autoapi
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
Next, add and configure AutoAPI in your Sphinx project's `conf.py`.
Other languages may require
[further configuration](https://sphinx-autoapi.readthedocs.io/en/latest/tutorials.html#setting-up-automatic-api-documentation-generation):
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
.. code-block:: python
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
extensions.append('autoapi.extension')
2015-05-29 19:37:06 +00:00
autoapi_type = 'python'
2019-04-07 00:56:05 +00:00
autoapi_dirs = ['path/to/source/files', 'src']
2019-04-07 00:56:05 +00:00
Where `autoapi_type` can be one of any of the supported languages:
2019-04-07 00:56:05 +00:00
========== ================
Language ``autoapi_type``
========== ================
Python ``'python'``
Go ``'go'``
Javascript ``'javascript'``
.NET ``'dotnet'``
========== ================
2019-04-07 00:56:05 +00:00
When the documentation is built,
AutoAPI will now generate API documentation into an `autoapi/` directory and add an entry to the documentation in your top level table of contents!
2019-04-07 00:56:05 +00:00
To configure AutoAPI behaviour further,
see the `Configuration documentation <https://sphinx-autoapi.readthedocs.io/en/latest/config.html>`_.
2019-04-07 00:56:05 +00:00
Contributing
------------
2019-04-07 00:56:05 +00:00
Running the tests
~~~~~~~~~~~~~~~~~
2016-06-03 01:03:54 +00:00
2019-04-07 00:56:05 +00:00
Tests are executed through `tox <https://tox.readthedocs.io/en/latest/>`_.
2019-04-07 00:56:05 +00:00
.. code-block:: bash
2019-04-07 00:56:05 +00:00
tox
2019-04-07 00:56:05 +00:00
Code Style
~~~~~~~~~~
2019-04-07 00:56:05 +00:00
Code is formatted using `black <https://github.com/ambv/black>`_.
2019-04-07 00:56:05 +00:00
You can check your formatting using black's check mode:
2019-04-07 00:56:05 +00:00
.. code-block:: bash
2019-04-07 00:56:05 +00:00
tox -e formatting
2019-04-07 00:56:05 +00:00
You can also get black to format your changes for you:
2019-04-07 00:56:05 +00:00
.. code-block:: bash
2019-04-07 00:56:05 +00:00
black autoapi/ tests/
2019-04-07 00:56:05 +00:00
You can even get black to format changes automatically when you commit using `pre-commit <https://pre-commit.com/>`_:
2019-04-07 00:56:05 +00:00
.. code-block:: bash
2019-04-07 00:56:05 +00:00
pip install pre-commit
pre-commit install
2019-04-07 00:56:05 +00:00
Versioning
2018-08-10 16:01:21 +00:00
----------
2019-04-07 00:56:05 +00:00
We use `SemVer <http://semver.org/>`_ for versioning. For the versions available, see the `tags on this repository <https://github.com/rtfd/sphinx-autoapi/tags>`_.
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
License
-------
2015-05-29 19:37:06 +00:00
2019-04-07 00:56:05 +00:00
This project is licensed under the MIT License.
See the `LICENSE.rst <LICENSE.rst>` file for details.