You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use nested configuration files since we have one repo with a multiple templates for users to create an app whether it's python or go or some other language. Some of the files like our README, our circle pipelines, etc. will be the same templates for all the services, so I was also trying to use inheritance to have a set of shared files at the top of the repo that I can use in both templates, the file structure looks like:
And then I have a file in project-1/cookiecutter.project_slug/README.md that contains:
{% include "README_tpl.md" %}
What I've run:
And when I try to create an app using cookiecutter from the root dir, I get this error:
Traceback (most recent call last):
File "/usr/local/bin/cookiecutter", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/cookiecutter/cli.py", line 203, in main
cookiecutter(
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/cookiecutter/main.py", line 143, in cookiecutter
return cookiecutter(
^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/cookiecutter/main.py", line 182, in cookiecutter
result = generate_files(
^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/cookiecutter/generate.py", line 409, in generate_files
generate_file(
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/cookiecutter/generate.py", line 209, in generate_file
rendered_file = tmpl.render(**context)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "README.md", line 1, in top-level template code
File "/usr/local/Cellar/cookiecutter/2.6.0/libexec/lib/python3.12/site-packages/jinja2/loaders.py", line 204, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: README_tpl.md
Admittedly I haven't looked at the code for cookiecutter (apologies!), so I'm not sure if this is a bug or just something not supported, I suspect the latter. So wanted to confirm that and also ask if this is something you might want to support in the future or if it's something that can't be supported for xyz reason.
Thank you!
The text was updated successfully, but these errors were encountered:
A possible solution could be adding support to pass in the location of the inheritance folder as a optional argument to the cookiecutter() call. Or some symlink setup with your multiple template directories to get it working with the current version.
Description:
I'm trying to use nested configuration files since we have one repo with a multiple templates for users to create an app whether it's python or go or some other language. Some of the files like our README, our circle pipelines, etc. will be the same templates for all the services, so I was also trying to use inheritance to have a set of shared files at the top of the repo that I can use in both templates, the file structure looks like:
main-directory/
├── project-1
│ ├── cookiecutter.json
│ ├── {{cookiecutter.project_slug}}
| │ ├── ...
├── package
│ ├── cookiecutter.json
│ ├── {{cookiecutter.project_slug}}
| │ ├── ...
├── cookiecutter.json
├── templates/
└── README_tpl.md
And then I have a file in project-1/cookiecutter.project_slug/README.md that contains:
What I've run:
And when I try to create an app using cookiecutter from the root dir, I get this error:
Admittedly I haven't looked at the code for cookiecutter (apologies!), so I'm not sure if this is a bug or just something not supported, I suspect the latter. So wanted to confirm that and also ask if this is something you might want to support in the future or if it's something that can't be supported for xyz reason.
Thank you!
The text was updated successfully, but these errors were encountered: