# Jupyter Offline Notebook
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-offlinenotebook/main?urlpath=lab%2Ftree%2Fexample.ipynb)
[![PyPI](https://img.shields.io/pypi/v/jupyter-offlinenotebook.svg)](https://pypi.python.org/pypi/jupyter-offlinenotebook)
[![npm](https://img.shields.io/npm/v/jupyter-offlinenotebook)](https://www.npmjs.com/package/jupyter-offlinenotebook)
[![Build Status](https://github.com/manics/jupyter-offlinenotebook/workflows/Build/badge.svg)](https://github.com/manics/jupyter-offlinenotebook/actions)
Save and load notebooks to browser storage, even if you've lost your connection to the server.
## Installation
pip install jupyter-offlinenotebook
This should automatically enable the extension on Jupyter Notebook and JupyterLab.
This extension supports JupyterLab 3 and 4, and NBclassic.
Use [version 0.2.2](https://github.com/manics/jupyter-offlinenotebook/tree/v0.2.2) for JupyterLab 2 and Notebook <7.
## Usage
![Offline notebook buttons](./offline-notebook-buttons.png)
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 `Download` button.
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.
If you don't see the buttons check the Javascript console log.
See [example.ipynb](./example.ipynb)
## Configuration
This extension can be configured in `jupyter_notebook_config.py` by setting the following properties of `c.OfflineNotebookConfig`:
- `repository_id`:
A callable that returns the repository ID.
This is used when storing and retrieving notebooks.
Default is the value of the `BINDER_REPO_URL` environment variable.
- `repository_ref_url`:
A callable that returns the repository reference URL.
Default is the value of the `BINDER_REF_URL` environment variable.
- `binder_persistent_url`:
A callable that returns the repository reference URL.
Default is the values of the `BINDER_LAUNCH_HOST` and
`BINDER_PERSISTENT_REQUEST` environment variables.
- `binder_repo_label`:
A callable that returns the label used to link to the repository.
# Warning
This extension is still in development.
It is only tested on Firefox.
Breaking changes may occur in future.
There are [several major limitations](https://github.com/manics/jupyter-offlinenotebook/issues) 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 ` `.
This may change in future.
# Development notes
This extension stores notebooks in browser storage using the [IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API), wrapped with [Dexie.js](https://dexie.org/).
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.
The CI pipeline builds the extension with JupyterLab 4, but the build package works with JupyterLab 3 and NBclassic.
Install the development dependencies:
pip install -r dev-requirements-jl4.txt
To build and install the development version:
pip install .
This automatically runs `jlpm`.
The notebook and server extensions should be automatically enabled.
JupyterLab 3+ supports the installation of extensions as a static package so no further steps are required.
Tagged releases of this repository are automatically published to [PyPI](https://pypi.python.org/pypi/jupyter-offlinenotebook) and [NPM](https://www.npmjs.com/package/jupyter-offlinenotebook).
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 format`
Raw data
{
"_id": null,
"home_page": "https://github.com/manics/jupyter-offlinenotebook",
"name": "jupyter-offlinenotebook",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "Jupyter,JupyterLab",
"author": "Simon Li",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d4/41/cd3fa2e179d264250071a0f860aec5ce3e2cb95f365d07defd85bd5b5387/jupyter_offlinenotebook-0.3.1.tar.gz",
"platform": "Linux",
"description": "# Jupyter Offline Notebook\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-offlinenotebook/main?urlpath=lab%2Ftree%2Fexample.ipynb)\n[![PyPI](https://img.shields.io/pypi/v/jupyter-offlinenotebook.svg)](https://pypi.python.org/pypi/jupyter-offlinenotebook)\n[![npm](https://img.shields.io/npm/v/jupyter-offlinenotebook)](https://www.npmjs.com/package/jupyter-offlinenotebook)\n[![Build Status](https://github.com/manics/jupyter-offlinenotebook/workflows/Build/badge.svg)](https://github.com/manics/jupyter-offlinenotebook/actions)\n\nSave and load notebooks to browser storage, even if you've lost your connection to the server.\n\n## Installation\n\n pip install jupyter-offlinenotebook\n\nThis should automatically enable the extension on Jupyter Notebook and JupyterLab.\n\nThis extension supports JupyterLab 3 and 4, and NBclassic.\nUse [version 0.2.2](https://github.com/manics/jupyter-offlinenotebook/tree/v0.2.2) for JupyterLab 2 and Notebook <7.\n\n## Usage\n\n![Offline notebook buttons](./offline-notebook-buttons.png)\n\nYou should see up to five new buttons depending on your configuration and where you are running the notebook:\n\n- download the in-memory (browser) state of the notebook\n- save the in-memory state of the notebook to local-storage\n- load a notebook from local-storage\n- open the permanent URL of the repository containing this notebook\n- copy the permanent mybinder URL to share this repository\n\nSaving and loading uses the repository ID and the path of the current notebook.\n\nYou should always see the `Download` button.\nIf you are running this on mybinder all buttons should be visible.\nSee the configuration section below to enable the other buttons on other systems.\n\nIf you don't see the buttons check the Javascript console log.\n\nSee [example.ipynb](./example.ipynb)\n\n## Configuration\n\nThis extension can be configured in `jupyter_notebook_config.py` by setting the following properties of `c.OfflineNotebookConfig`:\n\n- `repository_id`:\n A callable that returns the repository ID.\n This is used when storing and retrieving notebooks.\n Default is the value of the `BINDER_REPO_URL` environment variable.\n- `repository_ref_url`:\n A callable that returns the repository reference URL.\n Default is the value of the `BINDER_REF_URL` environment variable.\n- `binder_persistent_url`:\n A callable that returns the repository reference URL.\n Default is the values of the `BINDER_LAUNCH_HOST` and\n `BINDER_PERSISTENT_REQUEST` environment variables.\n- `binder_repo_label`:\n A callable that returns the label used to link to the repository.\n\n# Warning\n\nThis extension is still in development.\nIt is only tested on Firefox.\nBreaking changes may occur in future.\n\nThere are [several major limitations](https://github.com/manics/jupyter-offlinenotebook/issues) including:\n\n- Local-storage is limited by quotas imposed by the browser.\n- A repository ID and path of the notebook within Jupyter Notebook are used, joined by a ` `.\n This may change in future.\n\n# Development notes\n\nThis extension stores notebooks in browser storage using the [IndexedDB API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API), wrapped with [Dexie.js](https://dexie.org/).\n\nOne server API call is made during initialisation to obtain the storage configuration.\nEverything else is done client-side so should work even if the server is disconnected.\n\nThe CI pipeline builds the extension with JupyterLab 4, but the build package works with JupyterLab 3 and NBclassic.\nInstall the development dependencies:\n\n pip install -r dev-requirements-jl4.txt\n\nTo build and install the development version:\n\n pip install .\n\nThis automatically runs `jlpm`.\n\nThe notebook and server extensions should be automatically enabled.\n\nJupyterLab 3+ supports the installation of extensions as a static package so no further steps are required.\n\nTagged releases of this repository are automatically published to [PyPI](https://pypi.python.org/pypi/jupyter-offlinenotebook) and [NPM](https://www.npmjs.com/package/jupyter-offlinenotebook).\n\nTo test that the binder and repo buttons work when developing locally set some placeholder environment variables, e.g.:\n\n```\nBINDER_LAUNCH_HOST=http://localhost BINDER_REPO_URL=http://localhost BINDER_PERSISTENT_REQUEST=v2/gh/repo BINDER_REF_URL=http://localhost jupyter-lab --debug\n```\n\nIf you make any changes remember to run all linters and auto-formatters:\n\n- `pre-commit run -a`\n- `jlpm run format`\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Save and load notebooks to local-storage",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/manics/jupyter-offlinenotebook"
},
"split_keywords": [
"jupyter",
"jupyterlab"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "80b7b699203c66de5ade1c6f952bcf0c073216742043c0e66fa412f3002d7a32",
"md5": "1d4d50b3e04062556c06ef79af7f4563",
"sha256": "fdafb27be007eeb117e17db9be3dab8d57737245758a5f0c45cb966227607d64"
},
"downloads": -1,
"filename": "jupyter_offlinenotebook-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d4d50b3e04062556c06ef79af7f4563",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 330680,
"upload_time": "2024-02-12T23:51:11",
"upload_time_iso_8601": "2024-02-12T23:51:11.213797Z",
"url": "https://files.pythonhosted.org/packages/80/b7/b699203c66de5ade1c6f952bcf0c073216742043c0e66fa412f3002d7a32/jupyter_offlinenotebook-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d441cd3fa2e179d264250071a0f860aec5ce3e2cb95f365d07defd85bd5b5387",
"md5": "dc9ba9243e19aecfdc6067806123f4fa",
"sha256": "914f9c72f1c085f4a771b61ad28b7ee737a7e1b613388ec74556815c8eb93d3b"
},
"downloads": -1,
"filename": "jupyter_offlinenotebook-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "dc9ba9243e19aecfdc6067806123f4fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 261844,
"upload_time": "2024-02-12T23:51:13",
"upload_time_iso_8601": "2024-02-12T23:51:13.153001Z",
"url": "https://files.pythonhosted.org/packages/d4/41/cd3fa2e179d264250071a0f860aec5ce3e2cb95f365d07defd85bd5b5387/jupyter_offlinenotebook-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-12 23:51:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "manics",
"github_project": "jupyter-offlinenotebook",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "jupyter-offlinenotebook"
}