orangeqs.juice.client._kernel_hint#

IPython extension that tells users their personal kernel has no shared hardware.

The personal kernel of a user runs in the singleuser container. Only the kernel of the shared service can reach the shared hardware, such as USB serial devices. This extension makes the difference clear:

  • The kernel banner shows a note that this is the personal kernel.

  • When a cell fails with a device error, it adds a hint to the traceback.

Service kernels add the same hint with :func:add_device_error_hint.

juice proxy install installs the personal kernelspec that loads this extension.

Module Contents#

Functions#

add_device_error_hint

Add the hint as a note to an exception, if it is a device error.

load_ipython_extension

Set the personal kernel banner, and register the device hint.

Data#

SHARED_KERNEL_DISPLAY_NAME

Display name prefix of the kernel that can reach the shared hardware.

PERSONAL_KERNEL_NOTE

Note shown in the kernel banner.

DEVICE_ERROR_HINT

Hint added to the traceback of a device error.

API#

orangeqs.juice.client._kernel_hint.SHARED_KERNEL_DISPLAY_NAME#

‘Service: shared’

Display name prefix of the kernel that can reach the shared hardware.

orangeqs.juice.client._kernel_hint.PERSONAL_KERNEL_NOTE#

None

Note shown in the kernel banner.

orangeqs.juice.client._kernel_hint.DEVICE_ERROR_HINT#

None

Hint added to the traceback of a device error.

orangeqs.juice.client._kernel_hint.add_device_error_hint(value: BaseException) → None#

Add the hint as a note to an exception, if it is a device error.

IPython shows the notes of an exception at the end of its traceback. Python 3.10 has no exception notes, so there this function does nothing.

Parameters#

  • value: The exception to add the hint to.

orangeqs.juice.client._kernel_hint.load_ipython_extension(ip: IPython.core.interactiveshell.InteractiveShell) → None#

Set the personal kernel banner, and register the device hint.

Parameters#

  • ip: The IPython shell to register the hooks in.