Framework for Python

Project Management

project_create_from_layers()

Create a project from a layers file (the format framework.pub sends).

With interactive=False (the default) it runs headless for automation, as project_create(headless=True) describes.

Usage

project_create_from_layers(
    layers_file: str | Path,
    path: str | Path = '.',
    interactive: bool = False,
) -> Path

Arguments

Name Type Default Description
layers_file required str | Path

A JSON file with spec_version (which must be 1), name, layers, and optionally author and source. The layers are resolved with spec_resolve().

path str | Path '.'

The project folder. Default: the current directory. In headless mode it must be a fresh checkout. Otherwise it must not exist.

interactive bool False

Create the project in regular mode, with git initialization and a registry entry. Nothing is prompted for either way. Default: False, which creates it headless.

Value

The project folder.

Raises

  • FrameworkError: When the layers file cannot be read, has an unsupported spec_version, or has no name, or when the project cannot be created there.
  • SpecError: When the resolved spec is invalid.