|
| 1 | +==================== |
| 2 | +sphinxcontrib-apidoc |
| 3 | +==================== |
| 4 | + |
| 5 | +A Sphinx extension for running `sphinx-apidoc`_ on each build. |
| 6 | + |
| 7 | +Overview |
| 8 | +-------- |
| 9 | + |
| 10 | +*sphinx-apidoc* is a tool for automatic generation of Sphinx sources that, |
| 11 | +using the `autodoc`_ extension, document a whole package in the style of other |
| 12 | +automatic API documentation tools. *sphinx-apidoc* does not actually build |
| 13 | +documentation - rather it simply generates it. As a result, it must be run |
| 14 | +before *sphinx-build*. This generally results in ``tox.ini`` files like the |
| 15 | +following: |
| 16 | + |
| 17 | +.. code-block:: ini |
| 18 | +
|
| 19 | + [testenv:docs] |
| 20 | + commands = |
| 21 | + sphinx-apidoc -o doc/api my_code my_code/tests |
| 22 | + sphinx-build -W -b html doc doc/_build/html |
| 23 | +
|
| 24 | +This extension eliminates the need to keep that configuration outside Sphinx. |
| 25 | +Instead, this functionality can be enabled and configured from your |
| 26 | +documentation's ``conf.py`` file, like so: |
| 27 | + |
| 28 | +.. code-block:: python |
| 29 | +
|
| 30 | + extensions = [ |
| 31 | + 'sphinxcontrib.apidoc', |
| 32 | + # ... |
| 33 | + ] |
| 34 | + apidoc_module_dir = '../my_code' |
| 35 | + apidoc_output_dir = 'reference' |
| 36 | + apidoc_excluded_modules = ['tests'] |
| 37 | +
|
| 38 | +Configuration |
| 39 | +------------- |
| 40 | + |
| 41 | +The *apidoc* extension uses the following configuration values: |
| 42 | + |
| 43 | +``apidoc_module_dir`` |
| 44 | + The path to the module to document. This must be a path to a Python package. |
| 45 | + This path can be a path relative to the documentation source directory or an |
| 46 | + absolute path. |
| 47 | + |
| 48 | + **Required** |
| 49 | + |
| 50 | +``apidoc_output_dir`` |
| 51 | + The output directory. If it does not exist, it is created. This path is |
| 52 | + relative to the documentation source directory. |
| 53 | + |
| 54 | + **Optional**, defaults to ``api``. |
| 55 | + |
| 56 | +``apidoc_excluded_modules`` |
| 57 | + An optional list of modules to exclude. These should be paths relative to |
| 58 | + ``apidoc_module_dir``. fnmatch-style wildcarding is supported. |
| 59 | + |
| 60 | + **Optional**, defaults to ``[]``. |
| 61 | + |
| 62 | +Links |
| 63 | +----- |
| 64 | + |
| 65 | +- Source: https://github.com/sphinx-contrib/apidoc |
| 66 | +- Bugs: https://github.com/sphinx-contrib/apidoc/issues |
| 67 | + |
| 68 | +.. Links |
| 69 | +
|
| 70 | +.. _sphinx-apidoc: http://www.sphinx-doc.org/en/stable/man/sphinx-apidoc.html |
| 71 | +.. _autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html |
0 commit comments