Skip to content

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

License

Notifications You must be signed in to change notification settings

jmfederico/jinja2-python-version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages