--- id: jinja2-ansible-filters version: "1.3.2" license: GPL3 license_treatment: copyleft maintenance: abandoned --- # jinja2-ansible-filters — A port of Ansible's jinja2 filters without requiring ansible core. License: copyleft · Maintenance: abandoned · Downloads: 2.1M/mo ## What it is and what it does This package extracts and ports Ansible's Jinja2 template filters into a standalone library, so you can use Ansible-style filtering in any Jinja2 template without installing the full Ansible framework. It includes filters for common operations: base64 encoding/decoding, file path manipulation (basename, dirname, realpath), hashing (md5, sha1, checksum), JSON and YAML conversion, regex operations, and utility filters like type checking and UUID generation. A few filters with heavy Ansible dependencies (combine, get_encrypted_password, dict2items, items2dict) are excluded, and two filters (groupby, random) are prefixed with ans_ to avoid collisions with Jinja2 builtins. The package is a thin extension layer that registers these filters as a Jinja2 extension, so you load it by passing AnsibleCoreFiltersExtension to your Environment. It depends only on Jinja2 and PyYAML, making it lightweight to add to projects that already use those libraries. However, the project has been abandoned since 2022-06-30 with no maintenance activity, so compatibility with newer Jinja2 releases is not guaranteed beyond what was tested at version 1.3.2. Use it for: - Use it to port Ansible playbook templates to standalone Jinja2 rendering without Ansible as a runtime dependency. - Use it in cookiecutter templates to access Ansible-style filters for file path and data transformation during project scaffolding. - Use it to add base64, JSON, YAML, and regex filters to Jinja2 environments in configuration management or templating pipelines. - Use it to perform hashing and encoding operations (md5, sha1, b64encode) directly in templates without custom filter registration. - Use it in static site generators or documentation tools that use Jinja2 and need Ansible-compatible filter semantics. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a collection of Jinja2 template filters ported from Ansible, including encoding, hashing, path manipulation, JSON/YAML conversion, and regex operations, without requiring Ansible core. Yes, if you need Ansible-style Jinja2 filters and can accept the GPL3 copyleft license. The package is lightweight, has low install friction, and works well for template-heavy projects. However, do not install if your project is proprietary or closed-source (GPL3 is a blocker), or if you require active maintenance and compatibility updates—the project is abandoned and has not been updated since 2022-06-30. Test compatibility with your current Jinja2 version before relying on it in production. ## Install pip install jinja2-ansible-filters uv add jinja2-ansible-filters poetry add jinja2-ansible-filters ## Installing jinja2-ansible-filters Before you install: Installation is straightforward with low friction; the package has only two runtime dependencies (Jinja2 and PyYAML). However, the project is marked as abandoned with no releases since 2022-06-30, which means bug fixes and compatibility updates are unlikely. License in practice: The package is released under GPL3 (copyleft), which means any code that incorporates or distributes this package must also be released under compatible open-source terms. This is a significant constraint for proprietary or closed-source projects. Quickstart: from jinja2 import Environment from jinja2_ansible_filters import AnsibleCoreFiltersExtension env = Environment(extensions=[AnsibleCoreFiltersExtension]) template = env.from_string('{{ "hello" | b64encode }}') result = template.render() Requires Jinja2 and PyYAML to be installed; compatibility with Jinja2 versions 3.1+ requires the environmentfilter-to-pass_environment rename, which is included in version 1.3.1+. Verify before relying: - Whether the package remains compatible with current Jinja2 and PyYAML versions beyond what version 1.3.2 tested. - Whether the GPL3 license applies to the entire codebase or only portions derived from Ansible (the description mentions both GPL3 and BSD). - Performance characteristics or memory overhead when using the full filter set in high-volume templating scenarios. - Total number of filters provided by the package across all categories. ## Package facts - License: GPL3 (copyleft) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags jinja2 ansible filters, template filters for jinja2, ansible-style jinja2 extensions, jinja2 yaml json filters, jinja2 encoding hashing filters, jinja2 path manipulation, jinja2 regex filters, jinja2-extension, template-filters, ansible-compatible [View on SkillFed](https://skillfed.io/packages/jinja2-ansible-filters) · [View on PyPI](https://pypi.org/project/jinja2-ansible-filters/)