cookiecutter
Generate projects from templates
SYNOPSIS
cookiecutter [OPTIONS] TEMPLATE [EXTRA_CONTEXT]
PARAMETERS
--output-dir OUTPUT_DIR
Directory to output generated project
--checkout REV
Checkout specific template revision
--config-file FILE
Path to user configuration file
--no-input
Disable interactive prompts; use defaults
--accept-hooks
Accept hook config files without validation
--replay
Replay previous generation from file
--replay-file FILE
Custom replay file path
--overwrite-if-exists
Overwrite existing files
--skip-if-file-exists
Skip generation if files exist
--output-file FILE
File for replay data output
--debug
Enable debug logging
-h, --help
Show help message
--version
Display version information
DESCRIPTION
Cookiecutter is a versatile command-line utility that creates projects from reusable cookiecutter templates using the Jinja2 templating engine. Templates define a directory structure with placeholders for user input, specified in a cookiecutter.json file. Users provide values via prompts or extra context, generating customized files instantly.
It excels at scaffolding boilerplate code for Python packages, web apps, Docker setups, and more, supporting any language or toolset. Templates are often hosted on GitHub, but local directories work too. Popular in open-source for standardizing project initialization.
Installation requires Python: pip install cookiecutter. Invoke with a template URL, e.g., cookiecutter gh:audreyr/cookiecutter-pypackage. It clones the template, renders files, cleans up, and outputs to the current or specified directory. Features like pre/post hooks (Python scripts) enable automation. Replay mode regenerates projects without reprompting, ideal for CI/CD.
Widely adopted by projects like cookiecutter-django and cookiecutter-hypermodern-python, it saves time on repetitive setup.
CAVEATS
Not a standard Linux utility; requires Python/pip installation. Templates must include valid cookiecutter.json. Git needed for remote templates. Potential issues with permissioned repos or large templates.
INSTALLATION
pip install cookiecutter or pipx install cookiecutter for isolated env.
BASIC EXAMPLE
cookiecutter https://github.com/cookiecutter/cookiecutter-pypackage
Follows prompts for project name, author, etc., generates Python package.
TEMPLATE STRUCTURE
Requires cookiecutter.json with variables; uses {{cookiecutter.var_name}} in files.
HISTORY
Created in 2013 by Audrey Roy Greenfeld as a Django project generator. Evolved into general-purpose tool under cookiecutter-id repo. Maintained by community since 2015; version 2.0+ added replay and improved hooks.


