Skip to main content

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

  1. Make a directory for our templates:

    $ mkdir tmpl
  2. Create a simple template:

    Good morning, {{ name }}!
  3. 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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

stencil_template-4.2.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file stencil_template-4.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for stencil_template-4.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b3810e11247105ec36ff6ae46f395cf1ae732c8f7259cdc524a9dbf3102fbbd
MD5 f0411e2a459de01cb88322fb134ee7b5
BLAKE2b-256 4bb2e115b32949a882ad5cd979b3824168a832519add017cb9674b0b15642f76

See more details on using hashes here.

Supported by

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