Mako Templates for Python

Mako is a template library written in Python. It provides a
familiar, non-XML syntax which compiles into Python modules for
maximum performance. Mako's syntax and API borrows from the best
ideas of many others, including Django and Jinja2 templates, Cheetah,
Myghty, and Genshi. Conceptually, Mako is an embedded Python
(i.e. Python Server Page) language, which refines the familiar
ideas of componentized layout and inheritance to produce one of
the most straightforward and flexible models available, while
also maintaining close ties to Python calling and scoping
semantics.

Features:

For filesystem management and template caching, add the TemplateLookup class.

Super fast. As templates are ultimately compiled into Python bytecode,
Mako's approach is extremely efficient, and was originally written to be
just as fast as Cheetah. Today, Mako is very close in speed to
Jinja2, which uses a similar approach and for which Mako was an inspiration.

the full inheritance hierarchy is navigable in both directions (i.e. parent and child) from anywhere in the chain.

inheritance is dynamic! Specify a function instead of a filename to calculate inheritance on the fly for every request.

Full-Featured

filters, such as URL escaping, HTML escaping. Markupsafe is used for performant and secure HTML escaping, and new
filters can be constructed as a plain Python callable.

complete caching system, allowing caching to be applied at the page level or individual block/def level. The
caching system includes an open API that communicates with
dogpile.cache
by default. New cache backends can be added with ease via setuptools entrypoints.