minja
A Mini Jinja Template Engine
I am creating this package because I need something like Jinja, but in a much smaller footprint.
Install
pip install minja
Usage
A Simple Usage
from minja import Template
template = Template("{{ flowers }} are {{ color }}")
print(template.render(flowers="Roses", color="red"))
# Roses are red
What Is a Template?
A template is a string embedded variables. For example, the template in
previous example has two variables, flowers and color.
Note that the spaces surrounding the variables are insignificant: they are there to improve readability. That means the following will render to the same text:
t1 = Template(">{{name}}<")
t2 = Template(">{{ name }}<")
t3 = Template(">{{ name }}<")
print(t1.render(name="Anna")) # '>Anna<'
print(t2.render(name="Anna")) # '>Anna<'
print(t3.render(name="Anna")) # '>Anna<'
How Can I Get the Names of the Variables?
A template maintains a property called .names which keep track of the
names of the variables.
template = Template("{{ flowers }} are {{ color }}")
print(template.names) # {'flowers', 'color'}
Metadata
Release files for minja 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| minja-1.2.0.tar.gz | 35.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minja-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.4 kB
Release files / minja-1.2.0.tar.gz
| Download URL | minja-1.2.0.tar.gz |
|---|---|
| Size | 35.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4eab83c29450507089827bfb75332cd2592b3dd5ee62e488e156d375b9aca912
|
|
BLAKE2b-256 checksum How to use checksums |
05d17b9f1052cafb9892877da64448d321f6e79fb0da7efd311a4937bd491e00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / minja-1.2.0-py3-none-any.whl
| Download URL | minja-1.2.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22da87e62b73a3253f3bc276b34edb21da36f3f319bbd9ccbf18c7f77e279b8c
|
|
BLAKE2b-256 checksum How to use checksums |
dc24bf1e374431e6edfd93661b0241ba6dbc693f759dd7014508cca7aafb0644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|