Skip to content
Permalink
Browse files

Generate api documentation when running 'python setup.py build_sphinx'

  • Loading branch information...
jvdzwaan committed Oct 28, 2018
1 parent c689fed commit 92971dcea9ffbfc0fbff9e17db06a9d0c229c98f
Showing with 41 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +40 −4 docs/conf.py
@@ -65,6 +65,7 @@ coverage.xml

# Sphinx documentation
docs/_build/
docs/_apidoc/

# PyBuilder
target/
@@ -12,10 +12,9 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
import sys
sys.path.insert(0, os.path.abspath('.'))

# -- Project information -----------------------------------------------------

@@ -28,6 +27,43 @@
# The full version, including alpha/beta/rc tags
release = ''

# -- Automatically generate API documentation --------------------------------

import sphinx.apidoc

def run_apidoc(_):
ignore_paths = [
'integration_test',
'setup.py',
'process_changelog.py',
os.path.join('recipyGui', 'tests'),
os.path.join('recipyCommon', 'tests'),
os.path.join('recipy', 'tests'),
]

argv = [
"-f",
"-l",
"-e",
"-M",
"-o", os.path.join("docs", "_apidoc"),
".",
] + ignore_paths

print(' '.join(argv))

try:
# Sphinx 1.7+
from sphinx.ext import apidoc
apidoc.main(argv)
except ImportError:
# Sphinx 1.6 (and earlier)
from sphinx import apidoc
argv.insert(0, apidoc.__file__)
apidoc.main(argv)

def setup(app):
app.connect('builder-inited', run_apidoc)

# -- General configuration ---------------------------------------------------

0 comments on commit 92971dc

Please sign in to comment.
You can’t perform that action at this time.