from seeq import spy

# Set the compatibility option so that you maximize the chance that SPy will remain compatible with your notebook/script
spy.options.compatibility = 192
# Log into the Seeq Server if you're not using Seeq Data Lab:
spy.login(url='http://localhost:34216', credentials_file='../credentials.key', force=False)


A set of ipython widgets designed specifically for working with Seeq.

These widgets can be used on their own or incorporated into an ipywidgets UI.


The Seeq Item Selector is a configurable item selector. Creating a basic item selector that allows searching for seeq items by name and type can be created with no arguments.

item_selector1 = spy.widgets.SeeqItemSelect()

Once a search has been performed, an item may be selected in the results window and information on that item is available through the selected_value attribute. Perform a search in the above selector and select an item before running the next cell.


There are a number of options available which can be found in the widget’s documentation. In this example, the widget will be shown with: - search fields of name, type, a datasource dropdown and a selector to include archived items - type options limited to ‘Signal’, ‘Condition’, and ‘Scalar’ - a default type of ’Condition - a collapsible help window - a results window 15 rows long - a maximum of 200 results displayed - the ability to select multiple items

item_selector2 = spy.widgets.SeeqItemSelect(
    show_fields=['Name', 'Type', 'Datasource Dropdown', 'Archived'],
    type_options=['Signal', 'Condition', 'Scalar'],

Logging Widget and WidgetLogHandler

This tutorial shows how to use the spy.widgets.LogWindowWidget with the spy.widgets.WidgetLogHandler. Keep in mind that the WidgetLogHandler can be used with any ipywidget that has a value property, so you are not required to use the LogWindowWidget to display your logs.

import logging

Setting up the widget and handler

First, create the logging widget

log_widget = spy.widgets.LogWindowWidget('<b>Log Output</b>')

Then, create a log handler and configure it’s behavior

widget_log_handler = spy.widgets.WidgetLogHandler()
formatter = logging.Formatter('[%(levelname)s] %(asctime)s - %(message)s')

To make the widget_log_handler handling level change when the widget level changes, we need to register the handler with the logging widget.


We’ll display the widget here.


Finally, get the logger that you want to use and set it’s log level and register the WidgetLogHandler as one of its handlers. Remember Python loggers have a variety of ways that levels are set, but generally you set a low level for the logger, then higher levels for your handlers.

I’m going to use the root logger. This likely isn’t what you want as it will also handle jupyter logs. If you get a higher level logger, remember that it will inherit it’s log level from the root logger (or any logger below it), so if you are using multiple loggers, it’s good practice to set the root logger to NOTSET or DEBUG since the default is WARNING. Also, if you register the handler with multiple loggers that see the same message (loggers have inheritance!) you’ll see your message multiple times in the window.

logger = logging.getLogger()
# add the handler
# log some messages!
# You can change the widget log level and see how it's behaviour changes when you re-run this cell.'An info message')
logger.warning('A warning!')
logger.error('Uh ERROR!!!')