SciPy 2024

Cookiecutter: Project Templates and Much More
07-09, 08:00–12:00 (US/Pacific), Room 315

Cookiecutter is mainly known as a tool for software project templates. But its possible use cases are much more versatile: plain text and code, small building blocks and whole projects.
You can get started and build powerful templates without any programming - by using a CLI tool and editing text files. And if you're willing to throw some Python code and Jinja extensions into the mix, you can build pretty sophisticated and flexible automations.
The main goal of this workshop is to give some inspiration: How to detect candidates for automation in your workflow? Where can you improve speed and consistency and free up some mental energy for the actual content of your task?


Cookiecutter is mainly known as a tool for software project templates. But its possible use cases are much more versatile: plain text and code, small text snippets, multiple files, and whole projects.

The main goal of this workshop is to detect possibilities for automation in your day-to-day and less frequent tasks.
The secondary goal is to get acquinted with an amazing and flexible tool.

Overview

This 4-hour workshop will have 4 major parts:

Without coding:

  • Hour 1: Cookiecutter basics
  • Hour 2: Advanced Cookiecutter: load variables from multiple sources, dictionary variables

With coding:

  • Hour 3: More powerful automations with pre and post hooks and Jinja extensions.
  • Hour 4: Combining the techniques learned and discussing various examples.

Automation without Coding

1. Hour: Cookiecutter Basics

Start with small

  • Convert your directory into a template.
  • Introduce variables.
  • Getting to know the major parts: cookiecutter.json, Jinja, the project root directory.

2. Hour: Advanced Cookiecutter Features

  • Loading variable values from a file.
  • Configuration.
  • Dictionary variables.

More Powerful Automations with Code

3. Hour

  • Automate your project setup with pre and post hooks.
  • Put the generated files into their right context.
  • Jinja extensions: More dynamic variable values.

Real-World Examples

Discussing versatile examples and see how they combine the elements we've just learned.

Types of examples:

  • small cookiecutter with few variables for quick scaffolding
  • big cookiecutter with many variables to enforce best practices
  • application using cookiecutter as a Python library

Topics of examples:

  • non-code
  • content & code, e.g. a MkDocs site
  • software project: code, test, documentation, developer tools, CI/CD infrastructure
  • Jupyter notebook

Prerequisites

Knowledge and skills:

  • Basic familiarity with JSON.
  • Basic programming concepts: variables, if, loops - not strictly necessary but helpful.

System requirements:

  • terminal
  • an editor to edit text files, incl. json
  • have Python installed
  • have cookiecutter installed
Installation Instructions

https://cookiecutter.readthedocs.io/en/stable/installation.html

Freelancing software engineer.
Current focus areas: code re-usability, workflow automation, AI-assisted coding.
Experience ranging from big fintech organizations with microservice architectures to a startup focused on developer productivity tools.