copier icon indicating copy to clipboard operation
copier copied to clipboard

Better support for copier version requirements in templates

Open stereobutter opened this issue 3 years ago • 1 comments

Inspired by a discussion in https://github.com/copier-org/copier/issues/850 I think it would be nice if copier had better support for specifying the required copier version for a template instead of just min_copier_version. Using utilities from packaging (which copier already depends on) this isn't to hard actually. See https://packaging.pypa.io/en/latest/specifiers.html

I propose to add a copier_version setting to copier both for copier.yml and as command line argument that accepts version specs e.g. ">=6.0.0, <7, !=6.1.3". This can be made fully backwards compatible and would eventually replace min_copier_version after some deprecation period and/or with some of the next major version releases.

stereobutter avatar Oct 27 '22 14:10 stereobutter

FTR in this moment we have this: https://github.com/copier-org/copier/blob/12bd54239cff91140040b8ef592d66aabdc17386/copier/template.py#L145-L151

It warns the user that Copier might be too new for this template, without forbidding its usage.

I'm not against the feature per se, but I'm wondering if the added complexity will be actually useful for real. Did you experience this problem somewhere? 🤔

yajo avatar Oct 27 '22 16:10 yajo