Cloud#

class dataikuapi.launchpad_client.LaunchpadClient(space_id: str, api_key_id: str, api_key_secret: str, host='https://api.launchpad-dku.app.dataiku.io/v1', extra_headers: dict | None = None)#

Entry point for the Launchpad API client

build_invite(email: str, profile: str, groups: List[str] | None = None) LaunchpadInvite#

Get a handle for a new invite

Note

This does not create the invite on the Launchpad, it simply returns an object. See usage example to create the invite on the Launchpad.

Usage example:

# Invite a user
invite = client.build_invite("[email protected]", "designer", ["designers"])
client.create_invites([invite])
Parameters:
  • email (str) – the email of the invitee to create

  • profile (str) – the profile of the invitee across Dataiku & Govern nodes

  • groups (Optional[List[str]]) – the groups of the invitee across Dataiku & Govern nodes. Defaults to []

Returns:

An invite object

Return type:

LaunchpadInvite

get_invite(email: str) LaunchpadInvite#

Get a handle to interact with an existing invite on the Cloud space

Important

read_users scope is required

Parameters:

email (str) – the email of the desired invite

Returns:

An invite object

Return type:

LaunchpadInvite

list_invites(emails: List[str] | None = None) List[LaunchpadInvite]#

List invites on the Cloud space

Important

read_users scope is required

Parameters:

emails (Optional[List[str]]) – the emails of the desired users. Defaults to None (no filter)

Returns:

A list of invite objects

Return type:

List[LaunchpadInvite]

create_invites(invites: List[LaunchpadInvite], fail_all_on_error: bool = False) Tuple[List[LaunchpadInvite], List[dict]]#

Create invites on the Cloud space

Important

write_users scope is required

Usage example:

# Create multiple invites
invite_1 = client.build_invite(email_1, "reader")
invite_2 = client.build_invite(email_2, "designer", ["designers"])
successes, failures = client.create_invites([invite_1, invite_2])
Parameters:
  • invites (List[LaunchpadInvite]) – the list of invite objects to create

  • fail_all_on_error (bool) – whether to perform the operation atomically, i.e. if one invite fails, all invites fail. Defaults to False

Returns:

A Tuple of successes (invite objects) and errors (dicts) objects

Return type:

Tuple[List[LaunchpadInvite], List[dict]]

update_invites(invites: List[LaunchpadInvite], fail_all_on_error=False) Tuple[List[LaunchpadInvite], List[dict]]#

Update invites on the Cloud space

Important

write_users scope is required

Usage example:

# Update invites based on a group
invites = client.list_invites()
invites_to_update = [
    invite
    for invite in invites
    if "my-group" in invite.groups
]
for invite in invites_to_update:
    invite.set_profile("designer")
successes, failures = client.update_invites(invites_to_update)
Parameters:
  • invites (List[LaunchpadInvite]) – the list of invite objects to update

  • fail_all_on_error (bool) – whether to perform the operation atomically, i.e. if one update fails, all updates fail. Defaults to False

Returns:

A Tuple of successes (invite objects) and errors (dicts) objects

Return type:

Tuple[List[LaunchpadInvite], List[dict]]

delete_invites(emails: List[str], fail_all_on_error=False) Tuple[List[dict], List[dict]]#

Delete invites on the Cloud space

Important

write_users scope is required

Usage example:

# Delete invites older than 7 days
invites = client.list_invites()
invites_to_delete = [
    invite.email
    for invite in invites
    if invite.created_on <= datetime.now(timezone.utc) - timedelta(days=7)
]
successes, failures = client.delete_invites(invites_to_delete)
Parameters:
  • emails (List[str]) – the list of emails to delete

  • fail_all_on_error (bool) – whether to perform the operation atomically, i.e. if one deletion fails, all deletions fail. Defaults to False

Returns:

A Tuple of successes (dicts) and errors (dicts) objects

Return type:

Tuple[List[dict], List[dict]]

get_user(email: str) LaunchpadUser#

Get a handle to interact with an existing user on the Cloud space

Important

read_users scope is required

Parameters:

email (str) – the email of the desired user

Returns:

A user object

Return type:

LaunchpadUser

list_users(emails: List[str] | None = None) List[LaunchpadUser]#

List users on the Cloud space

Important

read_users scope is required

Parameters:

emails (Optional[List[str]]) – the emails of the desired users. Defaults to None (no filter)

Returns:

A list of user objects

Return type:

List[LaunchpadUser]

update_users(users: List[LaunchpadUser], fail_all_on_error=False, wait_for_propagation=False) Tuple[List[LaunchpadUser], List[dict]]#

