/jinja2-python-version

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

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

🔔 PROJECT STATUS 🔔

Life has taken me to now work in GO, and do not have the time to actively maintain this project.

Which means this project is looking for new maintainer, please open an issue and postulate yourself if interested.

Jinja2 Python Version

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

Compatible with Jinja2 versions 2.x and 3.x.

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()