Why Protostar?¶
When starting new projects, developers frequently turn to general-purpose template generators like Copier or Cookiecutter. While these tools excel at multi-language scaffolding, Protostar takes a radically different approach: deep domain specialization for the modern Python ecosystem.
If you've ever wrestled with complex Jinja conditionals just to toggle a linter, had your IDE formatters break on a templated repository, or had a template update overwrite your pyproject.toml, Protostar was engineered for you.
-
Semantic AST Merging
Parses and merges
pyproject.tomland.gitignorevia Abstract Syntax Trees, preserving comments and formatting without merge conflicts. -
Composable Flags & Toggles
Modular tools (
ruff,pytest,docker,direnv) composed dynamically via tri-state CLI flags—no template spaghetti required. -
Scalable Blueprint Model
Scales from a single shareable
.tomlfile (Gist/URL ready) to full multi-file repositories with dynamic variable interpolation. -
Manifest-First Determinism
Separates planning from execution. Run atomic
--dry-runsimulations and pipe machine-readable--jsonenvelopes to AI agents.
The Authoring Experience: TOML vs. Jinja2¶
The biggest maintenance burden in generic scaffolding engines is writing and maintaining the templates themselves. Protostar replaces brittle string templating with declarative configuration.
1. No More Broken Linters in Templates¶
In Copier, Jinja syntax ({{ variable }}) is embedded directly into source files. Because these files contain invalid syntax prior to rendering, your IDE's linters (Ruff, Black, YAML formatters) will fail or flag false positives throughout the template repository.
#:schema https://raw.githubusercontent.com/jacksonfergusondev/protostar/main/schemas/template.schema.json
name = "api-service"
description = "Production FastAPI template with Ruff and Docker"
dependencies = ["fastapi", "uvicorn[standard]", "pydantic"]
ruff = true
pytest = true
docker = true
[dev.pyproject.tool.ruff.lint]
select = ["E", "F", "I", "UP"]
# ⚠️ IDE linters and TOML formatters will break parsing this file
[project]
name = "{{ project_name }}"
dependencies = [
"fastapi",
"uvicorn[standard]",
"pydantic"{% if include_database %},
"sqlalchemy",
"alembic"{% endif %}
]
{% if linter == "ruff" %}
[tool.ruff.lint]
select = ["E", "F", "I", "UP"]
{% endif %}
Full IDE Autocomplete & Schema Validation
Because Protostar templates are pure TOML validated against a JSON Schema, you get instant autocomplete, hover tooltips, and real-time validation in editors like VS Code (Even Better TOML) and PyCharm.
2. Zero-Logic Templates vs. Combinatorial Explosion¶
When building templates in Copier, supporting optional features (e.g., Docker, pre-commit, direnv, multiple linters) forces the author to write deeply nested {% if %} / {% endif %} conditionals across dozens of template files. Adding even a few optional tools causes the template's complexity to explode.
The template author writes zero control logic. You define your ideal standard in a static .toml blueprint. You can then toggle any component on or off dynamically at runtime:
3. Built-in Domain Awareness¶
Generic templaters know nothing about Python project structures. Authors must write and maintain boilerplate files from scratch for every template:
.gitignorematrices (ignoring.venv,__pycache__,.pytest_cache,.ruff_cache)- Optimal multi-stage
Dockerfileand.dockerignorepatterns for Python pre-commit-config.yamlversioning and hook wiring
With Protostar, the engine is natively specialized for Python. When you toggle docker = true or ruff = true, Protostar automatically scaffolds battle-tested, best-practice artifacts without you having to write or maintain them.
4. Scalable Blueprint Distribution¶
Copier requires a complete Git repository containing a directory structure and configuration metadata. Protostar scales seamlessly across two levels:
-
The Single-File Blueprint: For lightweight environments or team standards, share a single 15-line
.tomlfile via a GitHub Gist or URL: -
The Multi-File Repository: For complex architectures requiring boilerplate source code (e.g., full FastAPI or PyTorch project trees), use a standard Git repository containing a
protostar.tomlmanifest and atemplate/directory with<% VARIABLE_NAME %>interpolation.
Your Experience: Safe & Deterministic¶
AST Deep-Merging vs. 3-Way Git Conflicts¶
When applying template updates or injecting tooling into an existing repository, Copier runs a 3-way Git merge against the generated file diffs. If you reformatted pyproject.toml or added custom comments, this often results in messy Git merge conflicts.
Protostar parses pyproject.toml into an Abstract Syntax Tree via tomlkit. It updates tables and arrays with exact semantic precision:
Manifest-First Pre-flight Execution¶
Generic scaffolding tools execute shell hooks imperatively. If a required tool (such as uv, git, or docker) is missing from your machine, the script fails halfway through, leaving a dirty, half-scaffolded workspace.
Protostar uses a two-phase headless architecture:
plan()(Read-Only Phase): All modules declare requirements into a centralizedEnvironmentManifest. System checks verify all dependencies upfront.execute()(Side-Effect Phase): Disk mutations and subprocesses run only after the entire plan is validated.
(For a deeper visual breakdown of this two-phase execution, see Design Principles).
Comparison Matrix¶
| Feature | Copier | Protostar |
|---|---|---|
| Primary Scope | Multi-language / General Purpose | Modern Python Ecosystem |
| Template Format | Must be a full Git repository of Jinja files | Scales from a single .toml file to full repository archives |
| IDE Validation | Jinja syntax breaks in-repo linters | JSON Schema autocompletion & validation |
| Tool Toggling | Complex {% if %} template spaghetti |
Built-in tri-state CLI flags (--<flag>, --no-<flag>) |
| Config Mutation | Plain text / regex replacement | Semantic AST merging (preserves comments & formatting) |
| Template Upgrades | 3-way Git diffs (prone to merge conflicts) | Non-destructive AST injection & language marker blocks |
| Machine / Agent API | Basic interactive prompt bypass | Native --json envelopes and atomic --dry-run |
| Performance | Clones repos & negotiates remote Git TLS | Sub-second edge JSON hook registry with offline fallbacks |
* Cookiecutter is another popular tool in this space, but lacks native 3-way Git diff updates. Most of Copier's comparisons in this matrix apply to Cookiecutter as well.
Choosing the Right Tool¶
-
Choose Copier if...
-
You are building multi-language stacks (e.g., Go, Rust, or TypeScript microservices).
- You require continuous, long-term 3-way Git diff tracking of upstream template changes across full source code trees.
-
You are generating complex, non-Python codebases with extensive custom boilerplate logic.
-
Choose Protostar if...
-
You want high-velocity, zero-friction bootstrapping for modern Python projects (
uv,ruff,pyproject.toml). - You want simple, shareable templates that don't require maintaining complex Jinja logic or dedicated Git repos.
- You need safe, conflict-free AST updates to existing configuration files.
- You are building automated or AI-assisted scaffolding workflows using
--jsonand--dry-run.
Next Steps¶
Ready to get started or dive deeper into the architecture?
- Getting Started: Install Protostar and scaffold your first project in seconds.
- Environment Initialization: Learn how to run Protostar interactively via the TUI wizard or headlessly via CLI flags.
- Templates & Portable Configs: Explore declarative TOML blueprints, remote templates, and dynamic variable interpolation.
- The Orchestrator: Understand the two-phase execution engine that guarantees atomicity and safe configuration merges.