Skip to main content

boilerplater

A CLI tool for scaffolding new projects from Jinja2 template directories. Define typed variables directly in your templates, load default values from YAML data files, and fill in the rest interactively through a terminal form.


Features

  • Typed template variables — annotate variables with PEP 484-style type hints ({{ count: int }}) to get the right input widget automatically
  • Interactive TUI form — prompts for any undeclared variables using a clean terminal UI (powered by Textual)
  • YAML data files — pre-supply common variables (author name, email, etc.) so you're never asked for the same thing twice
  • Binary-safe — text files are rendered as Jinja2 templates; binary files (images, archives, ELF binaries) are copied verbatim using libmagic detection
  • Permission-preserving — file modes are carried over from the template to the output

Requirements

  • Linux / MacOS
  • Python 3.10+
# Debian / Ubuntu
apt install libmagic1

# macOS
brew install libmagic

Installation

pip install boilerplater

Or with pipx (recommended for CLI tools):

pipx install boilerplater

Setup

Boilerplater expects two directories:

Directory Default Purpose
--templates-dir ~/.local/opt/boilerplater/templates Your project template directories
--data-dir ~/.local/opt/boilerplater/data YAML files containing pre-supplied variables

Both are created automatically on first run if they don't exist.

Template structure

Templates are organised into categories (e.g. language or framework) and templates (e.g. project type):

~/.local/opt/boilerplater/templates/
  python/
    cli/
      {{ module_name }}/
        __init__.py
        __main__.py
      pyproject.toml
      README.md
  rust/
    cli/
      src/
        main.rs
      Cargo.toml

Any file that libmagic identifies as a text type is rendered as a Jinja2 template. Everything else is copied as-is.

Typed variables

Variables can carry an optional type annotation in the template tag:

{{ variable_name: type }}

Supported types and their form widgets:

Type Widget
str Text input
int Integer input (validated)
float Number input (validated)
bool Checkbox
click.Choice Select dropdown

The annotation is stripped before rendering — {{ count: int }} becomes {{ count }} at render time.

Data files

Place any number of .yaml files in your data directory to pre-supply variables across all templates. Any variable defined here won't appear in the interactive form.

# ~/.local/opt/boilerplater/data/user.yaml
author: Samwise Gamgee
email: mayorofhobbiton@example.com
github: mayorgamgee

Usage

boilerplater <target-path> [OPTIONS]

Arguments

Argument Description
target-path Where the new project will be created

Options

Option Short Description Default
--templates-dir Path to your templates ~/.local/opt/boilerplater/templates
--data-dir Path to your YAML data files ~/.local/opt/boilerplater/data
--category -c Template category (e.g. python) prompted
--template -t Template name (e.g. cli) prompted
--log-level Logging verbosity WARNING

Examples

Fully interactive — prompts for category, template, and any undeclared variables:

boilerplater ~/projects/my-new-app

Category provided — prompts for template only:

boilerplater ~/projects/my-new-app -p python

Fully specified — prompts only for undeclared template variables:

boilerplater ~/projects/my-new-app -p python -t cli

Shell completion

Boilerplater supports tab completion for --category and --template via Typer.

To install completions for your shell:

boilerplater --install-completion

Typer is aware of what shell you are using and will install the completion in the corresponding directory.
For bash: $HOME/.bash_completions/boilerplater.sh For fish: $HOME/.config/fish/completions/boilerplater.fish For zsh: $HOME/.zfunc/_boilerplater


Built-in defaults

The following variables are always available in templates without needing to be declared in a data file or prompted:

Variable Value Purpose Example
now datetime.now() at time of invocation When the current date is required as a variable Copyright {{ now.year }}
module_name target-path stem, slugified with underscores For use in path names and import statements or wherever snake case is prefered. from {{ module_name }}.config import Config
package_name target-path stem as-is For use in documentation or other cases where the name of the project is used. ## Installing {{ package_name }}

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boilerplater-1.0.1.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boilerplater-1.0.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file boilerplater-1.0.1.tar.gz.

File metadata

  • Download URL: boilerplater-1.0.1.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for boilerplater-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5440fc2b51e0114f5c691154c43d2e2ce112a8c628814fcbb2d1ed3b36dc9c2d
MD5 ab5bb466005dda0c43dc2aa2b5f54fa4
BLAKE2b-256 7ba3d584f634d3bb3b22c144e786b353745e81dec1bc885fc1ef1481ae1eb859

See more details on using hashes here.

File details

Details for the file boilerplater-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: boilerplater-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for boilerplater-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c4c9138f2232c0032dbffaf5160ccb20a50dcb687fe2c95c098f4f4f8164534
MD5 10b5677eda6b91a5c116004ef0fabd2a
BLAKE2b-256 eb3b1524d0cc7bbf6c4e9b24cc385be41b8cb5988622e8de29b96793c06d3c8b

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

2 files

1.1.0

2 files

This release

1.0.1 This release

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page