Skip to content

Create a project

Use new_project() to create and save a project. Project configuration and setup options are documented in Config and Setup.

new_project

Create a new project entity.

Parameters:

Name Type Description Default
name str

Project name.

required
description str

Human-readable project description.

None
labels list[str]

Project labels.

None
config dict

DHCore environment configuration.

None
source str

Local project context folder. Defaults to the current directory.

None
setup_kwargs dict

Keyword arguments passed to setup_project.

None
extensions list[dict]

Extensions to apply to the project.

None

Returns:

Type Description
Project

Created project entity.

Examples:

Create a project:

import digitalhub as dh

project = dh.new_project(name="my-project")

Get or create

Use get_or_create_project() to retrieve a project or create it when it does not exist.

get_or_create_project

Get a project entity or create it if it does not exist.

Parameters:

Name Type Description Default
name str

Project name.

required
description str

Human-readable project description used when creating the project.

None
labels list[str]

Project labels used when creating the project.

None
config dict

DHCore environment configuration.

None
context str

Local project context folder used when creating the project.

None
setup_kwargs dict

Keyword arguments passed to setup_project.

None
extensions list[dict]

Extensions to apply when creating the project.

None

Returns:

Type Description
Project

Retrieved or created project entity.

Examples:

Retrieve a project or create it if it does not exist:

import digitalhub as dh

project = dh.get_or_create_project("my-project")