fiftyone.plugins#
- fiftyone.plugins.constants
- fiftyone.plugins.context
- fiftyone.plugins.core
PluginPackage
list_plugins()
enable_plugin()
disable_plugin()
delete_plugin()
list_downloaded_plugins()
list_enabled_plugins()
list_disabled_plugins()
get_plugin()
find_plugin()
download_plugin()
load_plugin_requirements()
install_plugin_requirements()
ensure_plugin_requirements()
ensure_plugin_compatibility()
create_plugin()
- fiftyone.plugins.definitions
PluginDefinition
PluginDefinition.name
PluginDefinition.directory
PluginDefinition.builtin
PluginDefinition.shadow_paths
PluginDefinition.author
PluginDefinition.version
PluginDefinition.url
PluginDefinition.license
PluginDefinition.description
PluginDefinition.fiftyone_compatibility
PluginDefinition.fiftyone_requirement
PluginDefinition.operators
PluginDefinition.package_json_path
PluginDefinition.has_package_json
PluginDefinition.js_bundle
PluginDefinition.js_bundle_path
PluginDefinition.py_entry
PluginDefinition.py_entry_path
PluginDefinition.server_path
PluginDefinition.js_bundle_server_path
PluginDefinition.js_bundle_hash
PluginDefinition.can_register_operator()
PluginDefinition.has_py
PluginDefinition.has_js
PluginDefinition.secrets
PluginDefinition.to_dict()
PluginDefinition.from_disk()
- fiftyone.plugins.secrets
- fiftyone.plugins.utils
Module contents#
FiftyOne plugins.
Functions:
|
Enables the given plugin. |
|
Disables the given plugin. |
|
Deletes the given plugin from local disk. |
|
Lists available plugins. |
Returns a list of all disabled plugin names. |
|
Returns a list of all downloaded plugin names. |
|
Returns a list of all enabled plugin names. |
|
|
Gets the definition for the given plugin. |
|
Returns the path to the plugin on local disk. |
|
Downloads the plugin(s) from the given location to your local plugins directory ( |
|
Creates a plugin with the given name. |
|
Loads the Python package requirements associated with the given plugin, if any. |
|
Installs any Python package requirements associated with the given plugin. |
|
Ensures that any Python package requirements associated with the given plugin are installed. |
|
Ensures that the given plugin is compatible with your current FiftyOne package version. |
Classes:
|
A plugin definition. |
|
Context that represents a plugin and the Python objects it creates. |
Injects secrets from environmental variables into the execution context. |
- fiftyone.plugins.enable_plugin(plugin_name, _allow_missing=False)#
Enables the given plugin.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.disable_plugin(plugin_name, _allow_missing=False)#
Disables the given plugin.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.delete_plugin(plugin_name)#
Deletes the given plugin from local disk.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.list_plugins(enabled=True, builtin=False, shadowed=False)#
Lists available plugins.
- Parameters:
enabled (True) – whether to include only enabled plugins (True) or only disabled plugins (False) or all plugins (“all”)
builtin (False) – whether to include only builtin plugins (True) or only non-builtin plugins (False) or all plugins (“all”)
shadowed (False) – whether to include only “shadowed” duplicate plugins (True) or only usable plugins (False) or all plugins (“all”)
- Returns:
a list of
PluginDefinition
instances
- fiftyone.plugins.list_disabled_plugins()#
Returns a list of all disabled plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.list_downloaded_plugins()#
Returns a list of all downloaded plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.list_enabled_plugins()#
Returns a list of all enabled plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.get_plugin(name=None, plugin_dir=None)#
Gets the definition for the given plugin.
- Parameters:
name (None) – the plugin name
plugin_dir (None) – a directory containing the plugin
- Returns:
- fiftyone.plugins.find_plugin(name)#
Returns the path to the plugin on local disk.
- Parameters:
name – the plugin name
- Returns:
the path to the plugin directory
- fiftyone.plugins.download_plugin(url_or_gh_repo, plugin_names=None, overwrite=False)#
Downloads the plugin(s) from the given location to your local plugins directory (
fo.config.plugins_dir
).Note
To download from a private GitHub repository that you have access to, provide your GitHub personal access token by setting the
GITHUB_TOKEN
environment variable.- Parameters:
url_or_gh_repo –
the location to download from, which can be:
a GitHub repo URL like
https://github.com/<user>/<repo>
a GitHub ref like
https://github.com/<user>/<repo>/tree/<branch>
orhttps://github.com/<user>/<repo>/commit/<commit>
a GitHub ref string like
<user>/<repo>[/<ref>]
a GitHub tree path like
https://github.com/<user>/<repo>/tree/<branch>/<path>
a publicly accessible URL of an archive (eg zip or tar) file
plugin_names (None) – a plugin name or iterable of plugin names to download. By default, all found plugins are downloaded
overwrite (False) – whether to overwrite an existing plugin with the same name if it already exists
- Returns:
a dict mapping plugin names to plugin directories on disk
- fiftyone.plugins.create_plugin(plugin_name, from_files=None, outdir=None, description=None, version=None, overwrite=False, **kwargs)#
Creates a plugin with the given name.
If no
from_files
are provided, a directory containing only the plugin’s metadata file will be created.If no
outdir
is specified, the plugin is created within your local plugins directory (fo.config.plugins_dir
).- Parameters:
plugin_name – the name of the plugin
from_files (None) – a directory or list of explicit filepaths to include in the plugin
outdir (None) – the path at which to create the plugin directory. If not provided, the plugin is created within your
fo_config.plugins_dir
description (None) – a description for the plugin
version (None) – an optional FiftyOne version requirement string
overwrite (False) – whether to overwrite a local plugin with the same name if one exists
**kwargs – additional keyword arguments to include in the plugin definition
- Returns:
the directory containing the created plugin
- fiftyone.plugins.load_plugin_requirements(plugin_name)#
Loads the Python package requirements associated with the given plugin, if any.
- Parameters:
plugin_name – the plugin name
- Returns:
a list of requirement strings, or
None
- fiftyone.plugins.install_plugin_requirements(plugin_name, error_level=None)#
Installs any Python package requirements associated with the given plugin.
- Parameters:
plugin_name – the plugin name
error_level (None) –
the error level to use, defined as:
0: raise error if the install fails
1: log warning if the install fails
2: ignore install fails
By default,
fiftyone.config.requirement_error_level
is used
- fiftyone.plugins.ensure_plugin_requirements(plugin_name, error_level=None, log_success=False)#
Ensures that any Python package requirements associated with the given plugin are installed.
- Parameters:
plugin_name – the plugin name
error_level (None) –
the error level to use, defined as:
0: raise error if requirement is not satisfied
1: log warning if requirement is not satisfied
2: ignore unsatisifed requirements
By default,
fiftyone.config.requirement_error_level
is usedlog_success (False) – whether to generate a log message if a requirement is satisfied
- fiftyone.plugins.ensure_plugin_compatibility(plugin_name, error_level=None, log_success=False)#
Ensures that the given plugin is compatible with your current FiftyOne package version.
- Parameters:
plugin_name – the plugin name
error_level (None) –
the error level to use, defined as:
0: raise error if plugin is not compatible
1: log warning if plugin is not satisfied
2: ignore fiftyone compatibility requirements
By default,
fiftyone.config.requirement_error_level
is usedlog_success (False) – whether to generate a log message if the plugin is compatible
- class fiftyone.plugins.PluginDefinition(directory, metadata, shadow_paths=None)#
Bases:
object
A plugin definition.
- Parameters:
directory – the directory containing the plugin
metadata – a plugin metadata dict
shadow_paths (None) – a list of plugin directories that this plugin shadows
Attributes:
The name of the plugin.
The directory containing the plugin.
Whether the plugin is a builtin plugin.
A list of plugin directories that this plugin shadows.
The author of the plugin.
The version of the plugin.
The URL of the plugin.
The license of the plugin.
The description of the plugin.
The FiftyOne compatibility version.
The FiftyOne requirement as a string like
fiftyone>=0.21
.The operators of the plugin.
The absolute path to the package.json file.
Whether the plugin has a package.json file.
The relative path to the JS bundle file.
The absolute path to the Python entry file.
The default server path to the plugin.
The default server path to the JS bundle.
A hash of the plugin's JS bundle file.
Whether the plugin has a Python entry file.
Whether the plugin has a JS bundle file.
A list of required secrets for the plugin.
Methods:
can_register_operator
(name)Whether the plugin can register the given operator.
to_dict
()Returns a JSON dict representation of the plugin metadata.
from_disk
(metadata_path[, shadow_paths])Creates a
PluginDefinition
for the given metadata file.- property name#
The name of the plugin.
- property directory#
The directory containing the plugin.
- property builtin#
Whether the plugin is a builtin plugin.
- property shadow_paths#
A list of plugin directories that this plugin shadows.
- property author#
The author of the plugin.
- property version#
The version of the plugin.
- property url#
The URL of the plugin.
- property license#
The license of the plugin.
- property description#
The description of the plugin.
- property fiftyone_compatibility#
The FiftyOne compatibility version.
- property fiftyone_requirement#
The FiftyOne requirement as a string like
fiftyone>=0.21
.
- property operators#
The operators of the plugin.
- property package_json_path#
The absolute path to the package.json file.
- property has_package_json#
Whether the plugin has a package.json file.
- property js_bundle#
The relative path to the JS bundle file.
- property js_bundle_path#
- property py_entry#
- property py_entry_path#
The absolute path to the Python entry file.
- property server_path#
The default server path to the plugin.
- property js_bundle_server_path#
The default server path to the JS bundle.
- property js_bundle_hash#
A hash of the plugin’s JS bundle file.
- can_register_operator(name)#
Whether the plugin can register the given operator.
- Parameters:
name – the operator name
- Returns:
True/False
- property has_py#
Whether the plugin has a Python entry file.
- property has_js#
Whether the plugin has a JS bundle file.
- property secrets#
A list of required secrets for the plugin.
- to_dict()#
Returns a JSON dict representation of the plugin metadata.
- Returns:
a JSON dict
- classmethod from_disk(metadata_path, shadow_paths=None)#
Creates a
PluginDefinition
for the given metadata file.- Parameters:
metadata_path – the path to a plugin
.yaml
fileshadow_paths (None) – a list of plugin directories that this plugin shadows
- Returns:
- class fiftyone.plugins.PluginContext(plugin_definition)#
Bases:
object
Context that represents a plugin and the Python objects it creates.
- Parameters:
plugin_definition – the
fiftyone.plugins.PluginDefinition
for the plugin
Attributes:
The plugin name.
List of keys for required secrets as specified in the plugin definition.
Methods:
Determines whether the plugin has errors.
can_register
(instance)Determines whether the given operator can be registered.
register
(cls)Registers the given operator on the plugin.
Registers all operators defined by the plugin on this context.
Disposes all operators from this context.
- property name#
The plugin name.
- property secrets#
List of keys for required secrets as specified in the plugin definition.
- has_errors()#
Determines whether the plugin has errors.
- Returns:
True/False
- can_register(instance)#
Determines whether the given operator can be registered.
- Parameters:
instance – an
fiftyone.operators.operator.Operator
- Returns:
True/False
- register(cls)#
Registers the given operator on the plugin.
Note
Any errors are logged rather than being raised.
- Parameters:
cls – an
fiftyone.operators.operator.Operator
orfiftyone.operators.panel.Panel
class
- register_all()#
Registers all operators defined by the plugin on this context.
Note
Any errors are logged rather than being raised.
- dispose_all()#
Disposes all operators from this context.
- class fiftyone.plugins.PluginSecretsResolver#
Bases:
object
Injects secrets from environmental variables into the execution context.
Methods:
register_operator
(operator_uri, required_secrets)client
()get_multiple
(keys, operator_uri, **kwargs)Get the value of multiple secrets.
get_secret
(key, operator_uri, **kwargs)Get the value of a secret.
get_secret_sync
(key, operator_uri, **kwargs)Get the value of a secret.
- register_operator(operator_uri: str, required_secrets: List[str]) None #
- client() ISecretProvider #
- async get_multiple(keys: List[str], operator_uri: str, **kwargs) Dict[str, ISecret | None] #
Get the value of multiple secrets. :param keys: list of secret keys :param operator_uri: the operator URI :param kwargs: additional keyword arguments to pass to the secrets :param client for authentication if required:
- Returns:
A dictionary of secret keys and their values
- async get_secret(key: str, operator_uri: str, **kwargs) ISecret | None #
Get the value of a secret.
- Parameters:
key (str) – unique secret identifier
kwargs – additional keyword arguments to pass to the secrets
required (client for authentication if)
- get_secret_sync(key: str, operator_uri: str, **kwargs) ISecret | None #
Get the value of a secret.
- Parameters:
key (str) – unique secret identifier
kwargs – additional keyword arguments to pass to the secrets
required (client for authentication if)