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.2.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.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: renderix-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 c3c4e6804890dda2e076da29d6860ace6ad65298e218674357be4d2cf784a356
MD5 bd9bcc2cf92d9e8c6f45f6a86493b749
BLAKE2b-256 14f4d1d4992175fceacc0565df8683f719e811ad06493f6becf6e03b019704f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: renderix-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d81b1da5c2c995ebddab99acfe982c66a81787f3632a41351b40c9d6811cc824
MD5 0ec91bc9f9c3f4152a8db2a3b9839729
BLAKE2b-256 9e61a7a8d9bc6c6973976e371751ed263282a064952a672cd38a191af3a26fb4

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