Skip to main content

Rendering mustache templates in Python fast.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mystace-0.1.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mystace-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file mystace-0.1.1.tar.gz.

File metadata

  • Download URL: mystace-0.1.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.0 Linux/6.11.0-1018-azure

File hashes

Hashes for mystace-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4f566dab6eb382f8463076b48a8314e14d061d38cf9b419afcb9936d8a6a419
MD5 6832dcb35a91ad8cf89ad8347f893e09
BLAKE2b-256 cd2776928a86be736217e6942d0708035f3726139c95e3e00399e24af0fb0e8d

See more details on using hashes here.

File details

Details for the file mystace-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mystace-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.0 Linux/6.11.0-1018-azure

File hashes

Hashes for mystace-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0321ced6b60a33be111cc5f82e30ae334333967f18cb3dd81d11617f518a1b54
MD5 72eaacbbf5d3a55a47fb8be6c1ad04a8
BLAKE2b-256 bd5193e08fb0e01b7e97028ce7d2e0df1ead952ad6da45c54da58deffb26e1ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page