JupyterRelayHub¶
- class pywwt.jupyter_relay.JupyterRelayHub(kernel=None, key_prefix='pywwt_')[source]¶
Bases:
object
pywwt’s WWT Kernel Data Relay client.
This is a singleton, per-process object, because Jupyter kernel-server connections are per-process.
Methods Summary
Get a partial URL where static files bundled with pywwt can be obtained.
serve_file
(path[, extension, key])Request that a single specific file be published.
serve_tree
(path[, key])Request that a directory tree of files be published.
Methods Documentation
- get_static_files_url()[source]¶
Get a partial URL where static files bundled with pywwt can be obtained.
- Returns:
- url
str
A partial URL.
- url
Notes
The returned URL will not be an absolute URL. It will end with a trailing slash. In order to be turned into a retrievable URL, it must be combined with the public-facing URL of the running Jupyter server in the JavaScript frontend – the kernel does not have that information.
The static files are stored in the
pywwt/web_static
subdirectory of the distributed pywwt package.Unlike user data, the static files are served with a predictable KDR key based on the version of pywwt, since identical versions should be serving identical data.
- serve_tree(path, key=None)[source]¶
Request that a directory tree of files be published.
- Parameters:
- Returns:
- url
str
A partial URL, ending in a trailing slash, below which the file data will be made accessible.
- url
Notes
The returned URL will not be an absolute URL. It will end with a trailing slash. In order to be turned into a retrievable URL, it must be combined with the public-facing URL of the running Jupyter server in the JavaScript frontend – the kernel does not have that information.
If key is unspecified, a stable-but-opaque KDR key is used. Currently it’s a cryptographic hash of the input path.