Managing plugins

The API offers methods to:

  • Install plugins
  • Update plugins
  • Read and write plugin settings
  • Create and update plugin code envs

Installing plugins

From a Zip file

with open("myplugin.zip", "r") as f:
    client.install_plugin_from_archive(f)

See install_plugin_from_archive() for more details.

From the Dataiku plugin store

future = client.install_plugin_from_store("googlesheets")
future.wait_for_result()

See install_plugin_from_store() for more details.

From a Git repository

future = client.install_plugin_from_git("[email protected]:myorg/myrepo")
future.wait_for_result()

See install_plugin_from_git() 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()

Handling settings

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()

Reference documentation

class dataikuapi.dss.plugin.DSSPlugin(client, plugin_id)

A plugin on the DSS instance

get_settings()

Return the plugin-level settings

Returns:a DSSPluginSettings
create_code_env(python_interpreter=None, conda=False)

Starts the creation of the code env of the plugin

Returns:a dataikuapi.dssfuture.DSSFuture
update_code_env()

Starts an update of the code env of the plugin

Returns:a dataikuapi.dss.future.DSSFuture
update_from_zip(fp)

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_store()

Updates the plugin from the Dataiku plugin store

Returns:a DSSFuture
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.

Parameters:
  • 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
Returns:

a DSSFuture

list_files()

Get the hierarchy of files in the plugin (dev plugins only)

get_file(path)

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
put_file(path, f)

Update a file in the plugin folder (dev plugins only)

Parameters:
  • 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
class dataikuapi.dss.plugin.DSSPluginSettings(client, plugin_id, settings)

The settings of a plugin.

get_raw()

Returns the raw settings object

save()

Saves the settings to DSS