Skip to content
Snippets Groups Projects
Commit 9fc01a7e authored by Joseph Weston's avatar Joseph Weston
Browse files

add jupyter-sphinx to documentation config

parent 182beca1
No related branches found
No related tags found
No related merge requests found
......@@ -241,7 +241,7 @@ build documentation:
script:
- pip install git+https://github.com/jupyter-widgets/jupyter-sphinx
- python -m ipykernel install --user --name kwant-latest
- make -C doc realclean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
- make -C doc realclean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W -D jupyter_execute_default_kernel=kwant-latest' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
artifacts:
paths:
- doc/build/html/
......@@ -255,7 +255,7 @@ build PDF documentation:
script:
- pip install git+https://github.com/jupyter-widgets/jupyter-sphinx
- python -m ipykernel install --user --name kwant-latest
- make -C doc latex SPHINXOPTS='-n -W'
- make -C doc latex SPHINXOPTS='-n -W -D jupyter_execute_default_kernel=kwant-latest'
- cd doc/build/latex
- make all-pdf
artifacts:
......
......@@ -15,8 +15,15 @@ import sys
import os
import string
from distutils.util import get_platform
sys.path.insert(0, "../../build/lib.{0}-{1}.{2}".format(
get_platform(), *sys.version_info[:2]))
package_path = os.path.abspath(
"../../build/lib.{0}-{1}.{2}"
.format(get_platform(), *sys.version_info[:2]))
# Insert into sys.path so that we can import kwant here
sys.path.insert(0, package_path)
# Insert into PYTHONPATH so that jupyter-sphinx will pick it up
os.environ['PYTHONPATH'] = ':'.join((package_path, os.environ.get('PYTHONPATH','')))
import kwant
import kwant.qsymm
......@@ -31,7 +38,7 @@ sys.path.insert(0, os.path.abspath('../sphinxext'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary',
'sphinx.ext.todo', 'sphinx.ext.mathjax', 'numpydoc',
'kwantdoc', 'sphinx.ext.linkcode']
'kwantdoc', 'sphinx.ext.linkcode', 'jupyter_sphinx.execute']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['../templates']
......@@ -239,7 +246,6 @@ autosummary_generate = True
autoclass_content = "both"
autodoc_default_flags = ['show-inheritance']
# -- Teach Sphinx to document bound methods like functions ---------------------
import types
from sphinx.ext import autodoc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment