Jinja2 extension to handle git-specific things
Project description
Jinja2 extension to handle git-specific things
Installation
$ pip install jinja2-git
Reasoning
This plugin is used to render commit hash in jinja2
templates. We are
using it to render our template version in cookiecutter
:
Usage
Add it as an extension for jinja2 or cookiecutter.
And then inside a template:
from jinja2 import Environment
env = Environment(extensions=['jinja2_git.GitExtension'])
template = env.from_string('Commit is: {% gitcommit %}')
# => Commit is: c644682f4899d7e98147ce3a61a11bb13c52b3a0
Or short version:
from jinja2 import Environment
env = Environment(extensions=['jinja2_git.GitExtension'])
template = env.from_string('Commit is: {% gitcommit short=True %}')
# => Commit is: c644682
License
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_git-1.4.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for jinja2_git-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 149163fabe1dbf98cdb0adb0fea0f33d98bc4323432ab346082966479422e8b5 |
|
MD5 | b4cb304e1341e289303bd50a16e2ad70 |
|
BLAKE2b-256 | 803d6ea7c9a41e9f3d88c5e0675ca35456abf23b34e2ea6f1650731ad7a73d09 |