Skip to main content

An IPython Kernel that automatically saves and restores Jupyter Notebook execution states.

Project description

ElasticKernel

Never lose your Jupyter variables to a kernel restart again.

ElasticKernel is a custom IPython kernel that automatically checkpoints your notebook's execution state and restores it after a restart or crash — no manual pickle.dump required. Pick up exactly where you left off.

PyPI version Downloads Downloads/month License

🇯🇵 日本語版は README.ja.md を参照してください。

Demo

The same workflow in both clips: define a variable a = 1, then restart the kernel. The difference is what happens next.

Standard kernel (ipykernel) ElasticKernel
❌ After the restart, a is gone%whos reports "Interactive namespace is empty." ✅ After the restart, a is automatically restored%whos still shows a  int  1.

If the videos don't play inline, click them to view: ipykernel · ElasticKernel.

Why ElasticKernel?

Every Jupyter user has been there: a long computation finishes, then an accidental kernel restart (or an out-of-memory crash) wipes every variable in your session. The usual workaround is scattering pickle.dump / joblib.dump calls everywhere and remembering to reload them by hand.

ElasticKernel removes that chore entirely:

  • 🔄 Automatic state recovery — your variables survive kernel restarts and shutdowns, with zero changes to your code.
  • 🧠 Dependency-aware — tracks how cells and variables depend on one another to restore a consistent state.
  • Cost-optimized checkpoints — for each variable it decides whether to serialize it or recompute it on restore, based on serialization size vs. recomputation cost (a min-cut optimization).
  • 🪄 Drop-in — just pick the Python 3 (ElasticKernel) kernel; the rest of your workflow is unchanged.

Installation & Usage

Local

  1. Install the package:

    $ pip install elastic-kernel
    
  2. Install the kernel:

    $ elastic-kernel install
    Elastic Kernel installed from: /path/to/elastic_kernel
    
  3. Verify the kernel is installed:

    $ jupyter kernelspec list
    Available kernels:
      elastic_kernel    /path/to/Jupyter/kernels/elastic_kernel
    
  4. Launch JupyterLab:

    $ jupyter lab --ip=0.0.0.0
    
  5. Open JupyterLab in your browser.

  6. Select the Python 3 (ElasticKernel) kernel.

Docker

  1. Pull the image:

    docker pull ghcr.io/mryutaro/elastickernel
    
  2. Start a container:

    docker run -p 8888:8888 ghcr.io/mryutaro/elastickernel
    
  3. Open JupyterLab in your browser.

  4. Select the Python 3 (ElasticKernel) kernel.

How It Works

ElasticKernel extends the IPython kernel to observe each cell execution. As you run cells it builds a dependency graph of variables and the cell executions that produce them. When the kernel shuts down or restarts, it profiles serialization speed, runs a cost optimizer to split variables into a migrate set (serialized to disk) and a recompute set (regenerated by re-running cells), and writes a checkpoint. On the next start it loads the checkpoint, injects the migrated variables back into your namespace, and recomputes the rest.

Documentation

Publication

This project was presented in the following paper. If you use ElasticKernel in your research, please cite:

R. Matsumoto, K. Taniguchi, T. Hayami, K. Takahashi, and S. Date. "ElasticHub: A Cost-Efficient JupyterHub Platform via Automated Scaling with Kubernetes on Hybrid Cloud." Proceedings of the 16th International Conference on Cloud Computing and Services Science, pp. 261–268, 2026. DOI: 10.5220/0014840200004039

@inproceedings{matsumoto2026elastichub,
  author    = {Matsumoto, R. and Taniguchi, K. and Hayami, T. and Takahashi, K. and Date, S.},
  title     = {ElasticHub: A Cost-Efficient JupyterHub Platform via Automated Scaling with Kubernetes on Hybrid Cloud},
  booktitle = {Proceedings of the 16th International Conference on Cloud Computing and Services Science},
  year      = {2026},
  pages     = {261--268},
  isbn      = {978-989-758-829-7},
  issn      = {2184-5042},
  doi       = {10.5220/0014840200004039}
}

Acknowledgments

This project includes code from ElasticNotebook, developed at the University of Illinois. ElasticNotebook is licensed under the Apache License 2.0.

Zhaoheng Li, Pranav Gor, Rahul Prabhu, Hui Yu, Yuzhou Mao, Yongjoo Park. "ElasticNotebook: Enabling Live Migration for Computational Notebooks." Proceedings of the VLDB Endowment, Vol. 17, No. 2, pp. 119-133, 2023.

License

Licensed under the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elastic_kernel-0.0.31.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elastic_kernel-0.0.31-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file elastic_kernel-0.0.31.tar.gz.

File metadata

  • Download URL: elastic_kernel-0.0.31.tar.gz
  • Upload date:
  • Size: 55.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for elastic_kernel-0.0.31.tar.gz
Algorithm Hash digest
SHA256 ba89af01e7a291a06822566c5ba3cce717d5ae742997952a7eb2adea3d983847
MD5 3f2a1387f8d9c87b8c391b0741c3d0a1
BLAKE2b-256 90590e00d286a77cc1e81dd551ca5ef11c55b00f4c30a7647c7bad87ff04be84

See more details on using hashes here.

Provenance

The following attestation bundles were made for elastic_kernel-0.0.31.tar.gz:

Publisher: publish-to-pypi.yml on MRyutaro/ElasticKernel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file elastic_kernel-0.0.31-py3-none-any.whl.

File metadata

  • Download URL: elastic_kernel-0.0.31-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for elastic_kernel-0.0.31-py3-none-any.whl
Algorithm Hash digest
SHA256 f8cd72efadb9fabe65f0ebb8098def4948e5c34399b4a483a28d10f60fa4ccf1
MD5 c84fd35441b4efede1cd1447444e28cf
BLAKE2b-256 3f40278b3fa46a0e0e69bf53cf3795960c097f2348e77bfbd9e4cffa9ec7fd53

See more details on using hashes here.

Provenance

The following attestation bundles were made for elastic_kernel-0.0.31-py3-none-any.whl:

Publisher: publish-to-pypi.yml on MRyutaro/ElasticKernel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page