pywwt.jupyter_relay Module

pywwt client support for the WWT Jupyter Kernel Data Relay.

Say that you’re running pywwt inside JupyterLab, and you want to use it to view a large FITS file. That file needs to be broken into tiles in order for it to be viewable: it’s both unpleasant and impractical to require the your web browser to download a gigabyte of data in order to render it with WebGL. That’s why we have tools like toasty to automate our data processing.

But this exposes a data flow problem. The WWT viewer is running in your web browser. It’s talking to a Jupyter HTTP server, possibly across the internet, which is in turn talking to a Python kernel which in turn may be running on yet another machine, quite possibly one that’s not accessible on the open internet. In order to view your data, we need to make data files on the pywwt machine “visible” on the open internet so that WWT, running in your web browser, can retrieve them.

The only reliable way to do this is through the Jupyter server. Unfortunately we know of no built-in way for kernels to plug data into the server. Therefore we have created the wwt_kernel_data_relay Python package, a Jupyter server extension that makes it possible for kernels to request to publish data through the Jupyter server. This publication is done using extensions to the ZMQ-based messaging framework that Jupyter servers use to control Jupyter kernels.

This module implements the kernel side of the Kernel Data Relay (KDR) protocol for pywwt. The ultimate interface is that other code can request that individual files or directory trees be made available for service. This module returns a partial URL that can then be forwarded to the Jupyter frontend (the JS layer, not the server) or the user (e.g. by printing it out).

Functions

get_relay_hub([kernel])

Get the global singleton Kernel Data Relay (KDR) client.

Classes

JupyterRelayHub([kernel, key_prefix])

pywwt's WWT Kernel Data Relay client.