Cookiecutter takes a template provided as a directory structure with template-files. Templates can be in located in the filesystem, as a ZIP-file or on a VCS-Server (Git/Hg) like GitHub.

It reads a settings file and prompts the user interactivly wether to change the settings.

Then it takes both and generates an output directory structure from it.

Additional the template can provide code (Python or shell-script) to be executed before and after generation (pre-gen- and post-gen-hooks).


This is a directory structure for a simple cookiecutter:

├── {{ cookiecutter.project_name }}/  <--------- Project template
│   └── ...
├── blah.txt                      <--------- Non-templated files/dirs
│                                            go outside
└── cookiecutter.json             <--------- Prompts & default values

You must have:

  • A cookiecutter.json file.

  • A {{ cookiecutter.project_name }}/ directory, where project_name is defined in your cookiecutter.json.

Beyond that, you can have whatever files/directories you want.

See https://github.com/audreyr/cookiecutter-pypackage for a real-world example of this.


This is what will be generated locally, in your current directory:

mysomething/  <---------- Value corresponding to what you enter at the
│                         project_name prompt
└── ...       <-------- Files corresponding to those in your
                        cookiecutter's `{{ cookiecutter.project_name }}/` dir