Skip to main content

Simple templating engine

Project description

renderix

PyPI - Version

Simple templating engine.

renderix renders a template file by replacing placeholders with values loaded from a TOML file named renderix.toml in the current working directory.


Features

  • Tiny, no-dependency templating
  • Variables loaded from renderix.toml
  • Placeholders: [- name -]
  • For loops over arrays of tables
  • Conditionals (if / elif / else)
  • Output to stdout by default, or write to a file

Installation

uv tool install renderix

Or:

git clone https://codeberg.org/nietarne/renderix.git
cd renderix
uv tool install .

Quick start

  1. Create a renderix.toml in your working directory:
name = "John Doe"
  1. Create a template file, e.g. template.txt:
Hello [- name -]
  1. Render it to stdout:
renderix -t template.txt

Syntax

All tags use [- ... -] delimiters. Whitespace inside is flexible: [- name -] and [-name-] are both valid.

Variables

Hello, [- name -]!

For loops

# renderix.toml
[[employees]]
name = "John"
age = 40

[[employees]]
name = "Jane"
age = 42
[- for employee in employees -]
- [- employee.name -] is [- employee.age -] years old
[- endfor -]

Conditionals

[- if status == "active" -]
Active user
[- elif status == "pending" -]
Pending approval
[- else -]
Inactive
[- endif -]

Supported condition forms:

Form Example
Truthy/falsy check [- if user -]
Equality [- if status == "active" -]
Inequality [- if count != 0 -]
Comparison [- if score >= 10 -]

Programmatic use

from renderix import render

result = render("Hello, [- name -]!", {"name": "World"})

The render function accepts any template string and a plain dict as context — no files involved. It raises RenderixSyntaxError for malformed templates and RenderixRenderError for missing variables or type mismatches.

from renderix import render, RenderixSyntaxError, RenderixRenderError

try:
    result = render(template_string, context_dict)
except (RenderixSyntaxError, RenderixRenderError) as e:
    ...

CLI options

  -t, --template    Template file to process (required)
  -o, --output      File to write output to (defaults to stdout)
  -v, --version     Print version and exit

Project details


Download files

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

Source Distribution

renderix-1.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

renderix-1.0.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file renderix-1.0.1.tar.gz.

File metadata

  • Download URL: renderix-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for renderix-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1e5aa76c53de006a9aa30188121d04ae076195913a4e4e232a24803d5a5464ea
MD5 e2793538a12c897deedb8437932a8b2e
BLAKE2b-256 a8adb8ef4a050494611e85238d4085c8060cea433210e4530ccfbb6d0de7243d

See more details on using hashes here.

File details

Details for the file renderix-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: renderix-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for renderix-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa165bac10e8ff54444665f0b28868b6610623d3102280950f7e0eb11a0e32e
MD5 b11f4be0b0a1b9264afeb67635f66f09
BLAKE2b-256 0c99a485f02e5746dd73875eddab38184de0012f31f1dd8820ea205047f733d2

See more details on using hashes here.

Supported by

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