Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A library to make Jinja2 Extensions Easy

Project Description

A Library to Quickly Turn Functions into Jinja2 Extensions

This library is best demonstrated through example:

import jinjatag

### Configure your Jinja2 Environment:
jinja_tag = jinjatag.JinjaTag()
jinja2_env = Environment(extensions=[jinja_tag])

### Decorate your functions

def mytag(foo, bar=None, **kwargs):
return "mytag: "+foo+(bar or '')+str(kwargs)

def myblock(body, foo, bar=None):
return "myblock : "+body+foo+(bar or '')


Then, in your template code, use your new tags:

{% mytag foo='abc' xyz='def' %}

{% myblock foo='bar' %}contents{% endmyblock %}

The resulting output:

mytag: abc{'xyz':'def'}

myblock: contentsbar

That's really all there is to it. A simple_tag is expected to accept 0 or more arguments and return a string. A simple_block is expected to accept at least one argument which will be its rendered body.


The module is registered with pypi, so simply use:

easy_install jinjatag

or, if you're so inclined:

pip install jinjatag

Further Documentation

More documentation is available at

Also, tests are available in


GPL v3


Dave Mankoff
Mike Axiak

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(9.6 kB) Copy SHA256 Hash SHA256
Egg 2.7 Mar 30, 2012
(13.5 kB) Copy SHA256 Hash SHA256
Source None Mar 30, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers