Better instuctions for running docs notebooks.

This commit is contained in:
Simon Forman 2020-04-23 18:53:32 -07:00
parent 41fe48ec83
commit 49cc9c8709
2 changed files with 20 additions and 15 deletions

View File

@ -2,18 +2,21 @@
All of the notebooks are also available as HTML and Markdown files (generated using nbconvert) so you can view them without running Jupyter. All of the notebooks are also available as HTML and Markdown files (generated using nbconvert) so you can view them without running Jupyter.
In order to run the [Jupyter Notebooks](https://jupyter.org/index.html) you need Jupyter (obviously) and you should install `Joypy`. Here's an example using `virtualenv` from the `joypy/` directory: In order to run the [Jupyter Notebooks](https://jupyter.org/index.html) you need Jupyter (obviously) and you should install `Joypy`. Here's an example using `virtualenv` from the project directory:
virtualenv --system-site-packages <DIRNAME> virtualenv --system-site-packages venv
. ./<DIRNAME>/bin/activate source ./venv/bin/activate
pip install notebook
python ./setup.py install python ./setup.py install
Once that's done you should be able to start Jupyter Notebook server with, e.g.: Once that's done you should be able to start Jupyter Notebook server with, e.g.:
python -n notebook python -m notebook --ip=0.0.0.0
This starts it using the `virtualenv` version of Python so `joy` will be available. Navigate to the `joypy/docs` directory and the notebooks should be able to import the `notebook_preamble.py` file. This starts it using the `virtualenv` version of Python so `joy` will be available. Navigate to the `joypy/docs` directory and the notebooks should be able to import the `notebook_preamble.py` file.
I find I have to include `--ip=0.0.0.0` to workaround a bug where it tries to bind to an IPv6 address, YMMV.
## Table of Contents ## Table of Contents
- 1. Basic Use of Joy in a Notebook - 1. Basic Use of Joy in a Notebook

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -15,7 +15,9 @@
"source": [ "source": [
"# On \"Two Exercises Found in a Book on Algorithmics\"\n", "# On \"Two Exercises Found in a Book on Algorithmics\"\n",
"\n", "\n",
"Bird & Meertens" "Bird & Meertens\n",
"\n",
"[PDF paper available here](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.694.2614)"
] ]
}, },
{ {
@ -30,7 +32,7 @@
"\n", "\n",
"> The problem is to find some definition of `scan` as a reduction. In other words, we have to find some function `f` and an operator `⨂` so that\n", "> The problem is to find some definition of `scan` as a reduction. In other words, we have to find some function `f` and an operator `⨂` so that\n",
"\n", "\n",
" \\x = f(a)⨂f(b)⨂...⨂f(z)" " \\x = f(a)⨂f(b)⨂...⨂f(z)"
] ]
}, },
{ {
@ -153,7 +155,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 3,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -179,7 +181,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 4,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -205,7 +207,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 5,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -245,7 +247,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -254,7 +256,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -271,7 +273,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -288,7 +290,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -433,7 +435,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython2",
"version": "2.7.15" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,