Skip to content

create_project

Module: flowerpower.flowerpower

The create_project function either loads an existing FlowerPower project or raises an error if the project does not exist. It is a convenient top-level function.

create_project(name: str | None = None, base_dir: str | None = None, storage_options: dict | BaseStorageOptions | None = {}, fs: AbstractFileSystem | None = None, job_queue_type: str = settings.JOB_QUEUE_TYPE, hooks_dir: str = settings.HOOKS_DIR) -> FlowerPowerProject

Loads an existing FlowerPower project.

Parameter Type Description
name str | None The name of the project. Defaults to the current directory name.
base_dir str | None The base directory where the project will be created or loaded from. Defaults to the current working directory.
storage_options dict | BaseStorageOptions | None Storage options for the filesystem.
fs AbstractFileSystem | None An instance of AbstractFileSystem to use for file operations.
job_queue_type str The type of job queue to use for the project.
hooks_dir str The directory where the project hooks will be stored.

Returns: A FlowerPowerProject instance.

Raises: FileNotFoundError if the project does not exist at the specified base directory.

Example

from flowerpower import create_project

# Load an existing project
project = create_project(base_dir=".")

# Attempt to load a non-existent project (will raise FileNotFoundError)
try:
    project = create_project(base_dir="./non_existent_project")
except FileNotFoundError as e:
    print(e)

```python from flowerpower import FlowerPower

Alias for create_project

project = FlowerPower(base_dir=".")