Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Jinja2

Fast and expressive template engine for Python with powerful flexibility.

Markdown, editors and contentPYPI

GitHub

1. License

License from PyPI classifier.

github.com/pallets/jinja

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Jinja2 does

Jinja is the Pallets project's Python templating engine: templates use near-Python syntax and are compiled to Python code, and the README says a sandboxed environment can safely render untrusted templates.

Jinja2 popularity

79 / 100
Gid Score, #111 overall
164M
downloads a week, pypi
11.8K
GitHub stars
134
agent projects use it
Jinja2: downloads per weekPyPI, jinja2 163,807,733
Jinja2: GitHub starspallets/jinja 11,829

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Jinja2 is used

  • Jinja2 is a dependency in 134 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (8.3% of the 1,623 Python ones), #4 of 149 in markdown, editors and content.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,516; those are left out of every share on this page.
  • The most used alternative in our scan is Mako (13 projects).
  • Projects that use it most often also use Pydantic (66.4%), Uvicorn (59.7%), FastAPI (59.0%).
  • It is more common in projects set up for OpenClaw (4.2%) than for Gemini CLI (1.1%).

By coding agent

74 projects, 2.3%
62 projects, 2.0%
45 projects, 1.8%
14 projects, 4.2%
7 projects, 2.5%
6 projects, 1.3%
5 projects, 1.5%
5 projects, 1.1%

Often used with

In 66.4% of its projects
In 59.7% of its projects
In 59.0% of its projects
In 56.0% of its projects
In 56.0% of its projects
In 52.2% of its projects
In 45.5% of its projects
In 41.8% of its projects

Jinja2 in practice

Strengths

Templates compile to Python code

The README says templates are compiled to optimized Python code. This can happen just-in-time with caching, or ahead-of-time.

A sandbox for templates you did not write

The README says a sandboxed environment "can safely render untrusted templates."

Layouts through extends and blocks

In the README's example, a page uses <code>{% extends "base.html" %}</code> and fills named blocks such as <code>title</code> and <code>content</code>. The README also says you can define macros and import them within templates.

Errors point to the template line

The README says exceptions "point to the correct line in templates to make debugging easier."

Watch out for

Read the escaping FAQ before rendering HTML

The README says HTML templates "can use autoescaping to prevent XSS from untrusted user input." The docs FAQ has an entry titled "Why is HTML escaping not the default?" The answer to that entry is not in the pages reviewed here.

3.1.6 was a sandbox security release

The maintainers describe 3.1.6 as a security release. Its listed change is that the <code>|attr</code> filter "does not bypass the environment's attribute lookup, allowing the sandbox to apply its checks." The notes link a GitHub security advisory and say the release "should not result in breaking changes compared to the latest feature release."

Application logic belongs in Python "if possible"

The README states the philosophy that application logic belongs in Python "if possible." It adds that Jinja "shouldn't make the template designer's job difficult by restricting functionality too much." The docs FAQ also asks "Isn’t it a bad idea to put logic in templates?"

A child template that extends a base layout

{% extends "base.html" %}
{% block title %}Members{% endblock %}
{% block content %}
  <ul>
  {% for user in users %}
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
  {% endfor %}
  </ul>
{% endblock %}

More about Jinja2

Funding
  • GitHub Sponsors: https://github.com/pallets
  • Own page: https://palletsprojects.com/donate
  • Tidelift: https://tidelift.com/funding/github/pypi/Flask
  • thanks.dev: https://thanks.dev/u/gh/pallets
  • 31 GitHub sponsors

See all

Packages around it
  • pydantic: Data validation
  • requests: HTTP client
  • python-dotenv: .env config loading
  • uvicorn: ASGI server
  • fastapi: Web API framework
  • pyyaml: YAML parsing
More in Markdown, editors and content

Alternatives

Jinja2 This page

BSDGid 79164M/wk

Mako

High-performance Python templating engine with flexible syntax for generating HTML, emails and other text.

MITGid 6059.7M/wk

Compare Jinja2 with another tool

Get started

Install it.

pip install jinja2

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Jinja2
- The latest release in the sources is 3.1.6, which the maintainers call a security release.
- Editor's recommendation, not from the docs: prefer a version that includes the 3.1.6 change to the `|attr` filter if you use the sandbox.
- For HTML templates that show untrusted user input, the README says they "can use autoescaping to prevent XSS". Read the docs' Autoescaping section and the FAQ entry "Why is HTML escaping not the default?" before relying on it.
- The README says the sandboxed environment "can safely render untrusted templates". Editor's recommendation: use it for templates written by users, and read the docs' Sandbox "Security Considerations" section.
- Structure pages with `{% extends %}` and `{% block %}`, as in the README example. Macros can be defined in templates and imported.
- Follow the README's philosophy: put application logic in Python "if possible", and pass the results to the template as data.