Member-only story
One Template to Rule Them All: Creating and Managing Python Projects with Cookiecutter and Cruft
Create Projects Fast, Update Them Even Faster
Starting a new Python project can be a daunting task, especially if you want to reuse a structure similar to your previous projects. I prefer to use the same Dockerfile, poetry configuration, folder organization, and so on. Sometimes, of course, there may be some minor variations, but the majority of the code remains the same. Doing this manually every time requires a lot of patience and is time-consuming. Cookiecutter is the perfect solution.
What is Cookiecutter?
Cookiecutter is a Python package that creates projects from templates using Jinja’s syntax. Although it’s a Python package, it can be used to create projects in multiple languages.
Create projects with Cookiecutter
To create a project using Cookiecutter there are two ways: You can install a ready-to-use package, or You can create your custom version. In this article, I will show how to create a custom Cookiecutter version. To get started using Cookiecutter you can install it by running:
poetry add cookiecutter