Jupyter Offline Notebook
Save and load notebooks to browser storage, even if you've lost your connection to the server.
This should automatically enable the extension on Jupyter Notebook and JupyterLab 3.
pip install jupyter-offlinenotebook
jupyter labextension install jupyter-offlinenotebook
You should see up to five new buttons depending on your configuration and where you are running the notebook:
- download the in-memory (browser) state of the notebook
- save the in-memory state of the notebook to local-storage
- load a notebook from local-storage
- open the permanent URL of the repository containing this notebook
- copy the permanent mybinder URL to share this repository
Saving and loading uses the repository ID and the path of the current notebook.
You should always see the
Downloadbutton. If you are running this on mybinder all buttons should be visible. See the configuration section below to enable the other buttons on other systems.
ConfigurationThis extension can be configured in
jupyter_notebook_config.pyby setting the following properties of
WarningThis extension is still in development. It is only tested on Firefox. Breaking changes may occur in future.
There are several major limitations including:
- Local-storage is limited by quotas imposed by the browser.
- A repository ID and path of the notebook within Jupyter Notebook are used, joined by a
Development notesThis extension stores notebooks in browser storage using the IndexedDB API, wrapped with Dexie.js.
One server API call is made during initialisation to obtain the storage configuration. Everything else is done client-side so should work even if the server is disconnected.
jlpmcommand. Install the development dependencies:
To build and install the development version on Jupyter Notebook and JupyterLab 3:
pip install -r dev-requirements-jl3.txt
This automatically runs
pip install .
The notebook and server extensions should be automatically enabled. If for some reason it isn't (i.e. it's not listed in
jupyter nbextension listor
jupyter serverextension list) install and enable it:
JupyterLab 3 supports the installation of extensions as a static package so no further steps are required.
jupyter nbextension install --py jupyter_offlinenotebook --sys-prefix jupyter nbextension enable --py jupyter_offlinenotebook --sys-prefix jupyter serverextension install --py jupyter_offlinenotebook --sys-prefix jupyter serverextension enable --py jupyter_offlinenotebook --sys-prefix
Tagged releases of this repository are automatically published to PyPI and NPM.
pip install . jupyter labextension link
To test that the binder and repo buttons work when developing locally set some placeholder environment variables, e.g.:
BINDER_LAUNCH_HOST=http://localhost BINDER_REPO_URL=http://localhost BINDER_PERSISTENT_REQUEST=v2/gh/repo BINDER_REF_URL=http://localhost jupyter-lab --debug
If you make any changes remember to run all linters and auto-formatters:
pre-commit run -a
jlpm run eslint
jlpm run prettier