Skip to main content

No project description provided

Project description

jupyter-ws-tunnel

A WebSocket-shaped client and an ASGI server bridge that transparently falls back to a Jupyter widget comm when a real WebSocket can't be proxied (e.g. hosted Google Colab) — the same client code and the same ASGI app work in both deployments unchanged.

Install

pip install jupyter-ws-tunnel
npm install jupyter-ws-tunnel

Usage

JS — drop-in WebSocket replacement:

import { createSocket } from "jupyter-ws-tunnel";

// pass a widget model to tunnel over its comm; omit it for a real WebSocket
const socket = createSocket("/my-route", model);
socket.onmessage = (event) => console.log(event.data);

Python — attach an existing ASGI app's websocket route to a widget's comm:

from jupyter_ws_tunnel import attach_widget

attach_widget(widget, app)  # app is any ASGI3 app already being served

See example/ for a full working demo (a Quart app served both ways at once).

License

MIT

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

jupyter_ws_tunnel-0.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

jupyter_ws_tunnel-0.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_ws_tunnel-0.2.tar.gz.

File metadata

  • Download URL: jupyter_ws_tunnel-0.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for jupyter_ws_tunnel-0.2.tar.gz
Algorithm Hash digest
SHA256 51b01fea5d0835bc34c5d531b7e6096b44264bcf21aac17793273358775d878e
MD5 d4171e19c6caec2594cfcebd3ac64f38
BLAKE2b-256 00147ff5c92673c4084a6607f8ad35eb08b1f528aa2a7a69cbb8c535b4db429e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyter_ws_tunnel-0.2.tar.gz:

Publisher: publish-pypi.yml on hexane360/jupyter-ws-tunnel

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

File details

Details for the file jupyter_ws_tunnel-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_ws_tunnel-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 da265438d179b647df7fc9670c2347e91d7352189e7ab765dedb489e162b2e68
MD5 e38dfa9710f69fb3fd124c4899d8f519
BLAKE2b-256 4d2eaefbdb60b0c7a0045f0d869a04088dc2854ed360deec8a425375172748c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyter_ws_tunnel-0.2-py3-none-any.whl:

Publisher: publish-pypi.yml on hexane360/jupyter-ws-tunnel

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