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.2.tar.gz (83.5 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.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for jupyterlite_remote_server-0.1.2.tar.gz
Algorithm Hash digest
SHA256 334acc8ce97f75d570ff7e4f2ab08dbb353296e6a32ea429c4f5a78b799f8624
MD5 494525057673ed3f9f457711c7cf3b4d
BLAKE2b-256 3936ab12c5c896d81d9f959cfceabf4bd34b53f9e36e343949a8854e902be860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jupyterlite_remote_server-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f75c3ad6d97a7b1fecbc8d385f46630eae6a425d1ad8dab4a8b6c0be1f772388
MD5 6f0dc279a3741b7a7259be2feb2eecac
BLAKE2b-256 846b3c6484e7ff6992ec51bf0831a6dcc97e6078af847692836f13754e0c848c

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