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]

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.

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.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

rustygate-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

rustygate-0.1.0-py3-none-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for rustygate-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d2bf98523e871776abec4433f88a548eae5947d7ac0bed31cd06a1f6090af25
MD5 164c89a9d199cc241b81421ea1cd1891
BLAKE2b-256 124ef696f1b6fa5cd3a2f45e8cf9d123ad3cce935d4ebf62d7e27cdd9c65482d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.0-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.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rustygate-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2762cf797099e449828bb3ac78cea754b99fc7d9ea9202b0d0527b90773f1c38
MD5 2f1bb485446fbe5b951bc230cc81f7cf
BLAKE2b-256 647c296600675bc8ce13bc849728cc4c0537ddc34aa19ee334fd1619df40e5fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.0-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.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustygate-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d11736b37eab1886a60ccd1b78dca9d3a6a42c5ad8fe02b4f3ca9778f7bd0573
MD5 f1f0fd5cd43ffd6cae7e6dd5820ee36d
BLAKE2b-256 a97154da9a8836280e23fded988e024e3e52c51f29bd91076128973f053dea90

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustygate-0.1.0-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