Monorepo support?
Actual Situation
It seems that copier does not allow to work with projects that each have their own template, but are parts of a monorepo with its own "single" .git.
Desired Situation
Am I wrong? If this is not the case, it might be good to have this type of configuration supported regarding the so useful copier update feature.
Proposed solution
The analysed .git should be that of the monorepo, not that of one of the projects.
IIUC, you'd like to colocate a Copier template and a project generated from that template in the same Git repository. Is this correct? If so, Copier supports a local template path. For example:
copier copy ./template ./project
If your project uses Git tags to mark releases, then this might interfere with Copier's template update detection which relies on Git tags that follow PEP 440 to determine the latest template release. If you need to update to the latest commit, you can pass --vcs-ref HEAD (and similarly any valid Git revision). The appropriate flags and values depend a bit on your specific use case. Could you sketch it in more detail?
The structure of my monorepo is as follows (simplified version).
.git
aboutmeta
multimd
src2prod
The projects aboutmeta, multimd, and src2prod use the same template named cb-py-dev. I have no problem creating them, but updating via copier update does not work because .git is above the project folders, and not inside each project folder.
Is your copier.yml file inside cb-py-dev? If so, it currently needs to be in the repo root. You can still keep your template content in the cb-py-dev directory by setting _subdirectory: cb-py-dev in copier.yml. Would this help?
This is a first step giving a friendly error message "Cannot update because cannot obtain old template references from .copier-answers.yml.". I think that it just remains to git tagthe template.
On the other, I can use copier copy -a .copier-answers.yml ./copier-templates/cb-py-dev ./coding/bc-tools/for-dev/my-project
For your information, here are the two monorepos used, with, for the moment, just the aboutmeta project created via a copy template.
- https://github.com/bc-tools/for-dev/tree/aboutmeta
- https://github.com/projetmbc/copier-templates