This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.6 instead.
Reason given by maintainers: alpha
ustache
Mustache for Python.
Documentation: ustache.readthedocs.io
Usage
import ustache
print(ustache.render('Hello {{v}}', {'v': 'World!'}))
# Hello World!
Command line:
$ ustache -j data.json -o output.html template.mustache
Highlights
- Command line interface.
- Spec compliant, but also highly compatible with
Mustache.js. - Fast and small codebase, efficiently rendering to
strorbytes, supporting streaming. - Customizable (property getter, partial resolver, and stringify, escape and lambda render functions).
Considerations
For inter-compatibility with JavaScript (especially Mustache.js, enabling
client-side rendering with the same templates), ustache exposes some
atypical behavior:
- Mustache blocks stick to JavaScript falseness (
__bool__is not honored):None,False,0,nan, and empty sequences (including strings) are taken as falsy, while everything else (including empty mappings) will be considered truthy (Mustache.jsBooleanand emptyArrayhandling). - Mustache blocks receiving any iterable other than mappings and strings
will result on a loop (
Mustache.jsArrayhandling). - Sequences expose a virtual
lengthproperty (JavaScriptArray.lengthemulation). Customizable viagetterparameter. - Mapping keys containing dot (
.) or whitespace () are unreachable, (Mustache.jsproperty name limitation). Customizable viagetterparameter. - Sequence elements are accessible by positive index in the same way mapping
integer-keyed items are also accessible if no string key conflicts, as
properties (JavaScript
Objectemulation). Customizable viagetterparameter.
Syntax
Check out the mustache(5) manual.
For quick reference, here is a quick overview of the Mustache syntax.
Template (template.mustache):
{{!comment}}
<ul>
{{#object}}<li>{{property}}</li>{{/object}}
{{^object}}<li>As <b>object</b> is truthy, this won't be shown</li>{{/object}}
{{^null}}<li><b>null</b> is falsy</li>{{/null}}
{{#array}}<li>{{property}}</li>
{{/array}}
{{^array}}<li>Array isn't empty, this won't be shown.</li>{{/array}}
{{#empty_array}}<li>Empty Array, this won't be shown</li>{{/empty_array}}
{{^empty_array}}<li>empty_array is empty</li>{{/empty_array}}
{{&unescaped_html}}
</ul>
Data (data.json):
{
"object": {
"property": "Object property value"
},
"null": null,
"array": [
{"property": "Array item1 property"},
{"property": "Array item2 property"},
{"property": "Array item3 property"}
],
"empty_array": [],
"unescaped_html": "<li>this is unescaped html</li>"
}
Command:
$ python -m ustache -j data.json -o template.mustache
Output:
<ul>
<li>Object property value</li>
<li><b>null</b> is falsy</li>
<li>Array item1 property</li>
<li>Array item2 property</li>
<li>Array item3 property</li>
<li>empty_array is empty</li>
<li>this is unescaped html</li>
</ul>
Metadata
Release files for ustache 0.1.2a20210129
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ustache-0.1.2a20210129.tar.gz | 10.2 kB | Without provenance | Details for ustache-0.1.2a20210129.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ustache-0.1.2a20210129-py3-none-any.whl | Python 3 | none | any | Details for ustache-0.1.2a20210129-py3-none-any.whl |
Total release size: 20.6 kB
Release files / ustache-0.1.2a20210129.tar.gz
| Download URL | ustache-0.1.2a20210129.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
505a6923025c0ec912c34b34ba3f58870a3e18b2135074e91cca602290a1cde9
|
|
BLAKE2b-256 checksum How to use checksums |
b33f3b2d61e8a6ed630a47c7d92563643306b6fa94e0816b3cb86270353576af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Release files / ustache-0.1.2a20210129-py3-none-any.whl
| Download URL | ustache-0.1.2a20210129-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
668deb6e29f1960ce24c0837dfa1a3b25913158909d7ae05778fb72c45450337
|
|
BLAKE2b-256 checksum How to use checksums |
2361a7f53d2d272383c9233539f2b36ca2371c62f4fd97460647c673cfd2ffb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Security for ustache 0.1.2a20210129
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.