Skip to content

Commit

Permalink
get readthedocs working
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jan 8, 2018
1 parent 3738a2c commit 5f08f7e
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 206 deletions.
18 changes: 9 additions & 9 deletions docs/api.rst
Expand Up @@ -4,12 +4,12 @@ API Summary
:toctree: _autosummary
:template: modules.rst

mrpy.special
mrpy.stats
mrpy.core
mrpy.physical_dependence
mrpy.likelihoods
mrpy.analytic_model
mrpy.fit_curve
mrpy.fit_perobj
mrpy.reparameterise
mrpy.base.special
mrpy.base.stats
mrpy.base.core
mrpy.extra.physical_dependence
mrpy.extra.likelihoods
mrpy.extra.analytic_model
mrpy.extra.reparameterise
mrpy.fitting.fit_curve
mrpy.fitting.fit_sample
69 changes: 35 additions & 34 deletions docs/conf.py
Expand Up @@ -38,7 +38,8 @@
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'numpydoc',
# 'nbsphinx'
'nbsphinx',
'IPython.sphinxext.ipython_console_highlighting' # Ensures syntax highlighting works in notebooks (workaround)
]

autosummary_generate = "api",
Expand Down Expand Up @@ -317,36 +318,36 @@ def find_version(*file_paths):
intersphinx_mapping = {'https://docs.python.org/': None}
numpydoc_show_class_members=False


#===============================================================================
# This does something naughty. It runs the nbconvert command on everything in the
# given folder, and moves the results to another given folder on every make.

source_ipy_folder = "examples"
output_ipy_folder = "_exampledoc"
import shutil

def nbconvert_files(app):
fin = app.config.source_ipy_folder
fout = app.config.output_ipy_folder

if os.path.exists(fout):
os.system("rm -rf %s"%fout)

os.mkdir(fout)

files = [f for f in os.listdir(fin) if f.endswith(".ipynb")]

for f in files:
os.system("jupyter nbconvert {0} --to rst".format(os.path.join(fin,f)))
os.rename(f.replace(".ipynb",".rst"),os.path.join(fout,f.replace(".ipynb",".rst")))
try:
shutil.move(f.replace(".ipynb","_files"),os.path.join(fout,f.replace(".ipynb","_files")))
except IOError:
pass

def setup(app):
app.add_config_value("source_ipy_folder","examples","html")
app.add_config_value("output_ipy_folder","_exampledoc","html")

app.connect("builder-inited",nbconvert_files)
#
# #===============================================================================
# # This does something naughty. It runs the nbconvert command on everything in the
# # given folder, and moves the results to another given folder on every make.
#
# source_ipy_folder = "examples"
# output_ipy_folder = "_exampledoc"
# import shutil
#
# def nbconvert_files(app):
# fin = app.config.source_ipy_folder
# fout = app.config.output_ipy_folder
#
# if os.path.exists(fout):
# os.system("rm -rf %s"%fout)
#
# os.mkdir(fout)
#
# files = [f for f in os.listdir(fin) if f.endswith(".ipynb")]
#
# for f in files:
# os.system("jupyter nbconvert {0} --to rst".format(os.path.join(fin,f)))
# os.rename(f.replace(".ipynb",".rst"),os.path.join(fout,f.replace(".ipynb",".rst")))
# try:
# shutil.move(f.replace(".ipynb","_files"),os.path.join(fout,f.replace(".ipynb","_files")))
# except IOError:
# pass
#
# def setup(app):
# app.add_config_value("source_ipy_folder","examples","html")
# app.add_config_value("output_ipy_folder","_exampledoc","html")
#
# app.connect("builder-inited",nbconvert_files)
2 changes: 0 additions & 2 deletions docs/example_toc.rst
Expand Up @@ -19,6 +19,4 @@ the API documentation for each object.
_exampledoc/reparameterization_performance
_exampledoc/SMHM
_exampledoc/double_schechter_gsmf
_exampledoc/test_performance_against_EPS


93 changes: 58 additions & 35 deletions docs/examples/double_schechter_gsmf.ipynb

Large diffs are not rendered by default.

37 changes: 17 additions & 20 deletions docs/examples/reparameterization_performance.ipynb

Large diffs are not rendered by default.

105 changes: 0 additions & 105 deletions docs/examples/test_performance_against_EPS.ipynb

This file was deleted.

4 changes: 3 additions & 1 deletion docs/requirements.txt
@@ -1,4 +1,6 @@
numpydoc
nbsphinx
ipykernel
pandoc
pandoc
nbsphinx
ipykernel

0 comments on commit 5f08f7e

Please sign in to comment.