Skip to content

Cookiecutter

Cookiecutter is a command line utility that creates projects from project templates, known as "cookiecutters". When creating a new project from a template, Cookiecutter prompts the engineer to interactively make choices that are specific to the template they are setting up. This allows for pre-configuration of generic decisions like project source code structure, as well as project specific decisions such as integration with a cloud provider for deployment and a build system for CI/CD. Cookiecutter then uses a templating system — Jinja2 — to replace or customize folder and file names, as well as specific file content.

Cookiecutter Docs

Cookiecutter takes a template provided as a directory structure with template-files. Cookiecutter supports using templates located in the filesystem, as a ZIP-file or on a VCS-Server (Git/Hg) like GitHub. Almost all of Jax's customized templates are co-located in the Software Templates Bitbucket repository.

Why Cookiecutter?

Starting a new repository in a project can be cumbersome, specially if you collaborate with others: you have to follow standards and agreements, there are some mandatory files, you have to place, deploy artifacts somewhere, the requirements should be in a certain place etcetera. Also, with every new project we may reuse or modify existing connectors/modules/libraries, or create new ones inspired in the old ones. And so, we would like to make a template that can be reused. An excellent package to achieve this is called cookiecutter.

Cookiecutter Features

  • Project templates can be in any programming language or markup format: Python, JavaScript, Ruby, CoffeeScript, RST, Markdown, CSS, HTML, you name it. You can use multiple languages in the same project template.

  • Powered by Jinja2, and able to leverage most functionality of that templating engine.

  • Cross-platform: Windows, Mac, and Linux are officially supported.

  • You don’t have to know/write Python code to use Cookiecutter.

Installation

How To Install Cookiecutter

Quick Start

  1. Install - Docs
  2. Browse - Jax Software Tempaltes
  3. Cut Cookies!
  4. Tell cookiecutter which tempalte you want to use
     cookiecutter git@bitbucket.org:jacksonlaboratory/software-templates.git \
       --directory="python-poetry-fastapi"
    
  5. Answer the prompts!
    project [cookiecutter-fastapi]: test
    author [Jax Computational Sciences]: 
    email [cssc@jax.org]: 
    version [0.0.1]: 
    description [description]: Just an example project to demonstrate Cookiecutter
    app_name [cookie_app]: cookiecutter_demo  
    

Where To Find Cookiecutter Templates

Jax maintains templates that are specifically tailored to use in Jax's development and deployment environments. These templates are available in a singular combined git repository in Bitbucket: software-tempaltes.

If you don't find what you need there, the next best place to start searching for specific and ready to use cookiecutter template is Github search.

You can also find the templates maintained by the cookiecutter team here.

Cookiecutter templates @ JAX devops

python-package

python-poetry-cli

python-poetry-fastapi

Cookiecutter Templates Maintained by the Cookiecutter Team:

cookiecutter-pypackage: ultimate Python package project template.

cookiecutter-django: a framework for jumpstarting production-ready Django projects quickly. It is bleeding edge with Bootstrap 5, customizable user's app, starter templates, working user registration, celery setup, and much more.

cookiecutter-pytest-plugin: Minimal Cookiecutter template for authoring pytest plugins that help you to write better programs.

Cookiecutter tutorials in devops knowledge base

Installation

Create a Project From a Tempalte

Create a Template From a Project