Update users on the Cloud space

Important

write_users scope is required

Usage example:

# Update users based on a group
users = client.list_users()
users_to_update = [
    user
    for user in users
    if "my-group" in user.groups
]
for user in users_to_update:
    user.set_profile("designer")
successes, failures = client.update_users(users_to_update)
Parameters:
  • users (List[LaunchpadUser]) – the list of user objects to update

  • fail_all_on_error (bool) – whether to perform the operation atomically, i.e. if one update fails, all updates fail. Defaults to False

  • wait_for_propagation (bool) – whether to wait for the changes to propagate to all Dataiku & Govern running nodes. Defaults to False

Returns:

A Tuple of successes (user objects) and errors (dicts) objects

Return type:

Tuple[List[LaunchpadUser], List[dict]]

delete_users(emails: List[str], fail_all_on_error=False, wait_for_propagation=False) Tuple[List[dict], List[dict]]#

Delete multiple users on the Cloud space

Important

write_users scope is required

Usage example:

# Delete users based on a group
my_group = client.get_group("my-group")
successes, failures = client.delete_users(my_group.users)
Parameters:
  • emails (List[str]) – the list of user emails to delete

  • fail_all_on_error (bool) – whether to perform the operation atomically, i.e. if one deletion fails, all deletions fail. Defaults to False

  • wait_for_propagation (bool) – whether to wait for the changes to propagate to all Dataiku & Govern running nodes. Defaults to False

Returns:

A Tuple of successes (dicts) and errors (dicts) objects

Return type:

Tuple[List[dict], List[dict]]

build_group(name: str, description: str | None = None, emails: List[str] | None = None, launchpad_permissions: Dict[str, bool] | None = None, dataiku_permissions: Dict[str, Dict[str, Any]] | None = None, govern_permissions: Dict[str, Dict[str, bool]] | None = None) LaunchpadGroup#

Get a handle for a new group

Note

This does not create the group on the Launchpad, it simply returns an object. See usage example to create the group on the Launchpad.

Usage example:

# Create a group
group = client.build_group("Designers", "Designer group", ["[email protected]"])
group.launchpad_permissions = {"mayTurnOnSpace": True}
group.update_permissions({"mayCreateProjects": True}, node_name="design-0")
group.save()
Parameters:
  • name (str) – the name of the group to create

  • description (Optional[str]) – the description of the group to create. Defaults to None

  • emails (Optional[List[str]]) – the emails of the group to create. Defaults to []

  • launchpad_permissions (Optional[Dict[str, bool]]) – the launchpad permissions of the group. Defaults to {}

  • dataiku_permissions (Optional[Dict[str, Dict[str, Any]]]) – the permissions of the group across Dataiku nodes. Defaults to {}

  • govern_permissions (Optional[Dict[str, Dict[str, bool]]]) – the govern permissions of the group across Govern nodes. Defaults to {}

Returns:

A group object

Return type:

LaunchpadGroup

get_group(name: str) LaunchpadGroup#

Get a handle to interact with an existing group on the Cloud space

Important

read_groups scope is required

Parameters:

name (str) – the name of the desired group

Returns:

A group object

Return type:

LaunchpadGroup

list_groups(names: List[str] | None = None) List[LaunchpadGroup]#

List groups setup on the Cloud space

Important

read_groups scope is required

Parameters:

names (Optional[List[str]]) – the names of the desired groups. Defaults to None (no filter)

Returns:

A list of group objects

Return type:

List[LaunchpadGroup]

list_profiles() List[LaunchpadProfile]#

List profiles on the Cloud space

Important

read_users scope is required

Returns:

A list of profile objects

Return type:

List[LaunchpadProfile]

list_nodes(type: str | None = None) List[LaunchpadNode]#

List nodes on the Cloud space

Parameters:

type (Optional[str]) – the type of nodes to list. Defaults to None (no filter)

Returns:

A list of node objects

Return type:

List[LaunchpadNode]

class dataikuapi.launchpad.group.LaunchpadGroup(client: LaunchpadClient, name: str, id: str | None = None, **kwargs)#

A group on the Cloud space

Important

Do not instantiate directly, use either get_group() or build_group().

Usage example:

# Create a group
group = client.build_group("Designers", "Designer group", ["[email protected]"])
group.launchpad_permissions = {"mayTurnOnSpace": True}
group.update_permissions({"mayCreateProjects": True}, node_type="dataiku")
group.update_permissions({"mayManageGovern": True}, node_type="govern")
group.save()

# Get a group
group = client.get_group("my-group")

