jinja2-ansible-filters
A port of Ansible's jinja2 filters without requiring ansible core.
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 on this page — 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
jinja2-ansible-filters on PyPI
pip
pip install jinja2-ansible-filtersuv
uv add jinja2-ansible-filterspoetry
poetry add jinja2-ansible-filtersInstalling 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 | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — Jinja2, PyYAML |
| Maintenance | abandoned — 1,506 days since the last release |
| First released | |
| Downloads | 2,061,330/month — #3,330 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jinja2_ansible_filters-1.3.2-py3-none-any.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
jinja2-strcaseAdds string-case conversion filters to Jinja2…
permissive · top 15,000 on PyPI
jinja2-cliA command-line interface for Jinja2 templating…
permissive · top 5,000 on PyPI
jinjanatorA command-line tool that renders Jinja2…
permissive · top 5,000 on PyPI
jinja2-humanize-extensionAdds humanize library filters to Jinja2…
permissive · top 5,000 on PyPI
jinja2_pluralizeProvides Jinja2 template filters for…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
j2clij2cli is a command-line tool that renders…
permissive · top 5,000 on PyPI
ruamel.yaml.jinja2Enables Jinja2 templating within YAML files by…
permissive · top 5,000 on PyPI
jinja-cliA command-line tool that renders Jinja2…
copyleft · top 15,000 on PyPI
jinjanator-pluginsProvides the plugin API and hook decorators…
permissive · top 5,000 on PyPI