Skip to content

Instantly share code, notes, and snippets.

@ruxi
Last active March 11, 2016 04:25
Show Gist options
  • Save ruxi/fc743676a3752ae14959 to your computer and use it in GitHub Desktop.
Save ruxi/fc743676a3752ae14959 to your computer and use it in GitHub Desktop.
nbextension/NBextension.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"run_control": {
"read_only": false
}
},
"cell_type": "markdown",
"source": "**Intent**: view currently installed nbextensions and toggle off\n\ngist: https://gist.github.com/ruxi/fc743676a3752ae14959"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# How to install NBExtensions GUI for jupyter notebook 4.1"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "source: https://github.com/ipython-contrib/IPython-notebook-extensions"
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "%load_ext version_information\n%version_information ",
"execution_count": 1,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": "<table><tr><th>Software</th><th>Version</th></tr><tr><td>Python</td><td>3.5.1 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]</td></tr><tr><td>IPython</td><td>4.1.2</td></tr><tr><td>OS</td><td>Linux 4.2.0 27 generic x86_64 with debian jessie sid</td></tr><tr><td colspan='2'>Thu Mar 10 22:06:50 2016 CST</td></tr></table>",
"text/latex": "\\begin{tabular}{|l|l|}\\hline\n{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\nPython & 3.5.1 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] \\\\ \\hline\nIPython & 4.1.2 \\\\ \\hline\nOS & Linux 4.2.0 27 generic x86\\_64 with debian jessie sid \\\\ \\hline\n\\hline \\multicolumn{2}{|l|}{Thu Mar 10 22:06:50 2016 CST} \\\\ \\hline\n\\end{tabular}\n",
"application/json": {
"Software versions": [
{
"version": "3.5.1 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]",
"module": "Python"
},
{
"version": "4.1.2",
"module": "IPython"
},
{
"version": "Linux 4.2.0 27 generic x86_64 with debian jessie sid",
"module": "OS"
}
]
},
"text/plain": "Software versions\nPython 3.5.1 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]\nIPython 4.1.2\nOS Linux 4.2.0 27 generic x86_64 with debian jessie sid\nThu Mar 10 22:06:50 2016 CST"
},
"metadata": {},
"execution_count": 1
}
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# To install \n\n```python\npip install https://github.com/ipython-contrib/IPython-notebook-extensions/archive/master.zip --user\n```\n\nNavigate to [/nbextensions](/nbextensions) and toggle ON/OFF desired\n\n\n---\n\nalternative is to git clone and use setup.py\n"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# To Uninstall"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# Locate jupyter paths"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "View contents of local and global jupyter notebook directory"
},
{
"metadata": {
"collapsed": false
},
"cell_type": "markdown",
"source": "\n\n```python\nfrom __future__ import print_function\nfrom jupyter_core.paths import jupyter_data_dir, jupyter_path\nimport os.path\nprint('local', os.listdir(jupyter_data_dir()))\nprint('global', [os.listdir(path) for path in jupyter_path() if os.path.isdir(path)])\n```"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "list directory\n\n```python\n\nprint(jupyter_data_dir()) #local\nprint(jupyter_path()) #global\n\n```"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# Locate extensions yml files"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Simply delete the remove the extension from [/nbextensions menu](/nbextensions)"
},
{
"metadata": {
"trusted": true,
"collapsed": true
},
"cell_type": "code",
"source": "# source: https://github.com/ipython-contrib/IPython-notebook-extensions/issues/529#issuecomment-195110905\n# https://github.com/jcb91\nfrom __future__ import print_function\nimport os.path\nfrom itertools import chain\nfrom jupyter_core.paths import jupyter_data_dir\nfrom notebook.nbextensions import _get_nbext_dir as get_nbext_dir\n\nnbextension_dirs = (get_nbext_dir(), os.path.join(jupyter_data_dir(), 'nbextensions'))\nyaml_files = []\nfor root, dirs, files in chain.from_iterable(os.walk(nb_ext_dir, followlinks=True) for nb_ext_dir in nbextension_dirs):\n for filename in files:\n if filename.endswith('.yaml'):\n yaml_files.append(os.path.join(root, filename))\n\nfor yaml_path in sorted(yaml_files):\n print(yaml_path)",
"execution_count": null,
"outputs": []
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## troubleshooting\n\n- https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/config-extension"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# version control"
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "%%writefile .gitignore\nipynb_checkpoints*",
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": "Overwriting .gitignore\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true,
"collapsed": false
},
"cell_type": "code",
"source": "%%bash \ngit add --all :/\ngit commit -a -m 'save gist'\ngit push origin master",
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": "[master 6f47770] save gist\n 1 file changed, 95 insertions(+)\n",
"name": "stdout"
},
{
"output_type": "stream",
"text": "fatal: could not read Username for 'https://gist.github.com': No such device or address\n",
"name": "stderr"
}
]
}
],
"metadata": {
"language_info": {
"mimetype": "text/x-python",
"file_extension": ".py",
"nbconvert_exporter": "python",
"version": "3.5.1",
"pygments_lexer": "ipython3",
"codemirror_mode": {
"version": 3,
"name": "ipython"
},
"name": "python"
},
"kernelspec": {
"name": "python3",
"display_name": "IPython (Python 3)",
"language": "python"
},
"latex_envs": {
"eqLabelWithNumbers": true,
"cite_by": "apalike",
"bibliofile": "biblio.bib",
"current_citInitial": 1,
"eqNumInitial": 0
},
"gist": {
"id": "",
"data": {
"description": "nbextension/NBextension.ipynb",
"public": false
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment