Sometimes I work on similar projects that need so little customization I feel like I can just copy and paste it, and tweak some variables, then create a new repo for it, and start to generate the content. Here is where project templates come into play.
Cookiecutter is a python tool that lets you create an initial template that you can use for later projects. Just because it is written in python it does not mean it can only scaffold python projects.
The theory is dead simple.
- You create a folder for your templates.
- In each template mark the text substitution points in your file content,
file names or directory names. with
- Specify the variables that cookiecutter needs to look for in
cookiecutter.jsonfile for each project.
I recommend that you follow the official docs instructions, because my article can become outdated.
The awesome part is that you can even use a github repo to start out from.
My experience with it
I first encountered with this tool when I worked on a custom plotly-dash react component.
In order to get started with that, I only needed to execute
cookiecutter https://github.com/plotly/dash-component-boilerplate.git, answer a few questions about the projects and
I was ready to go with a working personalized template.
I was amazed by this simplicity.
I use the python API interface to have some custom behavior and start it out from this python script.
I was not asked to create this post, and did not get anything for it, I just wanted to share how simple it is to use and some of my experience with it.