fiftyone.operators.operations#

FiftyOne operator execution.

Copyright 2017-2025, Voxel51, Inc.

Classes:

Operations(ctx)

Interface to trigger builtin operations on an execution context.

class fiftyone.operators.operations.Operations(ctx)#

Bases: object

Interface to trigger builtin operations on an execution context.

Parameters:

ctx – an fiftyone.operators.executor.ExecutionContext

Methods:

clone_selected_samples()

Clone the selected samples in the App.

clone_sample_field(field_name,Β new_field_name)

Clone a sample field to a new field name.

rename_sample_field(field_name,Β new_field_name)

Rename a sample field to a new field name.

clear_sample_field(field_name)

Clear the contents of a sample field.

delete_selected_samples()

Delete the selected samples in the App.

delete_selected_labels()

Delete the selected labels in the App.

delete_sample_field(field_name)

Delete a sample field.

print_stdout(message)

Print a message to the standard output.

list_files([path,Β list_filesystems])

List files in a directory or list filesystems.

reload_samples()

Reload the sample grid in the App.

reload_dataset()

Reload the dataset in the App.

clear_selected_samples()

Clear selected samples in the App.

copy_view_as_json()

Copy the current view in the App as JSON.

view_from_json()

Set the view in the App from JSON present in clipboard.

clear_panel_state([panel_id])

Clear the state of the specified panel in the App.

clear_panel_data([panel_id])

Clear the data of the specified panel in the App.

set_panel_state(state[,Β panel_id])

Set the entire state of the specified panel in the App.

set_panel_data(data[,Β panel_id])

Set the entire data of the specified panel in the App.

patch_panel_state(state[,Β panel_id])

Patch the state of the specified panel in the App.

patch_panel_data(data[,Β panel_id])

Patch the state of the specified panel in the App.

reduce_panel_state(reducer[,Β panel_id])

Reduce the state of the specified panel in the App.

apply_panel_state_path(path[,Β panel_id])

Force update the state for path in the specified panel in the App.

show_panel_output(output[,Β panel_id])

Show output in the specified panel in the App.

open_panel(name[,Β is_active,Β layout,Β force,Β ...])

Open a panel with the given name and layout options in the App.

register_panel(name,Β label[,Β help_markdown,Β ...])

Registers a panel with the given name and lifecycle callbacks.

open_all_panels()

Open all available panels in the App.

close_panel([name,Β id])

Close the given panel in the App.

close_all_panels()

Close all open panels in the App.

split_panel(name,Β layout)

Split the panel with the given layout in the App.

open_dataset(dataset_name)

Open the specified dataset in the App.

clear_view()

Clear the view bar in the App.

clear_sidebar_filters()

Clear all filters in the App's sidebar.

clear_all_stages()

Clear all selections, filters, and view stages from the App.

refresh_colors()

Refresh the colors used in the App's UI.

show_selected_samples()

Show the samples that are currently selected in the App.

convert_extended_selection_to_selected_samples()

Convert the extended selection to selected samples in the App.

set_selected_samples(samples)

Select the specified samples in the App.

set_view([view,Β name])

Set the current view in the App.

show_samples(samples[,Β use_extended_selection])

Show specific samples, optionally using extended selection in the App.

console_log(message)

Log a message to the console.

show_output(outputs,Β results)

Show output in the App's UI.

set_progress([label,Β progress,Β variant])

Set the progress indicator in the App's UI.

test_operator(operator,Β raw_params)

Test the operator with given parameters.

set_selected_labels(labels)

Set the selected labels in the App.

clear_selected_labels()

Clear the selected labels in the App.

notify(message[,Β variant])

Show a notification in the App.

set_extended_selection([selection,Β scope,Β ...])

Sets the extended selection in the App.

set_spaces([spaces,Β name])

Sets the current spaces in the App.

set_active_fields([fields])

Set the active fields in the App.

clear_active_fields()

Clear the active fields in the App.

track_event(event[,Β properties])

Track an event in the App.

set_panel_title([id,Β title])

Set the title of the specified panel in the App.

set_group_slice(slice)

Set the active group slice in the App.

open_sample([id,Β group_id])

Opens the specified sample or group in the App's sample modal.

close_sample()

Closes the App's sample modal.

show_sidebar()

Show the App's sidebar.

hide_sidebar()

Hide the App's sidebar.

toggle_sidebar()

Toggle the visibility of the App's sidebar.

clone_selected_samples()#

Clone the selected samples in the App.

clone_sample_field(field_name, new_field_name)#

Clone a sample field to a new field name.

Parameters:
  • field_name – the name of the field to clone

  • new_field_name – the name for the new field

