Skip to content

Instantly share code, notes, and snippets.

@twolfson
Last active November 11, 2025 16:47
Show Gist options
  • Select an option

  • Save twolfson/b861c182107cefcef086266c3b4b83a6 to your computer and use it in GitHub Desktop.

Select an option

Save twolfson/b861c182107cefcef086266c3b4b83a6 to your computer and use it in GitHub Desktop.
Evaluation and comparison of various Python templating libraries

gist-python-templating-evaluation

An evaluation and comparison of various Python templating libraries

Last updated: October 2023

Criteria

  • Escapes variables for HTML, with escape hatch for no escaping
  • Inheritance system(s) (ideally both include style as well as extension style)
  • Syntax highlighting well supported in IDEs
  • Nice to have: Has escape tools for JS and JSON
  • Nice to have: Linter and formatter support
  • Preferred: Raises an error when a variable is not defined
  • Preferred: Escape hatch to Python, since sometimes we to map variables, and bespoke DSLs are frustrating/limited
  • Bonus: Can express multiple tags in 1 line (a la Jade/Pug)
    • strong > a
  • Bonus: Can express ids and classes easily (a la Jade/Pug, HAML, Slim)

Comparison

Running eval notes

2023-10-16

Fwiw, in my experience the "this templating language ported to your language" almost never lasts as a supported library =/

(unless it's something intentionally universal like Mustache)

So usually a pretty bad idea to build on top of ._.

Why is this document in reStructuredText?

RST is required for multiline behavior in tables. Markdown doesn't support this =(

@blubberdiblub
Copy link

I suggest reconsidering EmPy. After 4 years it was now updated and released a new version 4.0, which makes it maintained.

@AlfredPros
Copy link

Will you update us on this soon?

@DrSensor
Copy link

try minijinja 😉

@twolfson
Copy link
Author

I have no intentions to maintain this regularly. It's too much of a moving target, and a lot of work each time for a small payout.

@trash-80
Copy link

Appears wheezy.template has moved to https://github.com/akornatskyy/wheezy.template with recent-ish release and activity

@trash-80
Copy link

minijinja

Rust isn't quite Python :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment