skillfed

jinja2-simple-tags

Base classes for quick-and-easy template tag development

jinja2-simple-tags v0.6.1 3.1M downloads/30d#2,759 on PyPI39
Permissive license BSD license Active released

What it is and what it does

jinja2-simple-tags is a lightweight library that reduces boilerplate when writing custom Jinja2 template tags. Instead of implementing the full Jinja2 Extension API, you subclass one of three provided tag types—StandaloneTag (for simple output tags), ContainerTag (for tags with opening and closing markers), or InclusionTag (for template inclusion)—and implement a render method. The library handles registration, argument parsing, context access, and output escaping.

It's designed for developers building Jinja2-based applications (web frameworks, static site generators, templating systems) who need to extend templates with custom logic without wrestling with Jinja2's lower-level extension machinery. The package supports Python 3.6 and later, depends only on Jinja2, and has no known security vulnerabilities.

Use it for:

  • Add a custom {% now %} tag to templates that outputs the current date and time in a specified format.
  • Create a {% hmac %} container tag that signs template content with a secret key and returns the digest.
  • Build an {% include_header %} tag that includes a template fragment with injected context variables like logo paths.
  • Implement a {% username %} tag that accesses the current request context to render the logged-in user's name.
  • Define tags that assign their output to template variables using the 'as' keyword for later reuse.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides base classes to create custom Jinja2 template tags (standalone, container, and inclusion types) with minimal boilerplate by implementing a render method.

Yes. The package is actively maintained, has no dependencies beyond Jinja2, carries a permissive license, and solves a real problem for anyone building Jinja2 applications. The API is straightforward and well-documented. Install it if you need to write custom template tags and want to avoid boilerplate.

Install

jinja2-simple-tags on PyPI

pip

pip install jinja2-simple-tags

uv

uv add jinja2-simple-tags

poetry

poetry add jinja2-simple-tags

Installing jinja2-simple-tags

Before you install

Low friction: pure Python wheel with a single runtime dependency (Jinja2 >= 2.10). Maintained actively with recent commits; last release was in 2024.

License in practice

BSD license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install jinja2-simple-tags

from jinja2_simple_tags import StandaloneTag
from datetime import datetime

class NowExtension(StandaloneTag):
    tags = {"now"}
    def render(self, format="%Y-%m-%d %H:%I:%S"):
        return datetime.now().strftime(format)

Verify before relying

  • Whether the package is actively maintained beyond the last 2024 release (last commit is dated 2026-04-13 but days_since_release is 891, creating a timeline gap that needs clarification).

Package facts

License BSD license (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — Jinja2
Maintenance actively maintained — 891 days since the last release
Last repo commit
First released
Downloads 3,090,115/month — #2,759 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jinja2_simple_tags-0.6.1-py2.py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

jinja2 custom tagsjinja2 template extensionscreate jinja2 tagsjinja2 tag frameworktemplate tag libraryjinja2 tag helpers
jinja2-extensiontemplate-tags

More Python Modules packages