Skip to content

Creating and deleting projects via API#

Open in Colab

You can do various project administration tasks with the management module of the Neptune API.

In this basic guide, we show you how to:

  1. Create a new project
  2. List the projects you have access to
  3. Delete a project

Example script 

Creating a project#

Before you start: Obtain the name of the workspace where the project should be created.

To create a new project, import the management module and use the create_project() method:

from neptune import management

management.create_project(
    name="named-entity-recognition",  # (1)
    key="NER",
    workspace="ml-team",
    visibility="priv",
    description="Team-wide NER project for important 2023 conference"
)
  1. You can also prefix the workspace name here and omit the workspace parameter. For example, name="ml-team/named-entity-recognition"

  2. You must supply the workspace and project name; everything else is optional.

  3. If you omit the key argument, Neptune generates a project key for you based on the project name.

Expected output

If the project was created successfully, Neptune returns the full name of the new project:

'ml-team/named-entity-recognition'

Listing projects you have access to#

To get a list of all projects you have access to, import the management module and use the get_project_list() method:

from neptune import management

management.get_project_list()  # (1)
  1. We recommend saving your API token as an environment variable. If needed, you can pass it as an argument here: management.get_project_list(api_token="h0dHBzOi8aHR0cHM6Lkc..."

Expected output

A list of project names that the account associated with the API token has access to. For example:

['jackie/sandbox', 'jackie/thesis-project', 'ml-team/classification', 'ml-team/test']

Deleting a project#

Before you start: Obtain the name of the project and the workspace where it's located.

To delete a project, import the management module and use the delete_project() method:

from neptune import management

management.delete_project(
    name="named-entity-recognition",  # (1)
     workspace="ml-team",
)
  1. You can also prefix the workspace name here and omit the workspace parameter. For example, name="ml-team/named-entity-recognition"

Expected output

If there is no error message, the project was deleted successfully.