paint-brush
Repl for jinja2by@garciaj.uk
670 reads
670 reads

Repl for jinja2

by Short Tech StoriesOctober 7th, 2016
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

As i work with <strong>Ansible</strong> (or I try to learn <strong>Ansible</strong>) sometimes i want to test little <strong>j2</strong> snippets (Used in templates/when conditions / others within <strong>Ansible</strong>). You can <strong>ipython</strong> (or your fav repl ) and do it <strong>manually</strong> or you can use (and contribute) to this little tool i built yesterday.

Company Mentioned

Mention Thumbnail
featured image - Repl for jinja2
Short Tech Stories HackerNoon profile picture

As i work with Ansible (or I try to learn Ansible) sometimes i want to test little j2 snippets (Used in templates/when conditions / others within Ansible). You can ipython (or your fav repl ) and do it manually or you can use (and contribute) to this little tool i built yesterday.

I’ve called jinrepl (lack of a better name) , and it basically evals strings into j2.template and renders it , nothing major, but with a few neat features.

Featuring:

https://github.com/bechampion/jinrepl

To install:





pip install termcolorpip install jinja2git clone https://github.com/bechampion/jinreplcd jinreplpython jinrepl.py

That’s pretty much everything you need so far (with the current set of features)

Features

  • In line jinja rendering

  • Filter autocompletion

  • Conditional and statements autocomplete

But my favourite is , embedded Vim! (haha just os.system(“vim”))

It does a fair bit more , but you can find all about it on the github repo.

https://github.com/bechampion/jinrepl