A Python templating library
Project description
choc-expr
A mini templating library
Why ChocExpr ?
ChocExpr is used by Chocolatine to help to generate SQL queries, but you are free to use it for your own projects.
Installation
pip install choc-expr
Functionnalities
- If-Then-Else statements
- Line break
- Compact/Extended mode
- Attributes evaluation :
- Loop : unpack iterable and join it by a character separator
- Attribute chain : follow the chain and return the nested value
TODO
- Nested Conditions
- Methods (upper, lower, title, etc...)
- Optional parenthesis in loop statement
Examples
from choc_expr import Expr as ChocExpr
age = 24 # or 15
print(ChocExpr("Kevin is @{age}>=18:an adult:a child; of {age} years old", vars()))
output :
>> Kevin is an adult of 24 years old
or
>> Kevin is a child of 15 years old
depending if condition is True or False.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file choc_expr-1.3.7.tar.gz.
File metadata
- Download URL: choc_expr-1.3.7.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67b31255d91079312f32f198bab0789f53d13f9b20900016f2c9c8b98c0287a0
|
|
| MD5 |
04208d8078a20f5fab4d3c0b8235076b
|
|
| BLAKE2b-256 |
dc5d0af5cf3b8d45f6c8eafa9c3ff3dbf03360c90b5b7cbebe9372d080bcca55
|
Provenance
The following attestation bundles were made for choc_expr-1.3.7.tar.gz:
Publisher:
publish-package.yml on pe-brian/choc-expr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
choc_expr-1.3.7.tar.gz -
Subject digest:
67b31255d91079312f32f198bab0789f53d13f9b20900016f2c9c8b98c0287a0 - Sigstore transparency entry: 1144991644
- Sigstore integration time:
-
Permalink:
pe-brian/choc-expr@7450c9379a3370815b93466a59b69477484aaee0 -
Branch / Tag:
refs/tags/v1.3.7 - Owner: https://github.com/pe-brian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@7450c9379a3370815b93466a59b69477484aaee0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file choc_expr-1.3.7-py3-none-any.whl.
File metadata
- Download URL: choc_expr-1.3.7-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0cfbbc5c1003381e626c6060397f161d715b278e1f832d9c296b4e9f3e11d00
|
|
| MD5 |
334f496423157d74082014ea091ed089
|
|
| BLAKE2b-256 |
2f87f9ff65b76623817a3274ff36f6ce2fda5c433406da8ae9c858bf7a9f9f0d
|
Provenance
The following attestation bundles were made for choc_expr-1.3.7-py3-none-any.whl:
Publisher:
publish-package.yml on pe-brian/choc-expr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
choc_expr-1.3.7-py3-none-any.whl -
Subject digest:
f0cfbbc5c1003381e626c6060397f161d715b278e1f832d9c296b4e9f3e11d00 - Sigstore transparency entry: 1144991738
- Sigstore integration time:
-
Permalink:
pe-brian/choc-expr@7450c9379a3370815b93466a59b69477484aaee0 -
Branch / Tag:
refs/tags/v1.3.7 - Owner: https://github.com/pe-brian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@7450c9379a3370815b93466a59b69477484aaee0 -
Trigger Event:
push
-
Statement type: