SPy Widgets

class seeq.spy.widgets.LogWindowWidget(**kwargs: Any)

Bases: VBox

An window for logging messages.

See SPy Documentation/spy.widgets.Log.ipynb for usage.


title (str) – The title of the widget as an HTML string

class seeq.spy.widgets.SeeqItemSelect(**kwargs: Any)

Bases: VBox

An iPython widget to search for items in Seeq.

  • title (str) – A title for the widget, displayed above the tool

  • item_type (str) – One of ‘Signal’, ‘Condition’, ‘Scalar’, ‘Asset’, ‘Histogram’, ‘Metric’, ‘Datasource’, ‘Workbook’, ‘Worksheet’, or ‘Display’ as the default item type. Must be listed in type_options.

  • item_name (str) – A default value for the item name search term

  • item_path (str) – A default value for the item search path

  • item_description (str) – A default value for the item description search term

  • item_datasource_name (str) – A default value for the item datasource name. If a datasource dropdown is used and item_datasource_name is available in the list of available Seeq datasources, it will be selected by default.

  • item_datasource_id (str) – A default value for the item datasource id

  • item_datasource_class (str) – A default value for the item datasource class

  • item_archived (bool) – A default value for the item “is archived” setting

  • item_scoped_to (str) – A default value for the item workbook the item is scope to

  • show_fields (list, default ['Name', 'Type']) –

    A list indicating which fields should be shown. Options are [‘Name’, ‘Type’, ‘Path’, ‘Description’, ‘Datasource Dropdown’, ‘Datasource Name’, ‘Datasource ID’, ‘Datasource Class’, ‘Archived’, ‘Scoped To’]

    Note that if Datasource Dropdown is used in conjunction with Datasource Name, Datasource ID, and Datasource Class, the entry in Datasource Dropdown will override entries in the other fields.

  • type_options (list(str)) – The options for the Types dropdown. Possible values are: [‘Signal’, ‘Scalar’, ‘Condition’, ‘Asset’, ‘Chart’, ‘Metric’, ‘Datasource’, ‘Workbook’, ‘Worksheet’]

  • datasource_dropdown (bool, default True) – Use a dropdown menu to select the appropriate datasource. Requires an authenticated connection to Seeq at instantiation.

  • multi_select (bool, default False) – If True, multiple items can be selected and the “selected_value” will return a list of dicts

  • results_box_rows (int) – The number of rows in the results box

  • max_displayed_results (int) – The maximum number of results displayed in the results box

  • show_system_datasources (bool, default False) – If True, show system datasources in the datasource dropdown. For example, the “Auth” datasource is a system datasource.

  • show_help (bool, default False) – If True, show an accordion with help information will be displayed at the top of the widget.

  • session (spy.Session, optional) – If supplied, the Session object (and its Options) will be used to store the login session state. This is useful to log in to different Seeq servers at the same time or with different credentials.

  • **kwargs

    debugbool, default False

    Flag for debug mode. In debug mode search terms and the list of items found in Seeq are printed when the search button is pressed.

    Remaining keyword arguments are passed to the VBox super class


Display a search and select box that:

  • has the default fields of Name and Type

  • has a hidden filter for Datasource Name == ‘test data’

  • allows only one item to be selected

>>> item_selector = SeeqItemSelect(
>>>     item_datasource_name='test data')
>>> display(item_selector)

Display a search and select box that is 500 pixels wide that:

  • has fields for Name, Type, and a dropdown menu for Datasources

  • allows multiple selections

  • allows searching for signals and conditions, with a default of Signal

>>> item_selector = SeeqItemSelect(
>>>     show_fields=['Name', 'Type', 'Datasource Dropdown'],
>>>     multi_select=True,
>>>     type_options=['Signal', 'Condition'],
>>>     item_type='Signal')
>>> item_selector.layout.width='500px'
>>> display(item_selector)

Display a search and select box that:

  • has a title of “Search for Your Items Here” in HTML heading 2

  • accepts only a name

  • is limited to Signals, even though Types aren’t shown

  • has a results box that is 25 lines long

  • show a maximum of 250 items in the search results

>>> item_selector = SeeqItemSelect(
>>>     '<H2>Search for Your Items Here</H2>',
>>>     show_fields=['Name'],
>>>     item_type='Signal',
>>>     results_box_rows=25,
>>>     max_displayed_results=250)
>>> display(item_selector)

Get a dictionary of keywords and values that can be used as an argument on widget initialization to set a particular state. Selected items are not saved.


>>> selector = SeeqItemSelect()
>>> # modify the selector
>>> selector_state = selector.get_widget_state()
>>> # create a new selector with the same state as the last one
>>> selector_2 = SeeqItemSelect(**selector_state)

A dictionary of the widget’s state

Return type:


property search_results: DataFrame

The full list of search results from Seeq

property search_terms: dict

The search terms used to to find items in Seeq

property selected_value: dict | List[dict]

The selected value or values

class seeq.spy.widgets.WidgetLogHandler

Bases: Handler

A class to allow writing of log values to an output widget.


Log the record to the output widget


record (Logging.LogRecord) – The record that will be handed to the handler

set_widget(output_widget: CoreWidget, concat: str = None, delimiter: str = '\n')

Set the output widget for log messages. The widget must have a “value” property.

The output widget will have it’s “value” property updated when a new log message is available. “concat” controls where the message is added in the output_widget’s value and “delimiter” determines how messages are separated. If concat=None, the widget’s value will be replaced by the new message.

  • output_widget (CoreWidget) – The widget to display the log messages. The widget must have a settable “value” property.

  • concat ({'append', 'prepend'}, optional) – If messages should be prepended or appended to output_widget.value or replace output_widget.value. If unspecified, messages will replace output_widget.value. Unrecognized values will raise a RuntimeError

  • delimiter (str, default '\n') – The delimiter between log entries if concat != None