[openstack-dev] Replacing pbr's autodoc feature with sphinxcontrib-apidoc
zbitter at redhat.com
Mon Apr 2 23:41:04 UTC 2018
On 28/03/18 10:31, Stephen Finucane wrote:
> As noted last week , we're trying to move away from pbr's autodoc
> feature as part of the new docs PTI. To that end, I've created
> sphinxcontrib-apidoc, which should do what pbr was previously doing for
> us by via a Sphinx extension.
> This works by reading some configuration from your documentation's
> 'conf.py' file and using this to call 'sphinx-apidoc'. It means we no
> longer need pbr to do this for.
> I have pushed version 0.1.0 to PyPi already but before I add this to
> global requirements, I'd like to ensure things are working as expected.
> smcginnis was kind enough to test this out on glance and it seemed to
> work for him but I'd appreciate additional data points. The
> configuration steps for this extension are provided in the above link.
> To test this yourself, you simply need to do the following:
> 1. Add 'sphinxcontrib-apidoc' to your test-requirements.txt or
> doc/requirements.txt file
> 2. Configure as noted above and remove the '[pbr]' and '[build_sphinx]'
> configuration from 'setup.cfg'
> 3. Replace 'python setup.py build_sphinx' with a call to 'sphinx-build'
> 4. Run 'tox -e docs'
> 5. Profit?
> Be sure to let me know if anyone encounters issues. If not, I'll be
> pushing for this to be included in global requirements so we can start
> the migration.
Thanks Stephen! I tried it out with no problems:
However, there are a couple of differences compared to how pbr did things.
1) pbr can generate an 'autoindex' file with a flat list of modules
(this appears to be configurable with the autodoc_index_modules option),
but apidoc only generates a 'modules' file with a hierarchical list of
modules. This is easy to work around, but I guess it needs to be added
to the instructions to check that you're not relying on it.
2) pbr generates a page per module; this plugin generates a page per
package. This results in waaaay too much information on a page to be
able to navigate it comfortably IMHO. To the point where it's easier to
read the code. (It also breaks existing links, if you care about that
kind of thing.) I sent you a PR to add an option to pass --separate:
More information about the OpenStack-dev