Cookiecutter– A fantastic tool for creating templates of all sorts of projects.
What is Cookiecutter?
- We can create a template or grab some template off the internet that represents the inputs that we can use to generate some really interesting project.
- May be it is a web application set up with the framework that you like and the ORM that you like and all the various integration that you might need.
- We are going to take this and feed it to the cookiecutter engine. Now these templates can be in all sorts of languages it could be python, it could be c++, it could be c- sharp it doesn’t matter.
- Cookiecutter works against a whole variety of different types of technologies.
- It is going to ask the user who’s creating this project a couple of questions like what’s a project name? How do you want to deploy it and so on.
- It is going to take that information and combine it with the template and generate a shiny new project that you can use.
Cookiecutter was created by AUDREY ROY GREEN FELD back in 2013.
Why one would use Cookiecutter?
Two general use-cases
On one-hand:- I might just be a user and I want to create on project. So I might be able to more easily create complex projects. This would make my process of creating projects more reliable and it is faster or on boarding for new users who have to create projects from some complicated thing. If there is a cookiecutter template you can run one command and boom you have a shiny new project ready to go.
On the other-hand:- You might want to create cookiecutter template and we focus a lot on that in this course here. You would be able to possibly increase adoption in your project it is easier to get started it is more obvious how to get started. One could reduce support costs or support effort because you longer have to help users get started. Just say run this one command you are started now.
How we use our project?
- You can help those user’s fall into the pit of success by structuring everything just the right way so bugs they just keep going with the momentum you set.
- You can even gain exposure for your project. So if you are doing out in public you could have your cookiecutter template listed in cookiecutter documentation and that would help other discover what you have created and build.
- Finally it provides consistency across your organization. If you are using cookiecutter for internal projects then this provides a way for internal projects that get created inside your company or inside your team to be done in a similar way because it is always done with the same template.
Users of Cookiecutter template
- Easily create complex templates.
- Repeatable process.
- Faster on boarding of new devices.
Authors of Cookiecutter templates
- Increase adoption of your project.
- Reduce support costs.
- Help users “fall into the pit of success”.
- Gain exposure for your project.
- Provide consistency across your organization.
3 core sections to this course
1. Consuming cookiecutter
- Prerequisites and setup.
- Installing cookiecutter.
- Learning the CLI(Command Line Interface).
- Surveying the pantary.
- Local Vs remote template.
- Profile defaults.
- Virtual environment.
- Replaying creation.
2. Cookiecutter as a project lead
- Creating templates for your project and for your company.
- Creation basics.
- Project structure and naming.
- Promoting the user.
- Choice prompts.
- Complex default values.
- Pre-post generation hooks.
- Excluding files from transforms.
- Conditional files and directories.
- Case-Study(Project templates).
- Adding your template to the cookie pantry.
- Programmatic Cookiecutter.
3. Cookiecutter as a contributor
- Building Cookiecutter locally.
- Contributor guidelines.
- Adding a feature.