Commit cb33f7fa authored by Stephen Thompson's avatar Stephen Thompson

Merge branch '45-jupyter-integration' into 'master'

Resolve "Add Jupyter integration"

Closes #45

See merge request !25
parents 8fd8f987 53b756b7
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = py27,py36
envlist = py36
skipsdist = True
[testenv]
......
......@@ -10,3 +10,6 @@
# PyInstaller
build/
dist/
# Jupyter output
doc/notebooks/.ipynb_checkpoints/
......@@ -44,7 +44,9 @@ exclude_patterns = [
'Thumbs.db',
'.DS_Store',
'_verion.py',
'versioneer.py'
'versioneer.py',
'*-checkpoint.ipynb',
'.ipynb_checkpoints'
]
......@@ -85,7 +87,7 @@ def setup(app):
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.imgmath']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.imgmath', 'nbsphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
......
......@@ -7,6 +7,7 @@ Contents
requirements
Module Contents <modules>
notebooks/first_notebook
* :ref:`modindex`
* :ref:`genindex`
......
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# First notebook\n",
"\n",
"You can write up experiments in notebooks, and they can be generated into Sphinx docs using ```tox -e docs```, and for example set up to run on readthedocs.\n",
"\n",
"See [this](https://scikit-surgerytf.readthedocs.io/en/latest/notebooks/tutorial_reusable_code_design.html) and [this](https://scikit-surgerytf.readthedocs.io/en/latest/notebooks/tutorial_reusable_code_example.html) examples.\n",
"\n",
"## NOTE:\n",
"\n",
"Getting jupyter to run your code in this package relies on 3 things:\n",
"\n",
"* You must ensure you start jupyter within the tox environment.\n",
"\n",
"```\n",
"# If not already done.\n",
"source .tox/py36/bin/activate\n",
"\n",
"# Then launch jupyter\n",
"jupyter notebook\n",
"```\n",
" \n",
"* Then when you navigate to and run this notebook, select the right kernel (named after your project) from the kernel menu item, in the web browser.\n",
"\n",
"* Add project folder to system path, as below."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Jupyter notebook sets the cwd to the folder containing the notebook.\n",
"# So, you want to add the root of the project to the sys path, so modules load correctly.\n",
"import sys\n",
"sys.path.append(\"../../\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
......@@ -3,3 +3,5 @@
# confused with the software requirements, which are listed in
# doc/requirements.rst
numpy
ipykernel
nbsphinx
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = py27,py36,lint
envlist = py36,lint
skipsdist = True
[travis]
python =
2.7: py27
3.6: py36, docs, lint
[testenv]
deps=-rrequirements-dev.txt
whitelist_externals=coverage,pip
commands_pre=ipython kernel install --user --name={{ cookiecutter.pkg_name }}
# See .coveragerc for list of omitted files
commands = coverage erase
coverage run -a --source ./{{ cookiecutter.pkg_name }} -m pytest -v -s ./tests/
......@@ -31,13 +31,6 @@ commands = sphinx-build -M html . build
basepython=python3.6
commands=pyinstaller --onefile {{ cookiecutter.pkg_name }}.py --noconfirm --windowed
[testenv:pip2]
basepython=python2.7
changedir=pip_test
skip_install=True
commands = pip install {posargs}
{{ cookiecutter.pkg_name }} --help
[testenv:pip3]
basepython=python3.6
changedir=pip_test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment