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://app.travis-ci.com/jmfederico/jinja2-python-version.svg?branch=master

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

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.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

jinja2_python_version-1.2.0-py2.py3-none-any.whl (3.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jinja2_python_version-1.2.0.tar.gz.

File metadata

  • Download URL: jinja2_python_version-1.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.2.0

File hashes

Hashes for jinja2_python_version-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b2cd7da29f32763e61dfe853185e011e8b4fd6dcd1b4fa8d74f7657722c6a28e
MD5 5b488140121dab9c1ea6a2923fb783ae
BLAKE2b-256 ebcf3829ef29d5d3a8bf86c93be871706f394927243b621b50ef68fa638aa732

See more details on using hashes here.

File details

Details for the file jinja2_python_version-1.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for jinja2_python_version-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4c9e251c7d42c8220d512f1f575373a8e521e97f7c8409e1f7a33af07a33f478
MD5 fbd6a727cd8ed5e3da393e883315ef3c
BLAKE2b-256 6be7fe284c3e3de2001ef52dd1e2ead2d89c2506c0f4d4b198c3a8bbe61df7ba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page