Skip to main content

rustygate

A Jupyter kernel gateway as one binary: kernels, terminals, files, and per-cell notebook operations, over the same REST and websocket API shapes jupyter_server uses.

Running

rustygate [--host H] [--port N] [--token T] [--root DIR] [--tls]

The defaults are 127.0.0.1, port 8787, no auth, and the working directory as the files root. With a token set, requests carry Authorization: token T or ?token=T. --tls serves https and wss from a self-signed certificate generated at startup; clients opt out of verification (jupyasyncclient's verify=False).

The APIs

Kernels follow jupyter_server's routes: GET/POST /api/kernels, GET/DELETE /api/kernels/{id}, POST .../interrupt, POST .../restart, and the client websocket at .../channels. The kernel model adds pid, last_heartbeat, and path. A kernel that misses three heartbeats shows execution_state "unresponsive" until the next echo. The gateway never kills an unresponsive kernel. A kernel becomes dead only when its process exits.

Terminals mirror jupyter_server_terminals: GET/POST /api/terminals, GET/DELETE /api/terminals/{name}, and a websocket at .../channel. Binary frames carry pty bytes verbatim in both directions. Text frames carry JSON control messages: setup, gap, eof, and inbound set_size.

The files API is jupyter's contents API, notebook-blind and byte-oriented. GET/PUT/PATCH/POST/DELETE /api/contents/{path}. Every model carries name, path, type, size, mtime, and writable. Costly fields are requested with fields=, for example fields=hash,content. PATCH renames. POST copies, with copy_from in the body and the target as the path. DELETE refuses a non-empty directory.

The cells API edits ipynb files per cell. GET /api/cells/{path} returns the parsed cells and the file hash. fields=hashes returns per-cell hashes for cheap sync, and ids= fetches a subset. POST /api/cells/{path} applies a batch of ops atomically:

{"ops": [
  {"op": "add", "cell": {...}, "after": "id"},
  {"op": "update", "id": "x", "source": "..."},
  {"op": "delete", "id": "x"}
]}

Update replaces each provided key wholesale. Add without an anchor appends, and a missing cell id is generated and returned in added_ids. Any failure rolls back the whole batch.

Hashes and conditional writes

One hash serves everywhere: sha256 of the file's bytes, the same value in directory listings, contents models, cells responses, and broadcasts. Every mutation in both APIs accepts expected_hash and session_id query parameters. A stale expected_hash is rejected with 409 and the current hash. Per-cell hashes are opaque: compare them, never recompute them.

Change notifications

A kernel created with a path binds to that notebook, and every client on its websocket is subscribed. Changes arrive as ordinary Jupyter-envelope messages on the gateway-private cells channel, msg_type cell_ops, with the path, the new file hash, and ops in the same vocabulary as the cells API. The op author, identified by session_id, does not receive its own change. Writes through the contents API and foreign writes detected by the gateway's file watcher arrive the same way, as diffed ops. rename, deleted, and reset events join the stream; reset means re-fetch the file.

Ops are not writable over the websocket; use the REST APIs. After a reconnect that reports dropped messages, re-sync from GET /api/cells/{path}?fields=hashes instead of trusting the op stream.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

rustygate-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

rustygate-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

rustygate-0.1.1-py3-none-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file rustygate-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustygate-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2a8fcb9c10a1c1eea5be31f736fe546009f786485c1a3af883381e7b7e229cc
MD5 1db5cd86da79b7577fb6209c3fdfe099
BLAKE2b-256 25452dfbfc65b86b0dedc16d6ad6e72696254790a915491500ecbd4bc309c118

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on AnswerDotAI/rustygate

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

File details

Details for the file rustygate-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rustygate-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad3bd38d370e12cadd0174f6e23c4884f28d4a2eb2f2b30695ecc2a015b2fa1d
MD5 9cdef1d568e6b92e0b9f08e45daba2ef
BLAKE2b-256 738a3a0fac326547faf2e3d169644b5c95e6687d5c3fe03fd48bb435bbd6a736

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: ci.yml on AnswerDotAI/rustygate

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

File details

Details for the file rustygate-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustygate-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60c2307fda85fb5a0c2d66f2fee9cce9953e28cabe06ad614ac42a50e60c1089
MD5 663709fc600a80e993ceada045f0663a
BLAKE2b-256 4af345a8d279fcabcc2840abd69b93fa3f924af74a99e02b4c2e25e434a77e07

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.1-py3-none-macosx_11_0_arm64.whl:

Publisher: ci.yml on AnswerDotAI/rustygate

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 Sentry Error logging StatusPage Status page