Must the template be its own repo? #2361
Replies: 2 comments
-
|
Copier is designed around the assumption that there is one template per dedicated repository. See the "Can I have multiple templates in a single repo using this option?" admonition for more details. You can move most of the template files in a subdirectory by configuring the If your idea is to colocate a Copier template and a project that uses it, I think you'll be facing some challenges. Copier typically relies on PEP 440 compliant Git tags to determine new template versions for updating. As with all Git monorepos, tags apply to the entire repository, so if your main project also uses tags, how do you manage tag associations? #2119 suggests to add support for filtering Copier-related tags using a prefix, which is based on a common pattern for monorepos to solve the tag association problem. This hasn't been implemented yet. You can also use Copier without tags but commit SHAs instead. For a monorepo scenario where a template and project are colocated, you might want to edit the template and update the project in a single commit to keep the project up-to-date with the template. But Copier currently cannot perform an update on a dirty repository, even when the subdirectory is not dirty (#2362). Also, the Git ref of the new template version cannot be determined for a monorepo with a dirty state because it isn't known at this point. I'm not sure if there's (currently) a good way to achieve what you're trying to do. |
Beta Was this translation helpful? Give feedback.
-
Hmm I had tried that and it still didn't work for some reason. Even if I had a test local & remote tag on the repo (10.0.0).
I've tried something similar, with Anyway my playing time is over unfortunately so I can't dig into it more atm. In the future if I circle back to this I would be very keen to see smoother support for templates as subdirectory rather than repo root, or at least clearer documentation for it if possible. 🙏 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks! 👋 I just started looking into
copierthis week. I was really intrigued by theupdatefunctionality, however I was not able to get it to work. My understanding is that in order to be able to call update, the.copier-answers.ymlshould contain the_commithash, is that correct?Does the template have to to be its own isolated gh repo? I'd like to define it in a nested folder in my existing repo, but haven't been able to make it work such that
.copier-answers.ymlthen stores the_commit, no matter whichgit://prefixes I try.Here's my POC branch in case it's useful.
Beta Was this translation helpful? Give feedback.
All reactions