Skip to main content

A project boilerplate generator

Project description

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

Project details


Download files

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

Source Distribution

boilerplater-0.0.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

boilerplater-0.0.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for boilerplater-0.0.0.tar.gz
Algorithm Hash digest
SHA256 e80235bc8c8e526bdf33d5bf1e8f86b8d329342c70b6cdaef0c2f2bd2ea60999
MD5 a41d8b97f0d3961789076375078c3161
BLAKE2b-256 e331a1083c8edfadf969cd6d2760c312623294f3ec1a5edf0fe41e433d2e29ee

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for boilerplater-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d22f6551bf32d27fd739f5a71b5ed59949663b0b7a90937c855255c4825f946
MD5 c97e49051b5311d6a97ac4e54f7b3ed4
BLAKE2b-256 ab3396ae11044de4ae73c96f6377f97e1c0f7a16d3a64304a93c1812e7d9805e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page