Copier Org Copier Versions Save

Library and command-line utility for rendering projects templates.

v7.1.0

1 year ago

Feat

  • include git in flake app
  • support preserving symlinks when copying templates (#938)
  • allow imports in inline templates (#986)
  • properly support update in repo subdirectory (#1069)
  • allow templating _answers_file setting (#1027)
  • let answers file exist in a subdirectory
  • validate answers given via CLI/API
  • exclude nothing by default when using subdirectory
  • add native OS directory separator variable in _copier_conf.sep to allow generating dynamic directory structures
  • nix support

Fix

  • include dirty local changes when copying HEAD
  • require answer for questions without default value (#958)
  • cleanup: don't clean up local template in parent folder
  • delete conditionally created file when answer changes (#982)
  • properly support diffs over updates with new interactive answers
  • ignore Git hooks during project update (#1066)
  • properly support diffs over updates with new answers
  • skip tasks in pretend mode (#970)
  • parse CLI data using question's answer parser
  • don't set YAML !include constructor globally (#947)
  • cli: use --conflict flag only in copier update subcommand
  • ignore template repo tags that aren't valid PEP 440 versions
  • --skip option was ignored (#966)
  • Remove useless is_dir check
  • don't attempt to render a file if its name is empty
  • warn users against using shallow clones as template source

Refactor

  • tests: remove unknown timeout marker
  • deduplicate code
  • remove unused method argument
  • simplify casting boolean question settings
  • remove useless code related to not asking a question
  • typing: use Mapping instead of ChainMap type
  • move unrelated code out of try-except block
  • inline: smarter inline conflict markers algorithm

v7.0.1

1 year ago

Fix

  • remove deprecated code scheduled for removal in Copier v7 (#843)

v7.0.0

1 year ago

Feat

  • expand tilde in template source path (#835)

Fix

  • delete temporary clones after execution automatically (#802)
  • typing: remove invalid migration task stage "task"

Refactor

  • typing: use abstract container types where possible (#832)
  • use dict constructor as default factory
  • typing: remove unused types
  • remove unreachable code (#826)
  • model a task to execute using a dataclass
  • reduce module imports

v6.2.0

1 year ago

Feat

  • add validator field to Question (#719)
  • support passing github or gitlab urls without the .git suffix (#677)

Fix

  • compatibility with pydantic 1.10
  • git bundle support breaks with relative paths
  • prevent name collision for question var name "value"

Refactor

  • add "flake8-simplify" plugin and simplify code

v6.1.0

1 year ago

Feat

  • support getting template commit hash with {{ _copier_conf.vcs_ref_hash }}
  • simplify the format of the question prompt (#689)

Fix

  • ignore non-PEP-440-compliant tags (#676)

v6.0.0

1 year ago

All changes here. Summary:

Added

  • Allow using additional Jinja 2 extensions.
  • Major version mismatch warning. If your Copier version is too new, you'll be warned.
  • Specific exceptions, which will help on error detection for API usages.
  • Multiline questions.
  • Conditional questions.
  • Placeholders.
  • Interactive TUI for questionaries. Prompts are way cooler now. 😎
  • Python 3.9 support.
  • Python 3.10 support.
  • Support empty templates suffix, telling Copier to render every file.
  • Added --defaults flag to use default answers to questions, which might be null if not specified.
  • Added --overwrite flag to overwrite files that already exist, without asking.
  • In migration scripts, we have the new environment variables $VERSION_PEP440_FROM, $VERSION_PEP440_CURRENT and $VERSION_PEP440_TO, which will always get a valid PEP440 version identifier, without the v prefix, allowing your migration scripts to have a valid standard where to base their logic.
  • Raise a CopierAnswersInterrupt instead of a bare KeyboardInterrupt to provide callers with additional context - such as the partially completed AnswersMap.
  • Support for user_defaults, which take precedence over template defaults.
  • Copy dirty changes from a git-tracked template to the project by default, to make testing easier.
  • Advertise clearly which version is being copied or updated in the CLI.
  • Add jinja variable _copier_python to provide python sys.executable.

Changed

  • Fully refactored core.
  • Running copier copy on a preexisting project now recopies the project instead of updating it. That means that it respects old answers, but ignores history diff.
  • We use Jinja 2 defaults now. {{ }} instead of [[ ]] and similar.
  • We keep trailing newlines by default for Jinja 2 templates.
  • Copier will never ask for overwriting the answers file.
  • Multi-typed choices follow the same type-casting logic as any other question, so it's easier to reason about them. However, if you were using this feature, you might be surprised about its side effects if you don't specify the type explicitly. Just add type: yaml to make it behave mostly as before. Or just don't use that, it's complicated anyway (warn added to docs).
  • Changed --force to be the same as --defaults --overwrite.
  • Copied files will reflect permissions on the same files in the template.
  • Copier now uses git clone --filter=blob:none when cloning, to be faster.
  • Removing files from templates will remove them too from the subprojects when they get updated.

Deprecated

  • Deprecated now and make_secret functions. If your template used those, Copier will emit warnings leading you on how to upgrade it.
  • Templates marked with _min_copier_version below 6 will still default to use bracket-based Jinja defaults, but that will disappear soon. If you want your template to work on Copier 5 and 6, make sure to declare _envops explicitly in your copier.yaml.
  • copier.copy() is confusing, now that actually copying and updating are 2 completely different actions (before, you were actually always updating if possible). Its direct equivalent is now copier.run_auto(), and copier.copy() will disappear in the future.

Removed

  • Minimal supported Python version is now 3.7 (dropped Python 3.6 support).
  • Removed the json method on _copier_conf. Where you would previously use _copier_conf.json() in your templates, please now use _copier_conf|to_json instead.
  • --subdirectory flag, which was confusing... and probably useless.
  • Lots of dead code.

Fixed

  • A directory that gets an empty name works as expected: not copied (nor its contents).
  • When comparing versions to update, PEP 440 is always used now. This way, we avoid fake ordering when git commit descriptions happen to be ordered in a non-predictable way.
  • Answers file will only remember answers to questions specified in the questionary.

v6.0.0a7

2 years ago
  • We now have a changelog.
  • You can use python -m copier now.
  • Jinja extensions.
  • Only explicit types in select questions. They must be consistent.
  • Replace force=True with defaults=True, overwrite=True. On CLI, -f is a shortcut now.
  • Support empty templates suffix.

v6.0.0a6

3 years ago
  • Support python 3.6-3.9 on all platforms.
  • Warn major template copier supported version differences.
  • Big refactor.
  • Build with poetry-core.
  • Update docs a lot.
  • Update dependencies to fix many bugs.
  • Some maintenance fixes.

v6.0.0a5

3 years ago

Changes since last alpha:

  • Fix problem with interactive choice questions not displaying properly the old value on updates.

v6.0.0a4

3 years ago

Changes since last alpha:

  • Fix missing pygments dependency.