Skip to main content

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.

Source Distribution

jinja2-python-version-1.1.2.tar.gz (2.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page