# List groups
groups = client.list_groups()
property id: str#

The group ID

property name: str#

The group name

property description: str#

The group description

property launchpad_permissions: Dict[str, bool | Dict[str, bool]]#

The group’s launchpad permissions

property dataiku_permissions: Dict[str, Dict[str, bool | Dict[str, bool]]]#

The group’s dataiku permissions

property govern_permissions: Dict[str, Dict[str, bool | Dict[str, bool]]]#

The group’s govern permissions

property accessible_nodes: Tuple[str, ...]#

The group’s accessible nodes

property users: Tuple[str, ...]#

The users assigned to this group

grant_node_access(*, node_type: str | None = None, node_name: str | None = None, copy_permissions_from_node: str | None = None) None#

Grant access to the specified node type or node name

Note

This grants node access to the group, without giving any permissions (all default to False on save). If the group already had access, this will not update the permissions. To update permissions once access is granted, see update_permissions().

Usage example:

# Grant access and update permissions for a specific node
group = client.get_group("my-group")
print(group.accessible_nodes)
group.grant_node_access(node_name="design-0")
group.update_permissions(
    {"mayCreateProjects": True},
    node_name="design-0",
    grant_node_access=False,
)
group.save()

# Copy the permissions from an existing node
group = client.get_group("my-group")
group.grant_node_access(node_name="automation-0", copy_permissions_from_node="design-0")
group.save()
Parameters:
  • node_type (Optional[str]) – the node_type to set. When provided, node_name should be None

  • node_name (Optional[str]) – the node_name to set. When provided, node_type should be None

  • copy_permissions_from_node (Optional[str]) – the node name to copy permissions from. Defaults to None

update_permissions(permissions: Dict[str, bool | Dict[str, bool]], *, node_type: str | None = None, node_name: str | None = None, grant_node_access: bool = True) None#

Update permissions for the specified node type or node name

Note

This will not grant access to new nodes. To do so, see grant_node_access().

Usage example:

group = client.get_group("my-group")

# Update permissions for all dataiku nodes
group.update_permissions({"mayCreateProjects": True}, node_type="dataiku")

# Update permissions for a specific node
group.update_permissions({"mayCreateProjects": True}, node_name="design-0")

# Update permissions for accessible dataiku nodes
group.update_permissions(
    {"mayCreateProjects": True},
    node_type="dataiku",
    grant_node_access=False,
)

group.save()
Parameters:
  • permissions (dict) – the permissions to update

  • node_type (Optional[str]) – the node_type to set. When provided, node_name should be None

  • node_name (Optional[str]) – the node_name to set. When provided, node_type should be None

  • grant_node_access (bool) – whether to grant access and update permissions to nodes matching the criteria, or only update permissions for accessible nodes. Defaults to True (grant access)

revoke_node_access(*, node_type: str | None = None, node_name: str | None = None) None#

Revoke access to the specified node type or node name

Note

This revokes node access to the group. If the group was missing access, this will not update anything.

Usage example:

group = client.get_group("my-group")
print(group.accessible_nodes)
group.revoke_node_access(node_type="automation")
group.save()
Parameters:
  • node_type (Optional[str]) – the node_type to set. When provided, node_name should be None

  • node_name (Optional[str]) – the node_name to set. When provided, node_type should be None

add_users(emails: List[str]) None#

Add the users to the group

Note

If you want to add a user to multiple groups, use add_groups().

Usage example:

group = client.get_group("my-group")
group.add_users(["[email protected]"])
group.save()
Parameters:

emails (List[str]) – the emails of the users to add to the group

remove_users(emails: List[str]) None#

Remove the users from the group

Usage example:

group = client.get_group(group_id)
group.remove_users(["[email protected]"])
group.save()
Parameters:

emails (List[str]) – the emails of the users to remove from the group

get_raw() dict#
Returns:

A dictionary representation of the group

Return type:

dict

save(wait_for_propagation=False) None#

Saves the group

Parameters:

wait_for_propagation (bool) – whether to wait for the changes to propagate to all Dataiku running nodes. Defaults to False

delete(wait_for_propagation=False) None#

Delete the group referenced by this object

Parameters:

wait_for_propagation (bool) – whether to wait for the changes to propagate to all Dataiku running nodes. Defaults to False

class dataikuapi.launchpad.node.LaunchpadNode(client: LaunchpadClient, name: str, type: str)#

A node on the Cloud space

Important

Do not instantiate directly, use list_nodes()

property name: str#

The node name

property type: str#

The node type

class dataikuapi.launchpad.profile.LaunchpadProfile(client: LaunchpadClient, **kwargs)#

