The API offers methods to:
- Install plugins
- Uninstall plugins and list their usages
- Update plugins
- Read and write plugin settings
- Create and update plugin code envs
From a Zip file¶
with open("myplugin.zip", "r") as f: client.install_plugin_from_archive(f)
install_plugin_from_archive() for more details.
From the Dataiku plugin store¶
future = client.install_plugin_from_store("googlesheets") future.wait_for_result()
install_plugin_from_store() for more details.
Listing usages of a plugin¶
plugin = client.get_plugin('my-plugin-id') usages = plugin.list_usages()
list_usages() for more details.
Managing code envs¶
plugin = client.get_plugin("myplugin") # Start creating the code env, and wait for it to be done future = plugin.create_code_env() result = future.wait_for_result() # NB: If the plugin requires Python 3.6 for example, you will use something like: # plugin.create_code_env(python_interpreter="PYTHON36") # Now the code env is created, but we still need to configure the plugin to use it settings = plugin.get_settings() settings.set_code_env(result["envName"]) settings.save()
plugin = client.get_plugin("myplugin") # Obtain the current settings settings = plugin.get_settings() raw_settings = settings.get_raw() # Modify the settings # ... # And save them back settings.save()
A plugin on the DSS instance
Starts the creation of the code env of the plugin
Starts an update of the code env of the plugin
Updates the plugin from a plugin archive (as a file object)
Parameters: fp (object) – A file-like object pointing to a plugin archive zip
update_from_git(repository_url, checkout='master', subpath=None)¶
Updates the plugin from a Git repository. DSS must be setup to allow access to the repository.
- repository_url (str) – URL of a Git remote
- checkout (str) – branch/tag/SHA1 to commit. For example “master”
- subpath (str) – Optional, path within the repository to use as plugin. Should contain a ‘plugin.json’ file
Get the list of usages of the plugin.
Parameters: project_key (str) – optional key of project where to look for usages. Default is None and looking in all projects. Returns: a
Delete a plugin.
If not forced (default), pre-deletion checks will be run (as by
prepare_delete()and the deletion will be performed if and only if no usage of the plugin is detected and no error occurred during usages analysis.
Parameters: force (bool) – if True, plugin will be deleted even if usages are found or errors occurred during usages
analysis. Default is False. :return: a
Get the hierarchy of files in the plugin (dev plugins only)
Get a file from the plugin folder (dev plugins only)
Parameters: path (str) – the path of the file, relative to the root of the plugin Returns: a file-like object containing the file’s content
Update a file in the plugin folder (dev plugins only)
- f (file-like) – the file contents, as a file-like object
- path (str) – the path of the file, relative ot the root of the plugin
DSSPluginSettings(client, plugin_id, settings)¶
The settings of a plugin.
Returns the raw settings object
Sets the name of the code env to use for this plugin
Saves the settings to DSS
Information on a usage of an element of a plugin.
Has the following properties: - element_kind: webapps, python-formats,… - element_type: type name of the element - object_id: id of the object using the plugin element. Can be None. - object_type: type of the object using the plugin element. Can be None. - project_key: project key of the object using the plugin element. Can be None.
Information on a type not found while analyzing usages of a plugin.
Has the following properties: - missing type: the missing type - object_id: id of the object depending on the missing type. Can be None. - object_type: type of the object depending on the missing type. Can be None. - project_key: project key of the object depending on the missing type. Can be None.
Information on the usages of a plugin.
Some custom types may not be found during usage analysis, typically when a plugin was removed but is still used. This prevents some detailed analysis and may hide some uses. This information is provided in missing_types.
Get plugin usages as a dictionary. :rtype: dict
Returns true if the plugin maybe in use, as usages of the plugin were found, or errors encountered during analysis. :return: