Skip to content

create

Methods for generating projects.

create_cmd(
    path_or_url: str,
    output_dir: Optional[Path] = None,
    no_input: bool = False,
    checkout: Optional[str] = None,
    directory: Optional[str] = None,
    overwrite_if_exists: bool = False,
    skip_if_file_exists: bool = False,
    default_config: bool = False,
    accept_hooks: str = "all",
    initial_context: Optional[
        MutableMapping[str, Any]
    ] = None,
) -> Path

Generate a new project from a composition file, local template or remote template.

Parameters:

path_or_url

The path or url to the composition file or template

TYPE: str

output_dir

Where to generate the project

TYPE: Optional[Path]

DEFAULT: None

no_input

If True force each layer’s no_input attribute to True

TYPE: bool

DEFAULT: False

checkout

The branch, tag or commit to check out after git clone

TYPE: Optional[str]

DEFAULT: None

directory

Directory within repo that holds cookiecutter.json file

TYPE: Optional[str]

DEFAULT: None

overwrite_if_exists

Overwrite the contents of the output directory if it already exists

TYPE: bool

DEFAULT: False

skip_if_file_exists

Skip the files in the corresponding directories if they already exist

TYPE: bool

DEFAULT: False

default_config

Do not load a config file. Use the defaults instead

TYPE: bool

DEFAULT: False

accept_hooks

Which pre/post hooks should be applied?

TYPE: str

DEFAULT: 'all'

initial_context

The initial context for the composition

TYPE: Optional[MutableMapping[str, Any]]

DEFAULT: None

Raises:

ClickException

If there is a problem cloning the repository

Returns:

Path

The path to the generated project.