Saravanan666/pypi-org huggingface dataset:
Package: jinja2-vault
Jinja2 library for loading Vault scretsThe idea behind this project is to allow dynamically loadingvaultsecrets in applications likecookiecutter.InstallationTo install just runpip install jinja2-vaultUsageAdd the jinja2secretfunction like this:password={% secret "password", path="database", mount="app1/secret" %}As simple python code to test is:fromjinja2importEnvironment,Templateenv=Environment(extensions=['jinja2-vault.VaultExtension'])template=env.from_string('password={% secret "password", path="database", mount="app1/secret" %}')result=template.render()print(result)Both examples load keypasswordfromapp1/secret/databasewhereapp1/secretis the mount anddatabasethe path.Setup for cookiecutterAdd the module to the cookiecutter.json.Example:{"some_var":"var","_extensions":["jinja2-vault.VaultExtension"]}The further usage the same as desribed inUsage.Todo[ ] Add some unit testsBuildTo build and push the package:python setup.py sdistpython -m twine upload dist/*
Package: jinja2-webpack
Integration of webpack with jinja2Free software: BSD licenseDescriptionPlugin for jinja2 which enables you to reference assets generated by webpack in your Jinja2 templates, as well as an optional scan feature which allows you to push references to assets from your Jinja2 templates back into webpack for it to build them.Installationpip install jinja2-webpackDocumentationhttps://jinja2-webpack.readthedocs.io/DevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.2.0 (2019-07-19)Fix issue with using a root path of ‘/’ and ‘’0.1.4 (2017-06-03)Separate jinja2_webpack.pyramid into pyramid_jinja2_webpack0.1.0 (2017-05-28)First release on PyPI.
Package: jinja2-workarounds
# 🦸‍♂️ Not the solution `jinja2` deserves, but the workaround it needs right now.`jinja2_workarounds` offers an extension for jinja2 that works around a long standing issue[^1]where `include` does not preserve correct indentation for multi-line includes. Simply add the`jinja2_workarounds.MultiLineInclude` [extension to your environment](https://jinja.palletsprojects.com/en/3.0.x/extensions/) and use the `indent content` directive tocorrectly indent your multi-line includes.## Installation```pip install jinja2_workarounds```## Usage example```jinja2# text.j2thisissometext``````jinja2# example.j2example:{% include 'text.j2' indent content %}```is then rendered as```example:thisissometext```compared to `jinja2`'s default `include` which would result in```example:thisissometext```## Advanced features`MultiLineInclude` is compatible with custom `block_start_string` and `block_end_string`. It also works withthe advanced features of `jinja2'`s `include` statement. The following variants are all supported and work asexpected```jinja2{% include 'missing.j2' ignore missing indent content %}  # handle missing templates{% include ['foo.j2', 'bar.j2'] indent content %}  # multiple alternative templates{% include 'child.j2' without context %}  # include child with/without content{%- include 'child.j2' +%}  # include with custom whitespace control```[^1]: https://github.com/pallets/jinja/issues/178
Package: jinja2xlsx
jinja2xlsxCreate xlsx-tables from html-tablesExampleGiven html table strWhen render html to xlsxThen result xlsx has table valuesfromjinja2xlsximportrender_xlsxfromopenpyxlimportWorkbookhtml_str="""<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Simple table</title></head><body><table><tbody><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></tbody></table></body></html>"""workbook:Workbook=render_xlsx(html_str)asserttuple(workbook.active.values)==((1,2),(3,4))Installationpip install jinja2xlsxFor images support:pip install jinja2xlsx[pil]DevelopmentInstall dependencies:poetry installFor images support:poetry install -E pilRun tests and linting:pre-commit run -aInstall pre-commit hooks:pre-commit installExtraPublish to PyPIpoetrypublish--build
Package: jinja2yaml
jinja2loaderYamlLoader is a template loader for jinja2 template framework.
It loads templates from yaml-files. Useful when you need to
store many small templates in one file.Installpipinstalljinja2yamlUsage:# templates.yamlhome:welcome:|Welcome, {{username}}!goodbye:|Goodbye, {{username}}!# main.pyfromjinja2importEnvironmentfromjinja2yamlimportYamlLoaderjinja=Environment(loader=YamlLoader('templates.yaml'))username='John Doe'template1=jinja.get_template('home/welcome')rendered1=template1.render(username=username)print(rendered1)# Welcome, John Doe!template2=jinja.get_template('home/goodbye')rendered2=template2.render(username=username)print(rendered2)# Goodbye, John Doe!
Package: jinja-ab
This is an A/B testing extension for Jinja. It allows you to encode
experiments in your templates and renders the experiment selected by
theAB_EXPERIMENTenvironment variable. ‘control’ is the default
experiment name ifAB_EXPERIMENTis not specified!To install:pip install jinja-abEnable the extension in your code like this:import os
import jinja_ab

env = Environment(
        loader=FilesystemLoader(),
        extensions=[jinja_ab.JinjaAbExperimentExtension],
    )

os.environ['AB_EXPERIMENT'] = 'v1'
template = env.get_template('index.html')
return template.render(context)The template syntax is:{% experiment control %}This is the control{% endexperiment %}
{% experiment v1 %}This is version 1{% endexperiment %}Alternative syntax is also supported:{% ab control %}This is the control{% endab %}
{% ab v1 %}This is version 1{% endab %}You can also mix the two tags in a single template:{% experiment control %}This is the control{% endexperiment %}
{% ab v1 %}This is version 1{% endab %}Single and double quoted names are also supported!NOTE:this extension deals with rendering the template string based
on the value ofAB_EXPERIMENT. It is up to you or your Jinja2 based tools
to decide what to do with the result. AtMr. Senkowe use this extension as part of thepelican-abplugin.ContributingSource code and issue tracker are athttps://github.com/MrSenko/jinja-abCommercial supportMr. Senkoprovides commercial support for open source
libraries, should you need it!
Package: jinjaapidoc
Sphinx API Doc with Jinja2 templatesDocumentationThe full documentation is athttp://jinjaapidoc.rtfd.org.Featuresjinjaapidoc is a tool for automatic generation of Sphinx sources that, using thejinja2template rendering engine, document a whole package in the style of other automatic API documentation tools. It is based of the builtinsphinx apidocHistory0.1.1 (2015-02-02)First release on PyPI.0.2.0 (2015-02-03)Add autosummary template0.2.1 (2015-03-11)Support Sphinx 1.3Fix recursion0.3.0 (2015-05-23)Ignore classes and functions that got imported from other modules0.4.0 (2016-07-09)Addjinjaapi_include_from_alloption to include members of a module or package
that are listed in__all__(#9).
Thanks to@awhetter.0.5.0 (2019-04-14)Fix compatibility with Sphinx >= 1.8.Remove Python 2 tests.
Package: jinja_app_loader
Jinja 2 loader for resource-based apps.You can setup it like:jinja_app.loader.Loader(root_dir='my_templates',app_subdir='app_temlates',)And it will look for templatemyapp/template.htmlin the next order:my_templates/myapp/template.htmlpath ofmyappmodule +app_templates/template.htmlAvailable params:root_dir- first source of templates, you can use it to rewrite
apps-defined templates, default:templatesapp_subdir- templates folder inside apps (python modules or
packages), default:templateslstrip- remove left whitespaces for each template string,
default:False
Package: jinja-cli
jinja-clia command line interface tojinja;this program renders a jinja template using input data; data may be read from a
file, environment variables, or command line arguments; either template or data
file may be read from stdin; output file may be written to stdout;supported data formats: ini, json, xml, yaml;installpip install jinja-cliusageto render a jinja template with data in json format:# jinja -d {data} {template}to use a different data format:# jinja -d {data} -f {data_format} {template}to read template from stdin:# jinja -d {data} < {template}to read data from stdin:# jinja -d - {template} < {data}to read data from command line arguments:# jinja -D {key} {value} [ -D {key} {value} ... ] {template}to read data from environment variables:# jinja -E {key} [ -E {key} ... ] {template}to read data from environment variables using regex:# jinja -X {regex} {template}to output to a file:# jinja -d {data} -o {output} {template}exampletemplate fileexample.j2:sheep eat {{ sheep.eat }};data fileexample.json:{
    "sheep": {
        "eat": "grass"
    }
}any of these commands:# jinja -d example.json example.j2
# jinja -d example.json < example.j2
# jinja -d - -f json example.j2 < example.jsonoutput:sheep eat grass;data prioritydata priority from low to high:environment variables:-E, --env,-X, --env-regex;data file:-d, --data;command line arguments:-D, --define;undefined variablesoption-u, --undefinedsets howundefined variablesare handled:'': an undefined variable can be printed and iterated over; this is the
default;'chainable': an undefined variable is chainable;'debug': an undefined variable returns debug info when printed;'strict': an undefined variable barks on print, iteration, boolean tests
and comparisons;licenseCopyright (C) 2018-2021 Cyker WayThis program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program.  If not, seehttps://www.gnu.org/licenses/.
Package: jinja-compose-wrapper
Jinja Composejinja-composeis a tool for running docker-compose commands with Jinja2 templating.Installationpipinstalljinja-compose-wrapperThen ensure your Python bin directory is in your PATH.UsageJinja Compose operates using the same syntax as docker-compose, but with the addition of a template and optional injection file.
The typical project setup looks like this:/project_dir
├── compose.jyml
├── compose.py
└── compose.yaml  [generated by jinja-compose]Wherecompose.jymlis a Jinja2 template file,compose.pyis an optional Python file containing variables to be injected into the template, andcompose.yamlis the generated docker-compose file.ExampleIncompose.jymlwe define a service calledserver, which only runs in production when theis_productionvariable is defined and only forwards ports on a certain host.services:server:build:context:.image:sid220/apriltag_localisation:latestenvironment:-DAPRILTAG_PRODUCTION={{ MyJinjaComposeInjection.is_production }}-OPENCV_VIDEOIO_DEBUG=1{%if MyJinjaComposeInjection.my_static_method() == 'special_host' %}ports:-"5000:5000"{%endif %}To define theis_productionvariable andmy_static_methodmethod, we create acompose.pyfile with a class that inherits fromJinjaComposeInject.fromjinja_compose_wrapper.libjinja_composeimportJinjaComposeInjectimportsocketclassMyJinjaComposeInjection(JinjaComposeInject):is_production=1@staticmethoddefmy_static_method():returnsocket.gethostname()Once done we can now bring this service up:jinja_composeupOr just build the yaml file:jinja_compose-dechoFull Usage Documentationjinja_compose [-h] [--template TEMPLATE] [--output OUTPUT] [--injection-file INJECTION_FILE] [--dockercmd [DOCKERCMD]] [--as-root] [action ...]

positional arguments:
  action

options:
  -h, --help            show this help message and exit
  --template TEMPLATE, -i TEMPLATE, -t TEMPLATE
  --output OUTPUT, -o OUTPUT
  --injection-file INJECTION_FILE, -p INJECTION_FILE
  --dockercmd [DOCKERCMD], -d [DOCKERCMD]
  --as-root, -r
Package: jinja-comprehensions
jinja-comprehensionsJinja2 environments providing support for list/dict comprehensions, set literals/comprehensions, generator expressions, and list/dict spreading.Set literals{{{'set','set','literal','literal'}}}{'literal', 'set'}Comprehensionslist:{{[n//2forninrange(10)]}}set:{{{n//2forninrange(10)}}}dict:{{{n:n//2forninrange(10)}}}list: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]
set:  {0, 1, 2, 3, 4}
dict: {0: 0, 1: 0, 2: 1, 3: 1, 4: 2, 5: 2, 6: 3, 7: 3, 8: 4, 9: 4}Generator expressions{{(n//2forninrange(10))|join(', ')}}0, 0, 1, 1, 2, 2, 3, 3, 4, 4List/dict spreading{%setstuff={'b':98,'c':99,'d':100}-%}{{{'a':97,**stuff,'e':101}}}{{[97,*stuff.values(),101]}}{'a': 97, 'b': 98, 'c': 99, 'd': 100, 'e': 101}
[97, 98, 99, 100, 101]Environments are provided for both sync and async contexts, as well as native variants, too.Quickstartpipinstalljinja-comprehensionsAnd use aComprehensionEnvironment(orNativeComprehensionEnvironment) instead of the vanillajinja2.Environmentto compile your templates:# For rendering to stringsfromjinja_comprehensionsimportComprehensionEnvironmentjinja_env=ComprehensionEnvironment()# For rendering to native typesfromjinja_comprehensionsimportNativeComprehensionEnvironmentjinja_env=NativeComprehensionEnvironment()# For rendering to native types with async enabled#  (This env avoids some pitfalls with vanilla Jinja2 native envs and Awaitable return values)fromjinja_comprehensionsimportNoLiteralEvalComprehensionNativeEnvironmentjinja_env=NoLiteralEvalComprehensionNativeEnvironment()
Package: jinjaconfig
jinjaconfigA jinja2 renderer receiving a JSON string from commandline. Useful for generating config files in deployment
environments.InstallationInstall jinja configpip install jinjaconfigInstall from sourcespip install git+https://bitbucket.org/luisfernando/jinjaconfig.gitUsageusage: jinjaconfig [-h] --values [values] [file]

A jinja2 renderer receiving arguments from commandline. Useful for generating
config files in deployment enviroments

positional arguments:
  file               template to parse

optional arguments:
  -h, --help         show this help message and exit
  --values [values]  json encoded valuesBasic UsePass arguments from command linejinjaconfig example.conf --values="{"celery":{"task":"mytask","path":"/home/x/Env/myenv/bin/celery"},
"num_procs":2,"user":"user","workdir":"/home/x/app/app/","logs":{"error":"/home/x/app/logs/err.log",
"log":"/home/x/app/logs/log.log"}}"Pass arguments from a file (*NIX, Bash) and output to filejinjaconfig example.conf --values="`cat arguments.json`" > result.confexample.conf; ==================================
;  configuration example
; ==================================

[program:celery]
; Set full path to celery program if using virtualenv
command={{ celery.path }} worker -A {{ celery.task }}

directory={{ workdir }}
user={{ user }}
numprocs={{ num_procs }}
stdout_logfile={{ logs.log }}
stderr_logfile={{ logs.error }}
autostart=true
autorestart=true
startsecs=10

; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600

; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true

; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998arguments.json{
   "celery" : {
      "task" : "mytask",
      "path" : "/home/x/Env/myenv/bin/celery"
   },
   "num_procs" : 2,
   "user" : "user",
   "workdir" : "/home/x/app/app/",
   "logs" : {
      "error" : "/home/x/app/logs/err.log",
      "log" : "/home/x/app/logs/log.log"
   }
}Authors:Luis Fernando Barrera (luisfernando@informind.com) @joyinsky
Package: jinjacraft
JINJACRAFTJinjaCraft is a simple Python command-line tool which can generate text file based on a Jinja2 template
and a YAML data file.Installationpip install jinjacraftUsageusage: jinjacraft [-h] [-o OUTPUT_FILE] data_file template_file

positional arguments:
  data_file             Yaml data file path
  template_file         Jinja2 template file path

options:
  -h, --help            show this help message and exit
  -o OUTPUT_FILE, --output_file OUTPUT_FILE
                        Output file pathExampleYAML filetitle:Hello Worldtasks:-name:First taskcompleted:True-name:Second taskcompleted:FalseTemplate fileDocument: {{ title }}
Tasks:
{% for task in tasks %}- {{ task.name }} ({% if task.completed %}completed{% else %}not completed{% endif %})
{%  endfor %}Command linejinjacraftdata.yamltemplate.jinja2-ooutputfile.txtOutput file contentDocument: Hello World
Tasks:
- First task (completed)
- Second task (not completed)
Package: jinja-datatables
Jinja-DatatablesA python library to simplify rendering datatables in jinja templatesNote: This tool is in development and doesnt 100% work yet, all of it is untestedTODOWrite test for htmlAdd detail row functionalityMake filters an optionInstallpip install jinja-datatablesUsageSee this repo's tests folder for an exampleCurrently only flask-ajax completed1.) Create a table view objectThere are currently three optionsFrom AjaxIf you want to get all your data asynchronously from a endpoint you can create a datatable oject like thisfrom jinja_datatables.datatable_classes import DatatableColumn, AjaxDatatable
columns = [
    DatatableColumn("data_name", "Column Name", "filter_text"
]
endpoint = "/get_data"
table_view = AjaxDatatable(
    columns,
    None,
    None,
    endpoint,
)From a JS arrayIf you have all your data defined in a JS array you can create a datatable object like this:from jinja_datatables.datatable_classes import DatatableColumn, JSArrayDatatable
columns = [
    DatatableColumn("data_name", "Column Name", "text"),
]
js_array = "dataArray"
table_view = JSArrayDatatable(
    columns,
    None,
    None,
    js_array,
)For your endpoint, make sure it returns just an array of your data, functionality to customize this behavior might be added in futureFrom HTMLThis is completely untestedIf you already have your table in html, then you can easily instantiate a datatable on it like this:from jinja_datatables.datatable_classes import DatatableColumn, HTMLDatatable
columns = [
    DatatableColumn("data_name", "Column Name", "filter_text"),
]
table_view = HTMLDatatable(
    columns,
    None,
    None,
)2.) Instantiate Jinja environmentfrom jinja2 import Environment
from jinja_datatables.jinja_extensions.datatableext import DatatableExt
env = Environment(extensions=[DatatableExt])For flask this will be handled by attaching an extension like this:app = Flask(__name__)  # , instance_relative_config=True)
app.jinja_options["extensions"].append(DatatableExt)3.) Render TemplateIn pythontemplate = env.get_template("datatable_template.html")
template.render(table_view=table_view)In your template file{% datatable table_view %}ContributingI have no idea how contributing works. Make a pull request? Send me a message?I would greatly appreciate help on how to test this
Package: jinja-docker-compose
jinja-docker-composejinja-docker-composeis a simple python script that wrapsdocker-composeto provide Jinja2 based templating ability todocker-compose. It is based on'jinja-compose'.Dependenciesjinja-docker-composerequires following dependencies to be installed on the system:python3python3-pipDocker engineInstallingTo install the script, simply run:$pipinstalljinja-docker-composeThe script is installed in ~/.local/bin. If not in the PATH add the following to your initiation script, like .bashrcPATH=~/.local/bin:$PATHUsingjinja-docker-composeThejinja-docker-composepreprocess thedocker-composefile to act upon for instancefor loopsandconditional statements. The variables used in the preprocessing resides in a dictionnay file in JSON format.jinja-docker-composecan either just do the pre-processing or as well rundocker-composeon the processed file.Example of dictionary file:{"LOGGING":"false","N_GPU":2}docker-composefile to preprocess:version: "3"
services:
  {% for i in range(N_GPU) %}
  ubuntu{{i}}:
    image: ubuntu:latest
  {% endfor %}
  ubuntulog:
    image: ubuntu:latest
    {% if LOGGING == 'true' %}
    logging:
      driver: syslog
      options:
        syslog-address: "tcp://graylog.example.com:516"
    {% endif %}After processing the file looks like this:version: "3"
services:
  ubuntu1:
    image: ubuntu:latest
  ubuntu2:
    image: ubuntu:latest
  ubuntulog:
    image: ubuntu:latestThe default names of the files are:FileDefault nameInput file to preprocessdocker-compose.yml.j2Dictionary filedocker-compose.dicOutput filedocker-compose.ymlThe options are:OptionDescription-fInput file name-DDictionary file name-oOutput file name--loaderUses the FullLoader when loading the YAML, this enables the possible exploit that the FullLoader opens up for.-rApart from genereates the output file, also rundocker-composeAll options that are valid options todocker-composecan also be given tojinja-docker-composeand then passed on todocker-composeDepending on how your system is configured, you may need to run the script withsudo(i.e. if you usually needsudoto rundocker, you will needsudo).
Package: jinja-excel-template
Jinja Excel Template EngineThis package can handle some Excel reporting requirements.It contains:Dynamic sheets based on the dataImages are inside the Excel file,Multiple level of grouping in the data (this library does not handle it, but you can have your own data pipeline to prepare the data.),Printing header setting,Basic chartsThis library willnotbe suitable for you if you are after a completely non-technical maintainable Excel template. In fact, there is none of them, if your Excel template is complicated enough, especially dynamic sheets.This package will suitable for you for the following scenarios:if you have XML knowledge and know how to read openpyxl documents, andif you have Jinja2 knowledgeConceptExcel templating is always complicated and normal Excel file does not support them. We have to use an intermediate file named ExcelXML.Data + Jinja Template ---(Jinja Engine)---> ExcelXML ---(Excel Generator)---> ExcelWith Data and Jinja Template, the Jinja Engine can generate the ExcelXML, then the Excel Generator can generate the Excel file. An ExcelXML is an XML representing a single Excel file.The ExcelXML has a specific format, so the Excel Generator can read it and draw the Excel.Here is an example of the ExcelXML.<Excel><sheetsheetName="myFirstSheet"print_area="A1:L10"print_header="1:3"><row><!-- first row --><cellvalue="A1"/><cellvalue="B1"/><cellvalue="C1"/></row><row/><!-- second row, empty row --><row><!-- third row --><cellvalue="A3"/><cellvalue="B3"/><cellvalue="C3"/></row></sheet><sheetsheetName="mySecondSheet"print_area="A1:L10"print_header="1:3"><row><!-- first row --><cellvalue="A1"/><cellvalue="B1"/><cellvalue="C1"/></row><row/><!-- second row, empty row --><row><!-- third row --><cellvalue="A3"/><cellvalue="B3"/><cellvalue="C3"/></row></sheet></Excel>The Jinja template is to construct the ExcelXML with your own data pipeline.Why did I chose XML not JSON? JSON is too messy to representing meta data and attributes, so I chose XML.SamplePlease check thetests/countries_test.py. It shows the raw data and group countires by region and display countries in multiple sheets. It also contains some basic diagrams.If you are interested in more complicated example, you can refer totests/test.xmlthat is the test XML I am using to test my output and it finally hit 99% code coverage.TODO listFiltering and groupingAuto column width (the current implement is not good enough)Calculated cellAuto number, date and text detectionSpend more time on openpyxl document (yes unfortunately, I haven't got enough time)Pivot table?? (not sure the use case about it, put it in low priority)About meI am from .NET, Java and NodeJS background. This is my first project in Python. When I started this project, I wanted to go to NodeJS, but ExcelJS is not powerful enough comparing to openpyxl. That is why I chose Python. If I am not good at the Python standard, please let me know by emailhkalex@gmail.com. Thanks.