Skip to main content

Rendering mustache templates in Python fast.

Project description

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

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. They are only

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.0.tar.gz (11.5 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.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mystace-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.0 Linux/6.8.0-1017-azure

File hashes

Hashes for mystace-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c840cd05283473610a0c58a3a4918dcf2024bfb728e9990b3d6367077a34431
MD5 3cbe765d55744e43c76709bdb5f00c03
BLAKE2b-256 db2f8f6030fe763164009a309f112b3287e5fdc046b23e6595b50ee878f3a253

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mystace-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.0 Linux/6.8.0-1017-azure

File hashes

Hashes for mystace-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99516849656fd04ba510541b94b43df443a50a3ee5df640ac67d8d101164d18f
MD5 9784714a8584666f3f4cf0b760fbc2d7
BLAKE2b-256 00cf9336990bd3639653e02ee12f988352911e0f5447fce1cca65adff899ee1e

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