GithubHelp home page GithubHelp logo

jcfr / jinja2-github Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 51 KB

jinja2 extensions for rendering Github project properties like the last commit SHA of a GitHub project branch

Home Page: https://pypi.org/project/jinja2-github/

License: Apache License 2.0

Python 100.00%
jinja2 jinja2-extension kitware github-api python jinja2-templating-engine jinja2-templates

jinja2-github's Introduction

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.

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 GitHub Actions.
  2. List all tags sorted by version
$ git tag -l | sort -V
  1. Choose the next release version number
$ release=X.Y.Z

Warning

To ensure the packages are uploaded on PyPI, tags must match this regular expression: ^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$.

  1. Download latest sources
$ cd /tmp && \
  git clone [email protected]: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

Note

We recommend using a GPG signing key to sign the tag.

  1. Publish the release tag
$ git push origin ${release}

Important

This will trigger builds on each CI services and automatically upload the wheels and source distribution on PyPI.

  1. Check the status of the builds on GitHub Actions.
  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

jinja2-github's People

Contributors

dependabot[bot] avatar jcfr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.