LinuxCommandLibrary

copier

TLDR

Create project from template

$ copier copy [gh:user/template] [destination/]
copy
Create from local template
$ copier copy [./template] [./project]
copy
Update existing project
$ copier update
copy
Update to specific version
$ copier update --vcs-ref [v2.0.0]
copy
Recopy with new answers
$ copier recopy
copy
Answer prompts non-interactively
$ copier copy --data [name=myproject] [template] [dest]
copy

SYNOPSIS

copier command [options] [arguments]

DESCRIPTION

copier renders project templates with Jinja2 templating. Supports Git URLs and local paths. Unique feature: update existing projects when template evolves while preserving your changes.

PARAMETERS

--data key=value

Answer questions non-interactively
--vcs-ref ref
Git reference (tag/branch)
--trust
Trust template (run tasks)
--pretend
Preview without creating files
--skip path
Skip specific paths
--force
Overwrite without prompting
-a, --answers-file file
Load answers from file

COMMANDS

copy template destination

Create new project from template
update
Update project from template
recopy
Regenerate with new answers

TEMPLATE STRUCTURE

Files ending in .jinja are rendered. Others are copied as-is.

$ template/
├── copier.yml        # Config & questions
├── {{project_name}}/ # Dynamic directory
└── README.md.jinja   # Templated file
copy

CAVEATS

Requires Python 3.10+ and Git 2.27+. Templates versioned by Git tags. Use --trust for templates with tasks.

SEE ALSO

Copied to clipboard