Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tera Processor

Purpose

Renders Tera template files into output files, with support for loading configuration variables from Python or Lua files.

How It Works

Files matching configured extensions in tera.templates/ are rendered and written to the project root with the extension stripped:

tera.templates/app.config.tera  →  app.config
tera.templates/sub/readme.txt.tera  →  sub/readme.txt

Templates use the Tera templating engine and can call load_python(path="...") or load_lua(path="...") to load variables from config files.

Loading Lua config

{% set config = load_lua(path="config/settings.lua") %}
[app]
name = "{{ config.project_name }}"
version = "{{ config.version }}"

Lua configs are executed via the embedded Lua 5.4 interpreter (no external dependency). All user-defined globals (strings, numbers, booleans, tables) are exported. Built-in Lua globals and functions are automatically filtered out. dofile() and require() work relative to the config file’s directory.

Loading Python config

{% set config = load_python(path="config/settings.py") %}
[app]
name = "{{ config.project_name }}"
version = "{{ config.version }}"

Source Files

  • Input: tera.templates/**/*{src_extensions}
  • Output: project root, mirroring the template path with the extension removed

Configuration

[processor.tera]
src_extensions = [".tera"]                     # File extensions to process (default: [".tera"])
dep_inputs = ["config/settings.py"]      # Additional files that trigger rebuilds when changed
KeyTypeDefaultDescription
src_extensionsstring[][".tera"]File extensions to discover
dep_inputsstring[][]Extra files whose changes trigger rebuilds

Batch support

Each input file is processed individually, producing its own output file.