Starting a new project can be quite repetitive task.
Fortunately, automating repetitive task is what programming is good at, right?
So you’d expect to find plenty of options spitting boilerplate code around, removing the tedious setup, giving us more time for the fun stuff.
Funny enough they are not that many options around (I mean there is some choice but if you want to know how many is too many option, try to count how many implementation of the ls
command, if you can… and then get back to me…)
So the main contender are
- Cookiecutter
- yeoman
- copier
- Stencil
Yeoman
Yeoman is your funky little robot that’ll help you generate the skeleton of your project in no time.
It is a mature open source project, which was created in 2012 by Addy Osmany and Sindre Sorhus as a set of tools to help developpers improve their workflow. Today it stands at around 10k stars on github still actively maintain.
Yeoman is written in javascript gained popularity mostly in the frontend side of things, though it is used today for about anything, from API generation to generating generators…
Now, I am personaly not a fan, I have tried to use it and got into a few issues, mostly:
- generators are quite complex to write
- most of them are quite outdated, and not much options
No much generators. But of project template are outdated, or the npm packages are outdated…
And it is quite complexe to write one.
Cookiecutter
Meet Cookiecutter, the baking-inspired tool that’ll help you whip up a new project faster than you can say “template-tastic”!
|
|
When the template is used, the user will be asked to provide a value for project_name
.
The template will be then rendered replacing the {{cookiecutter.project_name}}
with the user input.
Cookiecutter is building on the python templating language jinja
, which supports more complex templates and variables, such as conditional statements, loops and more. This allows you to create more sophisticated templates that can adapt to different use cases.
Cookiecutter was created in 2013 by Audrey Roy Greenfeld. It’s an open-source command-line utility tool that creates projects from cookiecutters (project templates), e.g. Python package projects, jQuery plugin projects, etc. It is written in Python and is compatible with both Python 2 and Python 3. Cookiecutter’s goal is to make it easy for developers to create new projects quickly by providing a set of templates that can be easily customized.
Cookiecutter has become a popular tool among developers and is actively maintained, with the latest version released on 2021. It’s also integrated to other tools like Visual Studio Code and PyCharm, making it even more accessible to developers.
Copier
Copier is an other tool to create projects. It’s using templates, questionnaires and projects. The templates provide the structure of the subproject, and then the answers provided in the questionnaire are used to generate the final project.
It can be used with both local file paths and git URLs, and it allows users to upload their own files. Additionally, it supports the ability to make changes to the project, called migrations.
Copier is basically a refreshed and improved version of cookiecutter. It is also using python and jinja, add some more structure with the yaml and the questionaire separately configured.
The option to update the project is also interesting.
Stencil
Stencil is a really nice find. First it is written in golang, which mean it’s a simple cli with no external dependancies, which is always nice. Secong because it allows not only project scaffolding, but also individual files.
It is yaml based, used a service.yaml