Skip to content

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

0.2.1 - 2026-10-21

Changed

  • tplx ends with status 130 and no traceback on Ctrl-C, and a closed standard output (a reader that went away, such as | head) ends with status 1 and no output, on Windows too. The cli extra requires duho>=0.7.8,<0.8.
  • find and engines take --format text|json as well as --json. The JSON is now indented by two spaces and keeps non-ASCII characters (it was one line with \uXXXX escapes); its keys and values and the text output are unchanged.

0.2.0 - 2026-10-18

Added

  • Template.is_template(text): does a text hold the engine's syntax, without compiling it; every built-in engine finds only its own.
  • DollarTemplate: the shell syntax with $ (${HOST:-localhost}), registered for no suffix.
  • SandboxLimits(timeout=..., max_memory=...): hard bounds on a sandboxed render. Setting either runs the loader's sandboxed renders and evals in a worker process the system holds to them (an address-space limit on Linux, a job object on Windows, a watch on macOS); going over raises SandboxError and replaces the worker. The data crosses by pickle.

Changed

  • tplx.eval, Loader.eval and Lookup.eval take a template where evaluate took a bare expression, and the engine decides how to resolve it (Template.eval): "{{ port + 1 }}" is 81, "Test {{ port }}" is "Test 80", and text with no syntax comes back as it is, compiled never.
  • tplx.DEFAULT_ENGINE is DollarTemplate, which runs in a sandbox; it was Python's eval, which ran code and no template.

Removed

  • tplx.evaluate, Loader.evaluate and Lookup.evaluate: use eval with a template ("{{ a.b * 2 }}" for "a.b * 2").
  • The "python" engine and tplx.PYTHON.
  • An engine's Template.evaluate(expression): Template.eval(text) takes the whole text, and a plugin engine that gave typed values overrides _evaluate_expression.

