Skip to content

Commit

Permalink
fix: restore automated documentation (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
Midnighter committed Jun 4, 2018
1 parent 1ca1bf3 commit a163830
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 78 deletions.
3 changes: 3 additions & 0 deletions documentation_builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../documentation
AUTODIR = _autogen

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
Expand Down Expand Up @@ -39,9 +40,11 @@ help:
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(AUTODIR)
-rm -rf $(BUILDDIR)/*

html:
# sphinx-apidoc -f -d 2 -e -o $(AUTODIR) ../cobra
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
Expand Down
29 changes: 9 additions & 20 deletions documentation_builder/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
# serve to show the default.

import sys
from os.path import dirname, join
from os.path import dirname

# If extensions (or modules to document with autodoc) are in another directory,
# 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.
DOCS_ROOT = dirname(__file__)
PROJECT_ROOT = dirname(DOCS_ROOT)

sys.path.insert(0, PROJECT_ROOT)
sys.path.insert(0, dirname(dirname(__file__)))


# In order to build documentation that requires libraries to import
Expand All @@ -42,6 +39,7 @@ def __getattr__(cls, name):

# These modules should correspond to the importable Python packages.
MOCK_MODULES = [
'depinfo',
'numpy',
'scipy', 'scipy.optimize', 'scipy.sparse', 'scipy.io', 'scipy.stats',
'pp',
Expand All @@ -67,8 +65,13 @@ def __getattr__(cls, name):
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'autoapi.extension',
'nbsphinx'
]
# Document Python Code
autoapi_type = 'python'
autoapi_dirs = ['..']
autoapi_ignore = ['.tox', '.pytest_cache', 'scripts', 'benchmarks']

# Napoleon settings
napoleon_numpy_docstring = True
Expand Down Expand Up @@ -101,7 +104,7 @@ def __getattr__(cls, name):

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
'papersize': 'letterpaper',
'papersize': 'a4paper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
Expand Down Expand Up @@ -143,17 +146,3 @@ def __getattr__(cls, name):
"http://docs.scipy.org/doc/numpy/": None,
"http://docs.scipy.org/doc/scipy/reference": None}
intersphinx_cache_limit = 10 # days to keep the cached inventories

# -- sphinx-apidoc calling ---------------------------------------------


def run_apidoc(_):
from sphinx.apidoc import main

mod_path = join(PROJECT_ROOT, 'cobra')
auto_path = join(DOCS_ROOT, '_autogen')
main([None, '-f', '-d', '2', '-e', '-o', auto_path, mod_path])


def setup(app):
app.connect('builder-inited', run_apidoc)
1 change: 1 addition & 0 deletions documentation_builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Sphinx
sphinxcontrib-napoleon
sphinx-autoapi
nbsphinx>=0.2.4
ipykernel
117 changes: 59 additions & 58 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,61 +34,62 @@
except IOError:
setup_kwargs["long_description"] = ''

setup(
name="cobra",
version="0.12.0",
packages=find_packages(),
setup_requires=setup_requirements,
install_requires=[
"six",
"future",
"swiglpk",
"ruamel.yaml<0.15",
"numpy>=1.13",
"pandas>=0.17.0",
"optlang>=1.4.2",
"tabulate",
"depinfo"
],
tests_require=[
"jsonschema > 2.5",
"pytest",
"pytest-benchmark"
],
extras_require=extras,
package_data={
'': [
'test/data/*',
'mlab/matlab_scripts/*m'
]
},
author="The cobrapy core team",
author_email="cobra-pie@googlegroups.com",
description="COBRApy is a package for constraints-based modeling of "
"biological networks",
license="LGPL/GPL v2+",
keywords=("metabolism biology linear programming optimization flux"
" balance analysis fba"),
url="https://opencobra.github.io/cobrapy",
test_suite="cobra.test.suite",
download_url='https://pypi.python.org/pypi/cobra',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Lesser General Public License v2'
' or later (LGPLv2+)',
'License :: OSI Approved :: GNU General Public License v2'
' or later (GPLv2+)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
platforms="GNU/Linux, Mac OS X >= 10.7, Microsoft Windows >= 7",
**setup_kwargs
)
if __name__ == "__main__":
setup(
name="cobra",
version="0.12.0",
packages=find_packages(),
setup_requires=setup_requirements,
install_requires=[
"six",
"future",
"swiglpk",
"ruamel.yaml<0.15",
"numpy>=1.13",
"pandas>=0.17.0",
"optlang>=1.4.2",
"tabulate",
"depinfo"
],
tests_require=[
"jsonschema > 2.5",
"pytest",
"pytest-benchmark"
],
extras_require=extras,
package_data={
'': [
'test/data/*',
'mlab/matlab_scripts/*m'
]
},
author="The cobrapy core team",
author_email="cobra-pie@googlegroups.com",
description="COBRApy is a package for constraints-based modeling of "
"biological networks",
license="LGPL/GPL v2+",
keywords=("metabolism biology linear programming optimization flux"
" balance analysis fba"),
url="https://opencobra.github.io/cobrapy",
test_suite="cobra.test.suite",
download_url='https://pypi.python.org/pypi/cobra',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Lesser General Public License v2'
' or later (LGPLv2+)',
'License :: OSI Approved :: GNU General Public License v2'
' or later (GPLv2+)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
platforms="GNU/Linux, Mac OS X >= 10.7, Microsoft Windows >= 7",
**setup_kwargs
)

0 comments on commit a163830

Please sign in to comment.