Skip to content

cc_overrides

This overrides the default cookie cutter environment.

CustomStrictEnvironment(**kwargs)

Bases: StrictEnvironment

Create strict Jinja2 environment.

Jinja2 environment will raise error on undefined variable in template-rendering context.

Does not expect all the context to be under the cookiecutter key.

JsonifyContextExtension(environment: Environment)

Bases: Extension

Jinja2 extension to convert a Python object to JSON.

jsonify_context(value: Any) -> MutableMapping

Convert a Context to a dict.

prompt_for_config(
    prompts: dict,
    aggregated_context: Context,
    layer_context: Optional[
        MutableMapping[str, Any]
    ] = None,
    no_input: bool = False,
) -> MutableMapping[str, Any]

Prompt user to enter a new config using an existing config as a basis.

Will not prompt for configurations already in the existing configuration.

Prompts can refer to items in the existing config.

Parameters:

prompts

A dictionary of configuration prompts and default values

TYPE: dict

aggregated_context

An existing configuration to use as a basis

TYPE: Context

layer_context

A dictionary of defaults defined in the layer

TYPE: Optional[MutableMapping[str, Any]]

DEFAULT: None

no_input

If True Don’t prompt the user at command line for manual configuration

TYPE: bool

DEFAULT: False

Returns:

MutableMapping[str, Any]

A new configuration context

update_extensions(
    existing_config: MutableMapping[str, Any],
    prompts: MutableMapping[str, Any],
) -> List[str]

Merge extensions from prompts into existing config.