copier-template-extensions
Special Jinja2 extension for Copier that allows to load extensions using file paths relative to the template root instead of Python dotted paths.
What it is and what it does
Copier Template-Extensions is a Jinja2 extension for Copier that lets you define custom template extensions as Python files stored in your template directory, then reference them by relative file path instead of Python module dotted notation. This is particularly useful for template authors who want to add custom filters, tests, or context manipulation without requiring users to install separate Python packages or manage complex module paths.
The package provides two main features: a TemplateExtensionLoader that resolves file-path-based extension references, and a ContextHook base class that simplifies adding or modifying template context variables during rendering. This is helpful when you want to compute derived values (like converting a project type into a module name) or apply transformations without cluttering template filenames with Jinja macros or inline logic.
Use it for:
- Add custom Jinja filters (like slugify) to a Copier template without publishing them as a separate package.
- Compute derived context variables during template rendering based on user answers (e.g., inferring module names from project type).
- Organize template logic into separate Python modules within the template directory for readability and maintainability.
- Implement template-specific hooks that run during different Copier phases (prompting, rendering, tasks, migrations) to validate or transform context.
- Avoid ugly Jinja macro imports or inline context updates in template filenames by centralizing logic in Python extension classes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extends Copier's Jinja2 templating with a loader that imports custom extensions from file paths relative to your template root, rather than requiring Python dotted module paths.
Yes, if you are authoring Copier templates and want to add custom Jinja logic without publishing separate packages. The low install friction, permissive license, and typed codebase make it safe to adopt. The 395-day maintenance gap is a minor concern for a stable, narrowly-scoped utility, but verify that it aligns with your Copier version before committing to a large template project.
Install
copier-template-extensions on PyPI
pip
pip install copier-template-extensionsuv
uv add copier-template-extensionspoetry
poetry add copier-template-extensionsInstalling copier-template-extensions
Before you install
Low friction: pure Python wheel with a single runtime dependency on copier. Maintenance status is aging—last release was 395 days ago, though the repository remains active and the package is typed.
License in practice
ISC license is permissive and imposes minimal restrictions; safe for commercial and private use without significant compliance burden.
Quickstart
pip install copier-template-extensions
# In copier.yml:
_jinja_extensions:
- copier_template_extensions.TemplateExtensionLoader
- extensions/myext.py:MyExtension
# In extensions/myext.py:
from copier_template_extensions import ContextHook
class MyExtension(ContextHook):
def hook(self, context):
context["new_var"] = "computed_value"
Requires copier to be installed; intended for use within Copier template projects, not standalone.
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode given the 395-day gap since last release.
- Real-world performance impact of loading extensions from file paths versus dotted module paths in large template projects.
Package facts
| License | ISC (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — copier |
| Maintenance | aging — 395 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 184,030/month — #10,050 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: copier_template_extensions-0.3.3-py3-none-any.whl
Keywords: copier, templates, extension
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
copierCopier is a template engine and CLI tool that…
permissive · top 5,000 on PyPI
copier-templates-extensionsProvides a Jinja2 extension for Copier that…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
mkdocs-macros-pluginExtends MkDocs with Jinja2 templating to use…
permissive · top 5,000 on PyPI
sphinx-jinjaA Sphinx extension that lets you embed Jinja2…
permissive · top 5,000 on PyPI
jinja2_pluralizeProvides Jinja2 template filters for…
permissive · top 15,000 on PyPI
jinja_partialsAdds a `render_partial()` function to Jinja2…
permissive · top 5,000 on PyPI
ruamel.yaml.jinja2Enables Jinja2 templating within YAML files by…
permissive · top 5,000 on PyPI
pyramid-jinja2Integrates the Jinja2 templating engine with…
permissive · top 5,000 on PyPI
vsdxvsdx reads, modifies, and creates Microsoft…
permissive · top 15,000 on PyPI