pyscaffoldext.cookiecutter package¶
Submodules¶
pyscaffoldext.cookiecutter.extension module¶
Extension that integrates cookiecutter templates into PyScaffold.
When used via PyScaffold’s Python API (instead of CLI), a cookiecutter_params
keyword argument can be optionally added to pyscaffold.api.create_project
,
this argument should be a dict
(or a similar object that can be converted to dict
via the dict
constructor), and is equivalent to extra_context
in
cookicookiecutter.main.cookiecutter
(PyScaffold will always add some default
values, even when no cookiecutter_params
are given).
- class pyscaffoldext.cookiecutter.extension.Cookiecutter(name: Optional[str] = None)[source]¶
Bases:
Extension
Additionally apply a Cookiecutter template. Note that not all templates are suitable for PyScaffold. Please refer to the docs for more information.
- activate(actions: List[Callable[[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]], Tuple[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]]]]) → List[Callable[[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]], Tuple[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]]]][source]¶
Register before_create hooks to generate project using Cookiecutter Activate extension. See
pyscaffold.extension.Extension.activate
.
- augment_cli(parser)[source]¶
Add an option to parser that enables the Cookiecutter extension See
pyscaffold.extension.Extension.augment_cli
.
- persist = False¶
When
True
PyScaffold will store the extension in the PyScaffold’s section ofsetup.cfg
. Useful for updates. Set toFalse
if the extension should not be re-invoked on updates.
- exception pyscaffoldext.cookiecutter.extension.MissingTemplate(message='missing `cookiecutter` option', *args, **kwargs)[source]¶
Bases:
RuntimeError
A cookiecutter template (git url) is required.
- DEFAULT_MESSAGE = 'missing `cookiecutter` option'¶
- exception pyscaffoldext.cookiecutter.extension.NotInstalled(message='cookiecutter is not installed, run: pip install cookiecutter', *args, **kwargs)[source]¶
Bases:
RuntimeError
This extension depends on the
cookiecutter
package.- DEFAULT_MESSAGE = 'cookiecutter is not installed, run: pip install cookiecutter'¶
- pyscaffoldext.cookiecutter.extension.create_cookiecutter(struct: Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], opts: Dict[str, Any]) → Tuple[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]][source]¶
Create a cookie cutter template See
pyscaffold.actions.Action
.
- pyscaffoldext.cookiecutter.extension.enforce_options(struct: Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], opts: Dict[str, Any]) → Tuple[Dict[str, Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template, Tuple[Union[str, None, Callable[[Dict[str, Any]], Optional[str]], Template], Callable[[Path, Optional[str], Dict[str, Any]], Optional[Path]]], dict]], Dict[str, Any]][source]¶
Make sure options reflect the cookiecutter usage. See
pyscaffold.actions.Action
.