Skip to content

management#

The management API lets you perform administration tasks, such as:

  • Adding and removing members.
  • Creating and deleting projects.
  • Listing projects.
  • Listing members of projects and workspaces.
Import statement
from neptune import management

get_project_list()#

Get a list of projects you have access to.

Parameters

Name Type Default Description
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Returns

List with project names in the form workspace-name/project-name.

Example

>>> from neptune import management
>>> projects = management.get_project_list()
>>> print(projects)
['jackie/sandbox', 'ml-team/classification']

create_project()#

Creates a new project in a workspace.

Parameters

Name       Type Default     Description
name str - The name for the new Neptune project. Can contain letters and hyphens (-). For example, named-entity-recognition.

If you leave out the workspace argument, include the workspace name here instead, in the form workspace-name/project-name. For example, ml-team/named-entity-recognition.

key str, optional - Project identifier. Must contain 1-10 uppercase letters or numbers (at least one letter). For example, CLS2.

If you leave it out, Neptune generates a key for you based on the project name.

workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the name argument.
visibility str, management.ProjectVisibility, optional priv

The level of visibility to set for the project.

    Options:
  • priv: private
  • workspace: accessible to all workspace members
  • pub: public
description str, optional None Project description. If None, it is left empty.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Returns

The name of the created project.

Example

>>> from neptune import management
>>> management.create_project(
...    workspace="ml-team",
...    name="classification",
...    key="CLS2",
...    visibility="pub",
... )
'ml-team/classification'

delete_project()#

Deletes a project from a workspace.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Example

>>> from neptune import management
>>> management.delete_project(project="ml-team/classification")

add_project_member()#

Adds a user to a project.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
username str - Name of the Neptune user to add to the project.
role str, management.MemberRole -

Level of permissions the user should have in the project.

    Options:
  • viewer: can view project content and members.
  • contributor: can view and edit project content, and view members
  • owner: can view and edit project content and members
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Example

>>> from neptune import management
>>> management.add_project_member(
...    project="ml-team/classification", username="jackie", role="contributor"
... )

get_project_member_list()#

Lists the members of a project.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Returns

Dictionary with usernames as keys and project roles as values.

Example

>>> from neptune import management
>>> management.get_project_member_list(project="ml-team/classification")
{'johnny': 'owner', 'jackie': 'contributor', 'janus': 'viewer'}

remove_project_member()#

Removes a user from a project.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
username str - Name of the Neptune user to add to the project.
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Example

>>> from neptune import management
>>> management.remove_project_member(
...     project="ml-team/classification",
...     username="janus",
... )

get_workspace_member_list()#

Lists the members of a workspace.

Parameters

Name Type Default Description
workspace str - Name of the Neptune workspace.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to workspace as of neptune-client 0.16.16.

Returns

Dictionary with usernames as keys and workspace roles as values.

Example

>>> from neptune import management
>>> management.get_workspace_member_list(workspace="ml-team")
{'johnny': 'admin', 'jackie': 'member', 'janus': 'member'}

get_workspace_service_account_list()#

Lists the service accounts of a workspace.

Parameters

Name Type Default Description
workspace str - Name of the Neptune workspace.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to workspace as of neptune-client 0.16.16.

Returns

Dictionary with account names as keys and workspace roles as values.

Note

Service accounts can only have the "member" role in a workspace.

Example

>>> from neptune import management
>>> management.get_workspace_service_account_list(workspace="ml-team")
{'cicd@ml-team': 'member', 'test@ml-team': 'member'}

get_project_service_account_list()#

Lists the service accounts assigned to a project.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Returns

Dictionary with account names as keys and project roles (owner, contributor, or viewer) as values.

Example

>>> from neptune import management
>>> management.get_project_service_account_list(project="ml-team/classification")
{'cicd@ml-team': 'owner', 'test@ml-team': 'viewer'}

add_project_service_account()#

Adds a service account to a Neptune project.

Parameters

Name          Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
service_account_name str - Name of the service account to add to the project.
role str, management.MemberRole -

Level of permissions the service account should have in the project.

    Options:
  • viewer: can view project content and members.
  • contributor: can view and edit project content, and view members
  • owner: can view and edit project content and members
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Example

>>> from neptune import management
>>> management.add_project_service_account(
...    project="ml-team/classification",
...    service_account_name="cicd@ml-team",
...    role="contributor",
... )

remove_project_service_account()#

Removes a service account from a Neptune project.

Parameters

Name          Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
service_account_name str - Name of the service account to add to the project.
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

Deprecated name parameter

The name parameter has been changed to project as of neptune-client 0.16.16.

Example

>>> from neptune import management
>>> management.remove_project_service_account(
...    project="ml-team/classification", service_account_name="cicd@ml-team"
... )

trash_objects()#

Moves one or more Neptune objects to the project trash.

Trashed objects are retained until the trash is manually emptied in the Neptune app.

Note for model objects

Trashing a Model object also trashes all of its ModelVersion objects.

Parameters

Name Type Default Description
project str - Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name.
ids str or list of str - Neptune ID of object to trash (or list of multiple IDs).
workspace str, optional None Name of your Neptune workspace. If None, it will be parsed from the project argument.
api_token str, optional None Account's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

How do I find the ID?

The Neptune ID is a unique identifier for the object. It's displayed in the Details view and in the leftmost column of the table views.

The ID is stored in the system namespace. You can obtain it with object["sys/id"].fetch(). For example:

>>> run = neptune.init_run(project="ml-team/classification")
>>> run["sys/id"].fetch()
'CLS-26'

Examples

Import the management package and initialize the project to trash objects from:

import neptune
from neptune import management

project_name = "workspace-name/project-name"  # (1)!
project = neptune.init_project(project=project_name, mode="read-only")
  1. The full project name. For example, "ml-team/classification". To copy it, navigate to the project settingsProperties.

Trashing a run with ID "CLS-1":

management.trash_objects(project=project_name, ids="CLS-1")

Fetch runs tagged as "trash" and delete them in batch:

runs_to_trash_df = project.fetch_runs_table(tag="trash").to_pandas()
runs_to_trash = runs_to_trash_df["sys/id"].tolist()

management.trash_objects(project=project_name, ids=runs_to_trash)

Trashing a newly created run:

run = neptune.init_run()
# It's a disaster, let's remove it
run_id = run["sys/id"].fetch()
management.trash_objects(project=project_name, ids=run_id)

You can also delete objects of different types at once:

run_id = run["sys/id"].fetch()
model_id = model["sys/id"].fetch()
model_version_id = model_version["sys/id"].fetch()
management.trash_objects(
    project=project_name,
    ids=[run_id, model_id, model_version_id]
)