Skip to content

Commit a55dffc

Browse files
committed
updating sphinx docs to include ipython tutorials
1 parent 7b90fc3 commit a55dffc

15 files changed

+7616
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ We are releasing this code to the public as a tool we expect others to use. Ques
77

88

99
## Quickstart
10-
bmtk requires Python 2.7 plus [additional python dependicies](https://alleninstitute.github.io/bmtk/index.html#base-installation). To install with
10+
bmtk requires Python 2.7 or 3.5+, plus [additional python dependicies](https://alleninstitute.github.io/bmtk/index.html#base-installation). To install with
1111
base requirements from a command-line:
1212

1313
```bash

docs/autodocs/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ html:
1818
sphinx-apidoc -f -o source/bmtk/ ../../bmtk
1919
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2020

21+
tutorials:
22+
cp ../tutorial/\d\d_single_cell_clamped.ipynb source
23+
2124

2225
# Catch-all target: route all unknown targets to Sphinx using the new
2326
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2427
%: Makefile
25-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
28+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/autodocs/source/conf.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#
1919
import os
2020
import sys
21+
import glob
22+
import shutil
23+
2124
sys.path.insert(0, os.path.abspath('../../..'))
2225

2326

@@ -35,7 +38,8 @@
3538
'sphinx.ext.githubpages',
3639
'sphinx.ext.viewcode',
3740
'numpydoc',
38-
'sphinx.ext.autosummary'
41+
'sphinx.ext.autosummary',
42+
'nbsphinx',
3943
]
4044

4145
# Add any paths that contain templates here, relative to this directory.
@@ -46,7 +50,7 @@
4650
# You can specify multiple suffix as a list of string:
4751
#
4852
# source_suffix = ['.rst', '.md']
49-
source_suffix = '.rst'
53+
source_suffix = ['.rst', '.ipynb']
5054

5155
# The master toctree document.
5256
master_doc = 'index'
@@ -185,4 +189,21 @@
185189
]
186190

187191

192+
def copy_tutorials():
193+
source_dir = os.path.dirname(os.path.abspath(__file__))
194+
tutorials_dir = os.path.abspath('../tutorial')
195+
tutorials = os.path.join(tutorials_dir, '*.ipynb')
196+
197+
for ipynb_file in glob.glob(tutorials):
198+
tut_fname = os.path.basename(ipynb_file)
199+
if ipynb_file.startswith('00'):
200+
continue
201+
elif tut_fname[:2].isnumeric():
202+
tut_fname = tut_fname[3:]
203+
204+
tut_path = os.path.join(source_dir, 'tutorial_{}'.format(tut_fname))
205+
shutil.copy(ipynb_file, tut_path)
206+
188207

208+
def setup(app):
209+
copy_tutorials()

docs/autodocs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Welcome to the Brain Modeling Toolkit
1616
Building Networks <builder>
1717
simulators
1818
analyzer
19-
Tutorials <https://github.com/AllenInstitute/bmtk/blob/develop/docs/tutorial/00_introduction.ipynb>
19+
tutorials
2020
Github Profile <https://github.com/AllenInstitute/bmtk.git>
2121
contributors
2222
Source Documentation <bmtk/bmtk>

0 commit comments

Comments
 (0)