Skip to content

Commit f5f1ec8

Browse files
committed
Provide a guide to migration to the in-tree extension
Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 8321984 commit f5f1ec8

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

README.rst

+47-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ A Sphinx extension for running `sphinx-apidoc`_ on each build.
1010

1111
.. important::
1212

13-
Sphinx includes a built-in extension adding this functionality, with many
14-
of the same options. New users should opt for this extension instead, while
15-
existing users should seek to migrate as this project will eventually be
16-
retired.
13+
Sphinx 8.2.0 introduced a built-in extension adding this functionality,
14+
with many of the same options. New users should opt for this extension
15+
instead, while existing users should seek to migrate as this project will
16+
eventually be retired. For more information, refer to the
17+
`sphinx.ext.apidoc`_ documentation. A migration guide is provided `below
18+
<migration-to-sphinx.ext.apidoc`.
1719

1820
Overview
1921
--------
@@ -104,6 +106,46 @@ The *apidoc* extension uses the following configuration values:
104106

105107
**Optional**, defaults to ``[]``.
106108

109+
.. _migration-to-sphinx.ext.apidoc:
110+
111+
Migration to ``sphinx.ext.apidoc``
112+
----------------------------------
113+
114+
Starting in Sphinx 8.2.0, Sphinx includes the `sphinx.ext.apidoc`_ extension,
115+
which includes most or all of the functionality provided by this extension. It
116+
should be preferred for both new and existing users. Consider the previous
117+
``conf.py`` example given above:
118+
119+
.. code-block:: python
120+
121+
extensions = [
122+
'sphinxcontrib.apidoc',
123+
# ...
124+
]
125+
apidoc_module_dir = '../my_code'
126+
apidoc_output_dir = 'reference'
127+
apidoc_excluded_paths = ['tests']
128+
apidoc_separate_modules = True
129+
130+
This can be rewritten to use the new extension like so:
131+
132+
.. code-block:: python
133+
134+
extensions = [
135+
'sphinx.ext.apidoc',
136+
# ...
137+
]
138+
apidoc_modules = [
139+
{
140+
'path': '../my_code',
141+
'destination': 'reference',
142+
'exclude_patterns': ['**/tests/*'],
143+
'separate_modules': True,
144+
},
145+
]
146+
147+
For more information, refer to the `sphinx.ext.apidoc`_ documentation.
148+
107149
Migration from pbr
108150
------------------
109151

@@ -325,6 +367,7 @@ Links
325367

326368
.. Links
327369
370+
.. _sphinx.ext.apidoc: https://www.sphinx-doc.org/en/master/usage/extensions/apidoc.html
328371
.. _sphinx-apidoc: http://www.sphinx-doc.org/en/stable/man/sphinx-apidoc.html
329372
.. _sphinx_autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
330373
.. _pbr: https://docs.openstack.org/pbr/

0 commit comments

Comments
 (0)