Cruft: Template Management for Python Projects

2.16.0 · active · verified Thu Apr 16

Cruft is a Python library and CLI tool that allows developers to maintain essential boilerplate for packaging and building projects, separate from intentionally written code. Built on top of Cookiecutter, it enables automated project creation and, crucially, helps manage template updates and ensure project consistency over time by tracking template changes. The current version is 2.16.0, and it maintains an active release cadence with regular updates and feature enhancements.

Common errors

Warnings

Install

Imports

Quickstart

Cruft is primarily a command-line interface tool. The quickstart involves using `cruft create` to generate a new project from a Cookiecutter template. Once a project is created, `cruft update` can be run within the project directory to apply changes from the template, and `cruft check` validates if the project is in sync with its template.

import os

# Example: Create a new project from a template
# In a real scenario, this would typically be run via CLI
# cruft create https://github.com/cookiecutter/cookiecutter-pypackage.git

print("To create a new project:")
print("  cruft create https://github.com/cookiecutter/cookiecutter-pypackage.git")
print("\nTo check if a project is up-to-date with its template (run in project root):")
print("  cruft check")
print("\nTo update an existing project (run in project root):")
print("  cruft update")

view raw JSON →