copier v6.0.0 Release Notes

Release Date: 2022-05-15 // almost 2 years 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.
    • 0๏ธโƒฃ 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.
    • 0๏ธโƒฃ Support for user_defaults, which take precedence over template defaults.
    • 0๏ธโƒฃ 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.
    • 0๏ธโƒฃ We use Jinja 2 defaults now. {{ }} instead of [[ ]] and similar.
    • 0๏ธโƒฃ 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).
    • 0๏ธโƒฃ 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.