Skip to content

eliotwrobson/mystace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mystace - A fast, pure Python {{mustache}} renderer

PyPI version Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. tests lint License: MIT Ruff Checked with mypy

A Python implementation of the {{mustache}} templating language. Still a work in progress, but core rendering features are working (issues are with partials and delimiter swap). A spiritual successor to chevron.

Why mystace?

I'm glad you asked!

mystace is fast

Included microbenchmarks show mystace heavily outperforming all other libraries tested.

mystace is almost spec compliant

Mystace passes nearly all the unit provided by the {{mustache}} spec. To see which tests are currently not passing, see the spec test file.

Project status

Currently a work in progress. The core rendering logic is solid, but still working out bugs with a few test cases. If there is community interest and people will find this useful, I will find time to get the rest of test cases working. As is, I am happy to review pull requests and write test cases.

Usage

Python usage with strings

import mystace

mystace.render('Hello, {{ mustache }}!', {'mustache': 'World'})

Python usage with data structure

import mystace

template_str = 'Hello, {{ mustache }}!'
template_renderer = mystace.MustacheRenderer.from_template(template_str)

template_renderer.render({'mustache': 'World'})

template_renderer.render({'mustache': 'Dave'})

Install

$ pip install mystace

TODO

  • get fully spec compliant
  • get popular
  • have people complain
  • fix those complaints

About

Rendering mustache templates in Python fast

Resources

License

Stars

Watchers

Forks

Packages

No packages published