rename_sample_field(field_name, new_field_name)#

Rename a sample field to a new field name.

Parameters:
  • field_name – the name of the field to rename

  • new_field_name – the new name for the field

clear_sample_field(field_name)#

Clear the contents of a sample field.

Parameters:

field_name – the name of the field to clear

delete_selected_samples()#

Delete the selected samples in the App.

delete_selected_labels()#

Delete the selected labels in the App.

delete_sample_field(field_name)#

Delete a sample field.

Parameters:

field_name – the name of the field to delete

print_stdout(message)#

Print a message to the standard output.

Parameters:

message – the message to print

list_files(path=None, list_filesystems=False)#

List files in a directory or list filesystems.

Parameters:
  • path (None) – the path to list files from, or None to list filesystems

  • list_filesystems (False) – whether to list filesystems instead of files

reload_samples()#

Reload the sample grid in the App.

reload_dataset()#

Reload the dataset in the App.

clear_selected_samples()#

Clear selected samples in the App.

copy_view_as_json()#

Copy the current view in the App as JSON.

view_from_json()#

Set the view in the App from JSON present in clipboard.

clear_panel_state(panel_id=None)#

Clear the state of the specified panel in the App.

Parameters:

panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

clear_panel_data(panel_id=None)#

Clear the data of the specified panel in the App.

Parameters:

panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

set_panel_state(state, panel_id=None)#

Set the entire state of the specified panel in the App.

Parameters:
  • state – the state to set

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

set_panel_data(data, panel_id=None)#

Set the entire data of the specified panel in the App.

Parameters:
  • data – the data to set

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

patch_panel_state(state, panel_id=None)#

Patch the state of the specified panel in the App.

Parameters:
  • state – the state to set

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

patch_panel_data(data, panel_id=None)#

Patch the state of the specified panel in the App.

Parameters:
  • data – the data to set

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

reduce_panel_state(reducer, panel_id=None)#

Reduce the state of the specified panel in the App.

Parameters:
  • reducer – the reducer to apply

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

apply_panel_state_path(path, panel_id=None)#

Force update the state for path in the specified panel in the App.

Parameters:

path (str) – the path to force update

show_panel_output(output, panel_id=None)#

Show output in the specified panel in the App.

Parameters:
  • output – the output to show

  • panel_id (None) – the optional ID of the panel to clear. If not provided, the ctx.panel_id will be used

open_panel(name, is_active=True, layout=None, force=False, force_duplicate=False)#

Open a panel with the given name and layout options in the App.

Parameters:
  • name – the name of the panel to open

  • is_active (True) – whether to activate the panel immediately

  • layout (None) – the layout orientation ("horizontal", "vertical"), if applicable

  • force (False) – whether to force open the panel. Skips the check to see if a panel with the same name exists or whether the panel declares allow_multiple=False

  • force_duplicate (False) – whether to force open the panel even if it is already open. Only applicable if force is True

register_panel(name, label, help_markdown=None, category=Categories.CUSTOM, alpha=False, beta=False, is_new=False, icon=None, light_icon=None, dark_icon=None, surfaces='grid', on_load=None, on_unload=None, on_change=None, on_change_ctx=None, on_change_dataset=None, on_change_view=None, on_change_spaces=None, on_change_current_sample=None, on_change_selected=None, on_change_selected_labels=None, on_change_extended_selection=None, on_change_group_slice=None, on_change_query_performance=None, on_change_active_fields=None, allow_duplicates=False, priority=None, _builtin=False)#

Registers a panel with the given name and lifecycle callbacks.

Parameters:
  • name – the name of the panel

  • help_markdown (None) – help text associated with the panel in markdown format

  • label – the display name of the panel

  • icon (None) – the icon to show in the panel’s tab

  • light_icon (None) – the icon to show in the panel’s tab when the App is in light mode

  • dark_icon (None) – the icon to show in the panel’s tab when the App is in dark mode

  • surfaces ('grid') – surfaces in which to show the panel. Must be one of β€˜grid’, β€˜modal’, or β€˜grid modal’

  • alpha (False) – whether the panel is in alpha

  • beta (False) – whether the panel is in beta

  • is_new (False) – whether the panel is new

  • category (Categories.CUSTOM) – the category of the panel

  • on_load (None) – an operator to invoke when the panel is loaded

  • on_unload (None) – an operator to invoke when the panel is unloaded

  • on_change (None) – an operator to invoke when the panel state changes

  • on_change_ctx (None) – an operator to invoke when the panel execution context changes

  • on_change_dataset (None) – an operator to invoke when the current dataset changes

  • on_change_view (None) – an operator to invoke when the current view changes

  • on_change_spaces (None) – an operator to invoke when the current spaces layout changes

  • on_change_current_sample (None) – an operator to invoke when the current sample changes

  • on_change_selected (None) – an operator to invoke when the current selected samples changes

  • on_change_selected_labels (None) – an operator to invoke when the current selected labels changes

  • on_change_extended_selection (None) – an operator to invoke when the current extended selection changes

  • on_change_group_slice (None) – an operator to invoke when the group slice changes

  • on_change_query_performance (None) – an operator to invoke when the query performance changes

  • on_change_active_fields (None) – an operator to invoke when the active fields change

  • allow_duplicates (False) – whether to allow multiple instances of the panel to the opened

  • priority (None) – the priority of the panel, used for sort order

  • _builtin (False) – whether the panel is a builtin panel