Fixed

  • eval and render copied every name of the data before the engine looked at the text, so plain text cost the size of the data. The data is passed through, and plain text never reads it.
  • A render converted every top-level name before the template ran (Jinja and Liquid copied them, a sandbox wrapped them, the shell engine flattened them all), so a template reading one name cost the size of the data. Jinja, Liquid, Go, Mustache and Handlebars now convert a name when the template reads it, and the shell and envsubst engines flatten only the top-level names their template could read.
  • A sandboxed template or expression could make the process allocate without bound ("x" * 10**10, [0] * 50000000, "x".center(n), a format width, Go's printf width): SandboxLimits.max_output now bounds every value a sandboxed template builds, refused before it is allocated, and every value eval returns.
  • A function written in Python (a def) given in the data or globals reached a sandboxed template, and Liquid, Handlebars and Mustache, as a read-only view of its attributes, so calling it failed; it now stays callable, as documented.
  • ShellTemplate.references() (and envsubst's) raised IndexError for an engine with only the bare %NAME form, read GNU envsubst's $$A as an escape it does not have, and missed the name in ${#NAME}; it now scans as the render does.
  • A TemplateNotFound that was pickled came back with its message wrapped in a second one.

0.1.5 - 2026-10-15

Added

  • SandboxLimits(max_output, max_iterations, max_depth): what one sandboxed render may cost, Loader(sandbox=SandboxLimits(...)); sandbox=True uses the defaults (1,000,000 characters, 100,000 iterations, depth 100). Going over raises SandboxError.

Fixed

  • Presenting data to Liquid, Mustache, Handlebars and any sandboxed engine converted a list every time it was reached: a shared list (YAML aliases) cost time exponential in its nesting, and a list containing itself exceeded the recursion limit. Each distinct list is now converted once.

Changed

  • In a sandbox only a function the caller passes stays callable; a class or a callable object reaches the template as data it cannot call.
  • The jinja, liquid and mako extras require jinja2 3.1.6, python-liquid 2.2.1 and mako 1.3.12: every earlier release has a published security advisory (two Jinja sandbox escapes among them).

0.1.4 - 2026-10-15

Added

  • Loader(sandbox=True) for untrusted templates: only engines with SANDBOXED = True take part (Jinja through SandboxedEnvironment, Liquid, Mustache, Handlebars, Go through a gotpl SandboxPolicy, shell, envsubst, copy); a file another engine claims raises SandboxError before it is read. A sandboxed template sees plain data: no method of the caller's objects, and a value that is not a plain type as its text.
  • tplx.evaluate and Loader.evaluate: an expression's value, its type kept, in Python (DEFAULT_ENGINE, refused by a sandbox) or an engine's syntax (engine="jinja", ".liquid", "go", ...), through Template.evaluate.
  • Loader.compile, cached; Template.references(), the names a template reads.

0.1.3 - 2026-10-15

Added

  • CheetahTemplate (.cheetah): Cheetah, Cobbler's kickstart language, rendered by CT3 behind the cheetah extra. #include resolves through the lookup; all three undefined modes apply; configure sets Cheetah's compiler settings.

Changed

  • A .cheetah file is rendered by the Cheetah engine; 0.1.2 copied it byte for byte.

0.1.2 - 2026-10-15

Added

  • GoTemplate (.tmpl, .gotmpl): Go's text/template, rendered by the pure-Python gotpl, behind the go extra (Python 3.11 or later). {{template}} names resolve through the lookup; Sprig and other functions come through Loader(configure={GoTemplate: ...}).

Changed

  • A .tmpl or .gotmpl file is rendered by the Go engine; 0.1.1 copied it byte for byte.

0.1.1 - 2026-10-15

Added

  • EnvsubstTemplate (.envsubst, .template): $NAME and ${NAME} as envsubst writes them. DIALECT is gnu (the default: no defaults, no $$ escape), a8m or drone; PATTERN and FEATURES override a dialect's.
  • The shell engine slices (%{NAME:1:3}, %{NAME: -2}) and replaces (%{NAME/pattern/text}, //, /#, /%) as bash does; FEATURES turns each piece of syntax on or off.
  • tplx render --env starts the data from the environment variables.

Changed

  • A .envsubst or .template file is rendered by the envsubst engine; 0.1.0 copied it byte for byte.
  • The shell engine leaves an expression it does not know as text and goes on scanning inside it, so a placeholder there is still substituted.

0.1.0 - 2026-10-15

Added

  • Loader and Lookup: find a template by name (an exact file name, or the file whose stem is the name and whose suffix the highest-priority engine claims, so boot.cfg.j2 beats a leftover boot.cfg.bak) under several roots, with per-caller candidates and paths, and render it with the engine its suffix names. render(name, data, **overrides); name may be a list of names, the first one found wins. A name holding .., a backslash or a drive is refused on every platform. Lookup.clear(); LOOKUP_CACHE_SIZE.
  • Engines: Jinja, mako, Liquid, Handlebars, Mustache (each behind an extra of that name), ERB (ruby), EPP (puppet), a %{NAME} shell engine and a byte-exact copy engine for every other file.
  • Includes in Jinja, mako, Liquid, Handlebars and Mustache resolve through the lookup that loaded the including file, to the same file and engine a render of that name would use: a file of another engine is rendered by that engine with the current data and its output inserted.
  • undefined="strict" | "lenient" | "debug" for every engine that can honour it.
  • The engine registry (register_engine, unregister_engine, registered_engines, the tplx.engines entry-point group) and tplx.testing.EngineContract, the suite every engine passes.
  • DataEncoder, the loader's encoder=: how data reaches Liquid, Handlebars, Mustache (view), ERB and EPP (json) and the shell engine (flatten); a subclass overrides default, key and text.
  • Loader(configure={EngineClass: function}): Jinja and Liquid environments, the mako TemplateLookup and the Handlebars helpers, set up once per lookup.
  • The tplx command (cli extra): tplx render, tplx find, tplx engines.
  • TplxError and its subclasses in tplx.exceptions; the TPLX_RUBY and TPLX_PUPPET environment variables.