Skip to main content

Jinja2 GitHub

Jinja2 Extensions for rendering GitHub project properties.

Available extensions are the following:

  • github_repo_branch_sha: render the last commit SHA associated with a GitHub project branch.

  • github_repo_description: render the description of a GitHub project.

https://circleci.com/gh/jcfr/jinja2-github.svg?style=shield

Installation

jinja2-github is available for download from PyPI via pip:

$ pip install jinja2-github

It will automatically install jinja2 along with pygithub.

Usage

github_repo_branch_sha Tag

The extension comes with a github_repo_branch_sha tag that allows to render the last commit SHA associated with a GitHub project branch.

By default, the master branch is used.

from jinja2 import Environment

env = Environment(extensions=['jinja2_github.GitHubRepoBranchShaExtension'])

# Default branch is master -> "4f5191b50026f7281ca1b1cd180e05fad1d716c6"
template = env.from_string("{% github_repo_branch_sha 'Slicer/Slicer' %}")

template.render()

It is also possible to specified a branch (or tag) name:

from jinja2 import Environment

env = Environment(extensions=['jinja2_github.GitHubRepoBranchShaExtension'])

# With an explicit branch name -> "cfe12ceefd761502181660de76a8cc5d40d5f31c"
template = env.from_string("{% github_repo_branch_sha 'Slicer/Slicer', 'master-48' %}")

template.render()

github_repo_description

The extension comes with a github_repo_description tag that allows to render the description of a GitHub project.

from jinja2 import Environment

env = Environment(extensions=['jinja2_github.GitHubRepoDescriptionExtension'])

# -> "Multi-platform, free open source software for visualization and image computing."
template = env.from_string("{% github_repo_description 'Slicer/Slicer' %}")

template.render()

Issues

If you encounter any problems, please file an issue along with a detailed description.

Maintainer: Making a release

  1. Make sure that all CI tests are passing on CircleCI.

  2. List all tags sorted by version

$ git tag -l | sort -V
  1. Choose the next release version number

$ release=X.Y.Z
  1. Download latest sources

$ cd /tmp && \
  git clone git@github.com:jcfr/jinja2-github && \
  cd jinja2-github
  1. Update __version__ in jinja2_github.py script.

$ sed -i "5s/.*/__version__ = '$release'/" jinja2_github.py
  1. Commit and push the changes

$ git add jinja2_github.py
$ git commit -m "jinja2-github $release"
$ git push origin master
  1. Tag the release

$ git tag --sign -m "jinja2-github ${release}" ${release} origin/master
  1. Publish the release tag

$ git push origin ${release}
  1. Check the status of the builds on CircleCI.

  2. Once the builds are completed, check that the distributions are available on PyPI

Code of Conduct

Everyone interacting in the jinja2-github project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

License

Distributed under the terms of the Apache 2.0 license, jinja2-github is free and open source software

OSI certified

Metadata

Release files for jinja2-github 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jinja2-github 0.1.1
File Size Uploaded Provenance Actions
jinja2_github-0.1.1.tar.gz 8.9 kB Without provenance Details for jinja2_github-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jinja2-github 0.1.1
File Interpreter ABI Platform Actions
jinja2_github-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for jinja2_github-0.1.1-py2.py3-none-any.whl

Total release size: 24.3 kB

Release files / jinja2_github-0.1.1.tar.gz

Download URL jinja2_github-0.1.1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0d6b91265d5e2aff98158cefd76d54b5bfed02c177ed42643ef45fb6fa4d018f
BLAKE2b-256 checksum
How to use checksums
e6ba9012b1a96c56f217b64b9d84509fab3ca7bee46721035b7d090503e715ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release files / jinja2_github-0.1.1-py2.py3-none-any.whl

Download URL jinja2_github-0.1.1-py2.py3-none-any.whl
Size 15.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d30c49490415a1597251ff32cb14a6a1c32193ddb9ee93dbb7a3870c9b4e281d
BLAKE2b-256 checksum
How to use checksums
677f16015a254adfd71fc8deec3a3609ca4f140ca5fa4d6c3c896b0b1a82008c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Security for jinja2-github 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page