-
How to to use custom extensions in template directory without changing pythonpath? In my template (https://github.com/dadyarri/lab-work-template) i have extensions folder in there one python file with jinja extension, which used in one of the generated files. cookiecutter.json have correct link to this extension: but when i try to run cookiecutter with this substitution File ".\tests\test_{{cookiecutter.file_name}}.py", line 3, in template
jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'cookiecutter'.
File ".\tests\test_{{cookiecutter.file_name}}.py", line 3
class Test{% cookiecutter.file_name|to_camel %}: this with this substitution File ".\tests\test_{{cookiecutter.file_name}}.py", line 3, in template
jinja2.exceptions.TemplateAssertionError: No filter named 'to_camel'.
File ".\tests\test_{{cookiecutter.file_name}}.py", line 3
class Test{{ cookiecutter.file_name|to_camel }}: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @dadyarri 👋 , Cookiecutter needs to import the extension module; if the module is not in your python path, it will raise an So the options, IMHO, are:
We hope to include this feature shortly. Thanks 🙏 |
Beta Was this translation helpful? Give feedback.
Hey @dadyarri 👋 ,
Cookiecutter needs to import the extension module; if the module is not in your python path, it will raise an
ImportError
under the hood.So the options, IMHO, are:
"_extensions": ["lab_work_template.extensions.to_camel.ToCamelCaseExtension"]
We hope to include this feature shortly.
Thanks 🙏