Management
How to manage projects and members through the Neptune API
The management module lets you perform administration tasks through the Neptune API, including:
  • Managing users and service accounts
  • Creating and deleting projects
  • Listing projects and members

.get_project_list()

Get a list of projects you have access to.
Parameters
api_token
(str, optional, defaults to None) - User or service account's API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommended using the NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

list[str]: list of project names with the format WORKSPACE_NAME/PROJECT_NAME.

Example

from neptune import management
management.get_project_list()

.create_project()

Creates a new project in your Neptune workspace.
Parameters
name
(str) - The name for the Neptune project. Can contain letters and hyphens (-). For example: named-entity-recognition. If you omit 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 omitted, Neptune generates a key for you.
workspace
(str, optional) - Name of your Neptune workspace. If None, it will be parsed from the name argument.
visibility
(str, management.ProjectVisibility, optional, defaults to priv) - The level of visibility to set for the project.
Can be set to:
  • priv: for private projects
  • workspace: for projects accessible to all workspace members
  • pub: for public projects
If None, it will be set to priv.
description
(str, optional) - Project description. If None, it will be left empty.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommended using the NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

str with the name of the new project you created.

Example

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

.delete_project()

Deletes a project from your Neptune workspace.
Only workspace admins can delete projects.
Service accounts can't be workspace admins, so they can't delete projects.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using the NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Example

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

.add_project_member()

Adds a user to a project.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
username
(str) - name of the user you want to add to the project.
role
(str, management.MemberRole) - level of permissions the user should have in a project.
Can be set to:
  • "viewer": can only view project content and members
  • "contributor": can view and edit project content and only view members
  • "owner": can view and edit project content and members
For more information, see docs for User roles in a project.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Examples

from neptune import management
management.add_project_member(
name="ml-team/classification",
username="johnny",
role="contributor",
)

.get_project_member_list()

Get a list of members for a project.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

dict[str, str] with usernames as keys and project roles (owner, contributor, or viewer) as values.

Example

from neptune import management
management.get_project_member_list(name="ml-team/classification")

.remove_project_member()

Removes a user from your project members.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
username
(str) - name of the user you want to remove from the project.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account's API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Example

from neptune import management
management.remove_project_member(
name="ml-team/classification",
username="johnny",
)

.get_workspace_member_list()

Get a list of members of a workspace.
Parameters
name
(str) - The name of the Neptune workspace.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

dict[str, str] with usernames as keys and workspace roles (admin, member) as values.

Example

from neptune import management
management.get_workspace_member_list(name="ml-team")

.get_workspace_service_account_list()

Lists the service accounts of a Neptune workspace.
Parameters
name
(str) - The name of the Neptune workspace.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

dict[str, str] with account names as keys and workspace roles as values.
Service accounts can only have the "member" role in workspaces.

Example

from neptune import management
management.get_workspace_service_account_list(name="ml-team")

.get_project_service_account_list()

Lists the service accounts assigned to a Neptune project.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None, it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Returns

dict[str, str] 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(name="ml-team/classification")

.add_project_service_account()

Adds a service account to a Neptune project.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
service_account_name
(str) - name of the service account you want to add to the project.
role
(str, management.MemberRole) - level of permissions the account should have in the project.
Can be set to:
  • "viewer": can only view project content and members
  • "contributor": can view and edit project content and only view members
  • "owner": can view and edit project content and members
For more information, see docs for User roles in a project.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Example

from neptune import management
management.add_project_service_account(
name="ml-team/classification",
service_account_name="[email protected]",
role="contributor",
)

.remove_project_service_account()

Removes a service account from a Neptune project.
Parameters
name
(str) - The name of the project in Neptune in the format WORKSPACE/PROJECT. If workspace argument was set, it should only contain PROJECT instead of WORKSPACE/PROJECT.
service_account_name
(str) - name of the service account you want to remove from the project.
workspace
(str, optional) - Name of your Neptune workspace. If you specify it, change the format of the name argument to PROJECT instead of WORKSPACE/PROJECT. If None it will be parsed from the name argument.
api_token
(str, optional, defaults to None) - User or service account’s API token. If None, the value of NEPTUNE_API_TOKEN environment variable will be taken.
We strongly recommend using NEPTUNE_API_TOKEN environment variable rather than placing your API token in plain text in your source code.

Example

from neptune import management
management.remove_project_service_account(
name="ml-team/classification",
username="[email protected]",
)