fiftyone.plugins.core#
Core plugin methods.
Classes:
|
Plugin package. |
Functions:
|
Lists available plugins. |
|
Enables the given plugin. |
|
Disables the given plugin. |
|
Deletes the given plugin from local disk. |
Returns a list of all downloaded plugin names. |
|
Returns a list of all enabled plugin names. |
|
Returns a list of all disabled 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 ( |
|
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. |
|
Creates a plugin with the given name. |
- class fiftyone.plugins.core.PluginPackage(name: str, path: str, shadow_paths: list[str] | None = None)#
Bases:
object
Plugin package.
- Parameters:
name – the name of the plugin
path – the path to the plugin’s root directory
Attributes:
- name: str#
- path: str#
- shadow_paths: list[str] | None = None#
- fiftyone.plugins.core.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.core.enable_plugin(plugin_name, _allow_missing=False)#
Enables the given plugin.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.core.disable_plugin(plugin_name, _allow_missing=False)#
Disables the given plugin.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.core.delete_plugin(plugin_name)#
Deletes the given plugin from local disk.
- Parameters:
plugin_name – the plugin name
- fiftyone.plugins.core.list_downloaded_plugins()#
Returns a list of all downloaded plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.core.list_enabled_plugins()#
Returns a list of all enabled plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.core.list_disabled_plugins()#
Returns a list of all disabled plugin names.
- Returns:
a list of plugin names
- fiftyone.plugins.core.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:
a
PluginDefinition
- fiftyone.plugins.core.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.core.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.core.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.core.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.core.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.core.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
- fiftyone.plugins.core.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