{"id":9619,"library":"copier-template-extensions","title":"Copier Template Extensions","description":"Copier Template Extensions (copier-template-extensions) is a specialized Jinja2 extension for Copier, enabling the loading of other Jinja2 extensions using file paths relative to the template root, rather than standard Python dotted paths. As of version 0.3.3, it offers improved migration support. The project maintains an active release cadence with periodic updates.","status":"active","version":"0.3.3","language":"en","source_language":"en","source_url":"https://github.com/copier-org/copier-template-extensions","tags":["copier","jinja2","template","extension","templating","code generation"],"install":[{"cmd":"pip install copier-template-extensions","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Copier to function, specifically version 9.2 or newer.","package":"copier","optional":false}],"imports":[{"note":"This is the string identifier used in your `copier.yaml` file to enable the extension within Copier. The `wrong` path refers to the old, plural package name before version 0.3.2.","wrong":"copier_templates_extensions.CopierExtension","symbol":"copier_template_extensions.CopierExtension","correct":"copier_template_extensions.CopierExtension"}],"quickstart":{"code":"# copier.yaml\n_extensions:\n  - \"copier_template_extensions.CopierExtension\"\n  # You can now load other extensions using relative paths:\n  - \"./my_template_utils.py:custom_filter\"\n\n# my_template_utils.py\ndef custom_filter(value):\n    return f\"CUSTOM({value.upper()})\"\n\n# template.txt.jinja\nHello {{ 'world' | custom_filter }}\n","lang":"yaml+python","description":"To enable `copier-template-extensions`, include its module path in the `_extensions` list within your `copier.yaml`. This allows Copier to load other Jinja2 extensions specified by relative file paths within your template, such as `my_template_utils.py` shown here. The example demonstrates a custom filter named `custom_filter`."},"warnings":[{"fix":"Update your `pip install` commands and all references in `copier.yaml` and Python code from `copier_templates_extensions` to `copier_template_extensions`.","message":"The project name changed from `copier-templates-extensions` (plural) to `copier-template-extensions` (singular) in version 0.3.2.","severity":"breaking","affected_versions":">=0.3.2"},{"fix":"Ensure your `copier` installation is updated to version 9.2 or newer (`pip install --upgrade copier`).","message":"Copier Template Extensions now requires `copier>=9.2`.","severity":"breaking","affected_versions":">=0.3.1"},{"fix":"Always include `\"copier_template_extensions.CopierExtension\"` in the `_extensions` list in your `copier.yaml` when you intend to use relative paths for other extensions.","message":"This library enables loading Jinja2 extensions via relative file paths. If you attempt to use a relative path for an extension without first loading `copier_template_extensions.CopierExtension`, Copier will raise a `ModuleNotFoundError` or `TemplateSyntaxError`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Update all references in `copier.yaml` and Python code from `copier_templates_extensions` to `copier_template_extensions` (singular).","cause":"Your `copier.yaml` or Python code still references the old, plural package name (`copier_templates_extensions`) after upgrading to version 0.3.2 or newer.","error":"ModuleNotFoundError: No module named 'copier_templates_extensions'"},{"fix":"Ensure `\"copier_template_extensions.CopierExtension\"` is explicitly listed as the first item in the `_extensions` key in your `copier.yaml`.","cause":"The `copier-template-extensions` library itself was not loaded by Copier, so it cannot resolve relative paths for other extensions specified in `_extensions`.","error":"Failed to load extension './my_extension.py:my_filter': Could not import 'my_filter' from module 'my_extension' (Jinja2Error)"},{"fix":"Upgrade your `copier` installation to version 9.2 or newer: `pip install --upgrade copier`.","cause":"The installed `copier` version is older than 9.2, which is required by `copier-template-extensions` 0.3.1 and newer.","error":"Error in extension configuration for 'copier_template_extensions.CopierExtension': The 'copier' library version is too old. (CopierInternalError)"}]}