jupywire
jupywire provides shared Jupyter protocol code for kernmini, jupygate, jupyasyncclient, and conkernelclient. It handles wire-format messages, connection files, and common kernel-client operations.
What's here
The package has four modules:
jupywire.sessionprovidesSessionfor constructing and HMAC-signing Jupyter messages. It serializes and deserializes frames and provides replay protection. The module also includes websocket JSON helpers (dumpsandloads), binary helpers (serialize_binary_messageanddeserialize_binary_message), andvalidate_string_dict.jupywire.connectprovideswrite_connection_file. It selects random free ports and writes a kernel connection file with permissions0600.jupywire.routeprovidesRouterOpsfor routing kernel-client messages andJmsgQueuesfor queue-based access to them.jupywire.opsprovidesEvalOps, a mixin for evaluation and variable operations on kernel clients.
Install
pip install jupywire
Client messages
RouterOps provides these ways to receive execution results:
reply()awaits oneexecute_reply.run()sends the execution request when called. It returns an async generator of every message caused by that execution.exec_outscollects the results fromrunand returns a list of rendered results.
run uses each return value from on_stdin to send an input_reply with the correct parent. allow_stdin defaults to whether an on_stdin hook is present. Pass allow_stdin=True without a hook to handle prompts through the application's on_jmsg callback.
Every inbound message also goes once to the application's on_jmsg callback, in receive order, after request routing. This includes collected run messages and stdin handled by a run callback. Receiving a notification does not transfer ownership of that stdin exchange. Keep the handler a cheap dispatcher; an awaitable return blocks the transport reader until it completes. Use JmsgQueues to pull the same messages from queues.
request sends any named protocol request. shell and control provide channel-specific helpers. Named methods include complete, inspect, check, history, and comm_msg.
The transport must supply execute, send, and a session. Its read loop passes incoming messages to route. DESIGN.md specifies the full contract. Both clients inherit the conformance suite in tests/test_route.py.
Evaluation and variables
EvalOps provides eval, ipy, the ipyfuncs service methods, retr, eval_expr, and user_exprs. It also provides xpush and xenv for synchronous fire-and-forget calls.
These operations use the client's reply or execute method. reply waits for a shell reply. execute sends without awaiting a reply.
Pass sidecar_=True to evaluate in the persistent sidecar. kernmini creates a missing named subshell on first use. Variable operations use this serial sidecar by default. Ordinary eval calls use the main shell by default.
Credits
jupywire.session and jupywire.connect are adapted from jupyter_client, specifically jupyter_client.session, jupyter_client.connect, and jupyter_client.client. Copyright (c) Jupyter Development Team. The source is distributed under the Modified BSD License (BSD-3-Clause). See that project's COPYING.md.
The adaptations remove traitlets and retain wire compatibility. Each module's docstring records its differences from the original.
Release files for jupywire 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jupywire-0.1.10.tar.gz | 24.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jupywire-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.1 kB
Release files / jupywire-0.1.10.tar.gz
| Download URL | jupywire-0.1.10.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b81d7807d2115f77b24d03c9ccf9a55f0ef100d5f50d49c1fc3062ec23a08d97
|
|
BLAKE2b-256 checksum How to use checksums |
4b7b22e511f08de3f49500ed032c195a8c44f72ca16437371b19a75aa0929676
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / jupywire-0.1.10-py3-none-any.whl
| Download URL | jupywire-0.1.10-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
416767f1b1a513592ece5a5cd9ede6e269d088512df5ec08b937cab22ab7446f
|
|
BLAKE2b-256 checksum How to use checksums |
278ab0222002a4ea3b078dae88f22f0a6992971621f6183cab4566bb68a6ce66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|