Skip to main content

JupyterLite extension to connect to a remote Jupyter server

Project description

jupyterlite-remote-server

Github Actions Status

A JupyterLite extension that connects to a remote Jupyter server for all services (kernels, contents, settings, etc.).

This extension replaces JupyterLite's in-browser service implementations with standard JupyterLab service managers that communicate with a remote Jupyter server. This allows you to run a static JupyterLite frontend while using a real Jupyter server for all backend operations.

How It Works

The extension provides ServiceManagerPlugins that:

  1. Disable JupyterLite's in-browser service implementations
  2. Provide standard JupyterLab service managers configured to connect to a remote server
  3. Read server connection settings dynamically from PageConfig

Configuration

Configure the extension by setting these options in jupyter-lite.json:

Option Description
remoteBaseUrl The base URL of the remote Jupyter server (e.g., http://localhost:8888/)
remoteToken The authentication token for the remote server
appendToken Whether to append token to WebSocket URLs. If not set, auto-detects based on whether the base URL and WebSocket URL are on the same host

Usage with JupyterLite

1. Start the Jupyter Server

Start a Jupyter server with CORS enabled to allow connections from JupyterLite:

jupyter server --ServerApp.token=my-token --ServerApp.allow_origin='*'

2. Create JupyterLite Configuration

Create a jupyter-lite.json configuration file:

{
  "jupyter-lite-schema-version": 0,
  "jupyter-config-data": {
    "remoteBaseUrl": "http://localhost:8888/",
    "remoteToken": "my-token",
    "disabledExtensions": [
      "@jupyterlite/services-extension:config-section-manager",
      "@jupyterlite/services-extension:default-drive",
      "@jupyterlite/services-extension:event-manager",
      "@jupyterlite/services-extension:exporters",
      "@jupyterlite/services-extension:kernel-manager",
      "@jupyterlite/services-extension:kernel-client",
      "@jupyterlite/services-extension:kernel-spec-client",
      "@jupyterlite/services-extension:kernel-spec-manager",
      "@jupyterlite/services-extension:kernel-specs",
      "@jupyterlite/services-extension:localforage",
      "@jupyterlite/services-extension:nbconvert-manager",
      "@jupyterlite/services-extension:session-manager",
      "@jupyterlite/services-extension:settings",
      "@jupyterlite/services-extension:user-manager",
      "@jupyterlite/services-extension:workspace-manager"
    ]
  }
}

3. Build and Serve JupyterLite

# Install JupyterLite and this extension
pip install jupyterlite-core jupyterlite-remote-server

# Build the JupyterLite site
jupyter lite build

# Serve the built site
cd _output
python -m http.server 8000

Then open http://localhost:8000/lab/ in your browser.

See the demo/ directory for a complete example configuration.

Plugins Provided

This extension provides the following ServiceManagerPlugins:

Plugin Token Description
server-settings IServerSettings Remote server connection settings
default-drive IDefaultDrive Server-connected file drive
contents-manager IContentsManager File contents management
kernel-manager IKernelManager Kernel lifecycle management
kernel-spec-manager IKernelSpecManager Kernel specifications with URL rewriting
session-manager ISessionManager Session management
setting-manager ISettingManager User settings management
workspace-manager IWorkspaceManager Workspace persistence
user-manager IUserManager User information
event-manager IEventManager Server events
config-section-manager IConfigSectionManager Config section management
nbconvert-manager INbConvertManager Notebook conversion
terminal-manager ITerminalManager Terminal sessions

Requirements

  • JupyterLab >= 4.0.0
  • A running Jupyter server with CORS enabled

Install

pip install jupyterlite-remote-server

Uninstall

pip uninstall jupyterlite-remote-server

Contributing

Development install

# Clone the repo and change to the directory
git clone https://github.com/jtpio/jupyterlite-remote-server.git
cd jupyterlite-remote-server

# Set up a virtual environment
python -m venv .venv
source .venv/bin/activate

# Install in development mode
pip install --editable "."
jupyter labextension develop . --overwrite

# Rebuild after making changes
jlpm build

Development with watch mode

# Watch the source directory (in one terminal)
jlpm watch

# Run JupyterLab (in another terminal)
jupyter lab

Development uninstall

pip uninstall jupyterlite_remote_server

Then remove the symlink from jupyter labextension list location named jupyterlite-remote-server.

Packaging

See RELEASE

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

jupyterlite_remote_server-0.1.1.tar.gz (84.2 kB view details)

Uploaded Source

Built Distribution

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

jupyterlite_remote_server-0.1.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file jupyterlite_remote_server-0.1.1.tar.gz.

File metadata

File hashes

Hashes for jupyterlite_remote_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9c99b67069a10914a308f36a335d957142cb6455c5b52056d7f331eed2e2402c
MD5 d59407262c3726210f26921e631eae69
BLAKE2b-256 caf598c639c5978c32de370792c4b287589868e967c464ca443aee7dc636617d

See more details on using hashes here.

File details

Details for the file jupyterlite_remote_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlite_remote_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3159b378c888880f7787457b69c6f60001e0ca77845effbe60458ff8544ad14
MD5 c0d0aa0f31908e0e9dc354b62416db47
BLAKE2b-256 b57c6ed715199e841b18b5113307c57d2fd40550299f454cbb65a33732f6799f

See more details on using hashes here.

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