Sphinx: Allow option in `setup.cfg` to run `sphinx-apidoc` first

Created on 22 Apr 2015  路  11Comments  路  Source: sphinx-doc/sphinx

If there is a way to do this and I missed it, I would really appreciate a pointer in the right direction. If not, I think it would be really nice to have a way to specify in setup.cfg or otherwise an optional run of sphinx-apidoc with arguments before running sphinx-build.

enhancement

Most helpful comment

Workaround: Insert the following code in conf.py (adjust apidoc parameters to your needs):

import sphinx.apidoc

def setup(app):
    sphinx.apidoc.main(['-f', '-T', '-e', '-o', 'doc/autogen', 'src'])

All 11 comments

+1

+1

Although it isn't built in, PBR can help with this.

Is this a duplicate of #1135?

Not sure. Am unclear on how the reporter there wants to achieve the intended outcome. If they are wanting to add a flag on the command line, that does not really work for my use case.

This is a duplicate of #1135 and should be closed as a dupe. @tk0miya, @shimizukawa: can one of you do this? Do note, however, that #1135 should be renamed with this name, which is more generic (we don't necessarily want to do it in setuptools, as #4101 shows (Alternatively, we could close #1135?)

Workaround: Insert the following code in conf.py (adjust apidoc parameters to your needs):

import sphinx.apidoc

def setup(app):
    sphinx.apidoc.main(['-f', '-T', '-e', '-o', 'doc/autogen', 'src'])

There is now an extension that does this: https://github.com/sphinx-contrib/apidoc. Probably safe to close this ticket now.

Agreed

This is a duplicate of #1135 and should be closed as a dupe. @tk0miya, @shimizukawa: can one of you do this? Do note, however, that #1135 should be renamed with this name, which is more generic (we don't necessarily want to do it in setuptools, as #4101 shows (Alternatively, we could close #1135?)

Inifinte regression here: 1135 says duplicate of 1861

Workaround: Insert the following code in conf.py (adjust apidoc parameters to your needs):

import sphinx.apidoc

def setup(app):
    sphinx.apidoc.main(['-f', '-T', '-e', '-o', 'doc/autogen', 'src'])

The pyhton module sphinx has no apidoc submodule in latest versions. On the basis of this comment I directly use subprocess:

import subprocess
def setup(app):
    subprocess.call(['sphinx-apidoc', '-o', 'docs/source/', <your module name>])
Was this page helpful?
0 / 5 - 0 ratings