A profile on the Cloud space

Important

Do not instantiate directly, use list_profiles().

Usage example:

# Get profiles
profiles = client.list_profiles()
property name: str#

The profile name

property total_seats: int#

The total number of seats allowed for this profile. Returns -1 if unlimited (infinity).

property used_seats: int#

The number of seats currently used for this profile

property free_seats: int#

The number of seats available for this profile. Returns -1 if unlimited (infinity).

property is_trial: bool#

Whether the profile is a trial seat or not

get_raw() dict#
Returns:

A dictionary representation of the profile

Return type:

dict

class dataikuapi.launchpad.task.LaunchpadTask(client: LaunchpadClient, task_id: str)#

A long-running task on the Launchpad

It allows you to track the state of the task and retrieve its result when it is ready

Usage example:

# In this example, create a group, which triggers a task
group = client.build_group(...)
group.save(wait_for_propagation=True)  # This will wait for the task to complete before returning

Note

This class does not need to be instantiated directly.

A LaunchpadTask is usually returned by the API calls that are initiating long-running tasks.

static from_resp(client: LaunchpadClient, resp: _BaseResponse) LaunchpadTask | None#

Create a LaunchpadTask from the response of an endpoint that initiated a long-running task

Parameters:
  • client (LaunchpadClient) – An api client to connect to the Launchpad

  • resp (_BaseResponse) – The response of the API call that initiated a long-running task.

Returns:

the Launchpad task, if any

Return type:

Optional[LaunchpadTask]

wait_for_result(timeout=0) dict | None#

Wait for the completion of the long-running task, and return its result

Parameters:

timeout (int) – A timeout in seconds. Default value (0) means no timeout

Returns:

the result of the task

Return type:

Optional[dict]

Raises:
  • DataikuTaskException – if the task failed to complete

  • DataikuTaskTimeoutException – if the task failed to complete before the specified timeout

class dataikuapi.launchpad.user.LaunchpadInvite(client: LaunchpadClient, email: str, id: str | None = None, **kwargs)#

An invite on the Cloud space

Important

Do not instantiate directly, use either get_invite() or create_invites().

Usage example:

# Create an invite
invite = client.build_invite("[email protected]", "designer")
client.create_invites([invite])

# Get an invite
invite = client.get_invite("[email protected]")

# List invites
invites = client.list_invites()
set_profile(name: str, **kwargs) None#

Set the user’s profile

Usage example:

# Update user profile
invite = client.get_invite("[email protected]")
invite.set_profile("designer")
client.update_invites([invite])
Parameters:
  • name (str) – name of the user profile to set

  • kwargs (Any) – additional keyword arguments

add_groups(groups: List[str]) None#

Add the user to the specified groups

Usage example:

invite = client.get_invite("[email protected]")
invite.add_groups(["designers"])
client.update_invites([invite])
Parameters:

groups (List[str]) – the groups to add the user to

remove_groups(groups: List[str]) None#

Remove the user from the specified groups

Usage example:

invite = client.get_invite("[email protected]")
invite.remove_groups(["designers"])
client.update_invites([invite])
Parameters:

groups (List[str]) – the groups to remove the user from

class dataikuapi.launchpad.user.LaunchpadUser(client: LaunchpadClient, email: str, id: str | None = None, **kwargs)#

A user on the Cloud space

Important

Do not instantiate directly, use get_user().

Usage example:

# Get a user
user = client.get_user("[email protected]")

# List users
users = client.list_users()
property is_owner: bool#

Whether the user is the owner of the space

set_profile(name: str, is_trial: bool = False, **kwargs) None#

Set the user’s profile

Usage example:

# Update user profile
user = client.get_user("[email protected]")
user.set_profile("designer")
client.update_users([user])

# Start a trial seat
user = client.get_user("[email protected]")
user.set_profile("designer", is_trial=True)
client.update_users([user])
Parameters:
  • name (str) – name of the user profile to set

  • is_trial (Optional[bool]) – whether the user is a trial user. Defaults to False

  • kwargs (Any) – additional keyword arguments

add_groups(groups: List[str]) None#

Add the user to the specified groups

Note

If you want to add multiple users to a group, use add_users().

Usage example:

user = client.get_user("[email protected]")
user.add_groups(["designers"])
client.update_users([user])
Parameters:

groups (List[str]) – the groups to add the user to

remove_groups(groups: List[str]) None#

Remove the user from the specified groups

Usage example:

user = client.get_user("[email protected]")
user.remove_groups(["designers"])
client.update_users([user])
Parameters:

groups (List[str]) – the groups to remove the user from