A template engine light enough to embed in your project.
Project description
A minimalist template engine for Python3
The goal of Stencil is to provide just enough of a template engine in a single file.
Currently weighs in at 550 LoC (414 according to sloccount).
Quick Start
Make a directory for our templates:
$ mkdir tmpl
Create a simple template:
Good morning, {{ name }}!
Write a script to use it
import stencil loader = stencil.TemplateLoader(['tmpl/']) t = loader['index.html'] c = stencil.Context({'name': 'Ruprect'}) print t.render(c) # Should output "Good morning, Ruprect!"
Python support
As of stencil v4, there is a new expression syntax that is not backward compatible.
As of stencil v2.1, only Python 3.6+ is supported. As of stencil v2, only Python 3.4+ is supported.
Stencil 1.2.3 is the last stable Python 2.7 version.
See the documentation to see more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file stencil_template-4.2.3-py3-none-any.whl
.
File metadata
- Download URL: stencil_template-4.2.3-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b3810e11247105ec36ff6ae46f395cf1ae732c8f7259cdc524a9dbf3102fbbd |
|
MD5 | f0411e2a459de01cb88322fb134ee7b5 |
|
BLAKE2b-256 | 4bb2e115b32949a882ad5cd979b3824168a832519add017cb9674b0b15642f76 |