Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A Jinja2 extension that adds python version to templates.

Project description

https://badge.fury.io/py/jinja2-python-version.svg https://travis-ci.org/jmfederico/jinja2-python-version.svg?branch=master

A Jinja extension that creates a global variable with Python version information for your Jinja2 templates:

Usage

$ pip install jinja2-python-version
from jinja2 import Environment

env = Environment(extensions=['jinja2_python_version.PythonVersionExtension'])

# 3.6
template = env.from_string("{{ python_version }}")

# 3.6
template = env.from_string("{{ python_version.minor }}")

# 3
template = env.from_string("{{ python_version.major }}")

# 3.6.4
template = env.from_string("{{ python_version.micro }}")

template.render()

Project details


Download files

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

Files for jinja2-python-version, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size jinja2_python_version-1.1.2-py2.py3-none-any.whl (3.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size jinja2-python-version-1.1.2.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page