This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add function to install notebook extensions, switch command line from…
… ipython to jupyter, update documentation improve function to run notebooks offline
- Loading branch information
Showing
14 changed files
with
1,185 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Javascript extension for a notebook" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": false, | ||
"run_control": { | ||
"marked": false | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from pyquickhelper.ipythonhelper import load_extension, install_notebook_extension, get_installed_notebook_extension" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"We check the list of installed extensions (from [IPython-notebook-extensions](https://github.com/ipython-contrib/IPython-notebook-extensions/wiki)):" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"['IPython-notebook-extensions-master/config/main',\n", | ||
" 'IPython-notebook-extensions-master/publishing/nbviewer_theme/main',\n", | ||
" 'IPython-notebook-extensions-master/publishing/printview/main',\n", | ||
" 'IPython-notebook-extensions-master/slidemode/main',\n", | ||
" 'IPython-notebook-extensions-master/styling/css_selector/main',\n", | ||
" 'IPython-notebook-extensions-master/styling/zenmode/main',\n", | ||
" 'IPython-notebook-extensions-master/testing/hierarchical_collapse/main',\n", | ||
" 'IPython-notebook-extensions-master/testing/swc/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/chrome-clipboard/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/codefolding/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/dragdrop/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/exercise/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/hide_input/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/init_cell/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/limit_output/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/navigation-hotkeys/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/python-markdown/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/rubberband/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/runtools/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/search-replace/main',\n", | ||
" 'IPython-notebook-extensions-master/usability/skip-traceback/main']" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"get_installed_notebook_extension()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"If the list is empty, we install them:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": { | ||
"code_folding": [], | ||
"collapsed": false, | ||
"run_control": { | ||
"marked": false | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"downloading https://github.com/ipython-contrib/IPython-notebook-extensions/archive/master.zip to C:\\Users\\auser\\AppData\\Local\\Temp\\tmpt0c6mp8q\\master.zip\n", | ||
"extracting C:\\Users\\auser\\AppData\\Local\\Temp\\tmpt0c6mp8q\\master.zip to C:\\ProgramData\\jupyter\\nbextensions\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"install_notebook_extension()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"And then, we load one of them:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": { | ||
"code_folding": [], | ||
"collapsed": false, | ||
"input_collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/javascript": [ | ||
"IPython.utils.load_extensions('IPython-notebook-extensions-master/usability/search-replace/main')" | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Javascript object>" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"%%javascript\n", | ||
"IPython.utils.load_extensions('IPython-notebook-extensions-master/usability/search-replace/main')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Or if you prefer with pyquickhelper:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"code_folding": [ | ||
0 | ||
], | ||
"collapsed": false, | ||
"input_collapsed": false, | ||
"run_control": { | ||
"marked": true | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/javascript": [ | ||
"IPython.utils.load_extensions('IPython-notebook-extensions-master/usability/hide_input/main')" | ||
], | ||
"text/plain": [ | ||
"<IPython.core.display.Javascript object>" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"load_extension('IPython-notebook-extensions-master/usability/hide_input/main')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true, | ||
"input_collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"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.4.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.