open_all_panels()#

Open all available panels in the App.

close_panel(name=None, id=None)#

Close the given panel in the App.

Parameters:
  • name (None) – the name of the panel to close

  • id (None) – the ID of the panel to close

close_all_panels()#

Close all open panels in the App.

split_panel(name, layout)#

Split the panel with the given layout in the App.

Parameters:
  • name – the name of the panel to split

  • layout – the layout orientation ("horizontal", "vertical")

open_dataset(dataset_name)#

Open the specified dataset in the App.

Parameters:

dataset_name – the name of the dataset to open

clear_view()#

Clear the view bar in the App.

clear_sidebar_filters()#

Clear all filters in the App’s sidebar.

clear_all_stages()#

Clear all selections, filters, and view stages from the App.

refresh_colors()#

Refresh the colors used in the App’s UI.

show_selected_samples()#

Show the samples that are currently selected in the App.

convert_extended_selection_to_selected_samples()#

Convert the extended selection to selected samples in the App.

set_selected_samples(samples)#

Select the specified samples in the App.

Parameters:

samples – a list of sample IDs to select

set_view(view=None, name=None)#

Set the current view in the App.

Parameters:
show_samples(samples, use_extended_selection=False)#

Show specific samples, optionally using extended selection in the App.

Parameters:
  • samples – a list of sample IDs to show

  • use_extended_selection (False) – whether to use the extended selection feature

console_log(message)#

Log a message to the console.

Parameters:

message – the message to log

show_output(outputs, results)#

Show output in the App’s UI.

Parameters:
  • outputs – outputs to show

  • results – results to display

set_progress(label=None, progress=None, variant=None)#

Set the progress indicator in the App’s UI.

Parameters:
  • label (None) – a label for the progress indicator

  • progress (None) – a progress value to set

  • variant (None) – the type of indicator ("linear", "circular")

test_operator(operator, raw_params)#

Test the operator with given parameters.

Parameters:
  • operator – the operator to test

  • raw_params – raw parameters for the operator

set_selected_labels(labels)#

Set the selected labels in the App.

Parameters:

labels – the labels to select

clear_selected_labels()#

Clear the selected labels in the App.

notify(message, variant='info')#

Show a notification in the App.

Variants are β€œinfo”, β€œsuccess”, β€œwarning”, and β€œerror”.

Parameters:
  • message – the message to show

  • variant ("info") – the type of notification

set_extended_selection(selection=None, scope=None, clear=False, reset=False)#

Sets the extended selection in the App.

Parameters:
  • selection (None) – the selection to set

  • scope (None) – the scope of the selection

  • clear (None) – whether to clear the selection

  • reset (None) – whether to reset the selection

set_spaces(spaces=None, name=None)#

Sets the current spaces in the App.

Parameters:
set_active_fields(fields=None)#

Set the active fields in the App.

Parameters:

fields (None) – the possibly-empty list of fields or embedded.fields to set

clear_active_fields()#

Clear the active fields in the App.

track_event(event, properties=None)#

Track an event in the App.

Parameters:
  • event – the event to track

  • properties (None) – the properties to track

set_panel_title(id=None, title=None)#

Set the title of the specified panel in the App.

Parameters:
  • id (None) – the ID of the panel to set the title

  • title (None) – the title to set

set_group_slice(slice)#

Set the active group slice in the App.

Parameters:

slice – the group slice to activate

open_sample(id=None, group_id=None)#

Opens the specified sample or group in the App’s sample modal.

Parameters:
  • id (None) – a sample ID to open in the modal

  • group_id (None) – a group ID to open in the modal

close_sample()#

Closes the App’s sample modal.

show_sidebar()#

Show the App’s sidebar.

hide_sidebar()#

Hide the App’s sidebar.

toggle_sidebar()#

Toggle the visibility of the App’s sidebar.