Sign inDemoInstall


Package Overview
File Explorer

Install Socket

Protect your apps from supply chain attacks



A Jupyter Server Session Manager that rehydrates and synchronizes Jupyter sessions (e.g. notebook-kernel connections).




Jupyter Server Synchronizer

A Jupyter Server Session Manager that rehydrates and persists kernels and sessions beyond the lifetime of a server.

This is particularly useful for Jupyter Servers running remote kernels and contents.

Basic usage

Install and enable the extension:

pip install jupyter_server_synchronizer

jupyter server extension enable jupyter_server_synchronizer

When you start a Jupyter Server, it synchronize all managers before the Web application is started.

jupyter server --ServerApp.session_manager_class=jupyter_server_synchronizer.SynchronizerSessionManager

To synchronize periodically, enable the auto-synchronizing feature using the autosync config option. For example,

jupyter server --ServerApp.session_manager_class=jupyter_server_synchronizer.SynchronizerSessionManager --SynchronizerSessionManager.autosync=True

Otherwise, you can trigger the synchronization making a POST request to the /api/sync endpoint.


Below is a example of running the synchronizer with Jupyter Server talking to a Jupyter Kernel Gateway as its "remote" kernel service provider.

First, start the Kernel Gateway. You'll need to enable the list_kernels method. In the example, we are assuming the Kernel Gateway is not multi-tenant; i.e. there is a single KG for a single Jupyter Server. We'll set the port to 9999 to free up 8888 for our Jupyter Server.

jupyter kernelgateway \
    --port 9999 \

Second, start the Jupyter Server and point it at the Kernel Gateway. Note that we set a database_filepath trait in both the SessionManager and SynchronizerExtension (these paths don't need to be the same). The Synchronize relies on saving/storing of information about Jupyter kernels and sessions in a persistent database. This information is necessary to rehydrate and synchronize.

We'll enable the "autosync" feature to periodically synchronize the server.

jupyter lab \
    --gateway-url= \
    --SynchronizerSessionManager.database_filepath=jupyter-database.db \
    --SynchronizerSessionManager.autosync=True \

Now, let's kill that server:

kill -9 $(echo $(pgrep -lf jupyter-lab) | awk '{print $1;}')

And restart it to see if the kernels rehydrate and begin synchronizing again.

jupyter lab \
    --gateway-url= \
    --SessionManager.database_filepath=jupyter-database.db \
    --SynchronizerSessionManager.autosync=True \



Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc