Skip to main content

A Python templating library

Project description

PyPI version Licence badge Python Actions Status Dependencies Downloads per month Last commit

choc-expr

Image

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

choc_expr-1.3.6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

choc_expr-1.3.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file choc_expr-1.3.6.tar.gz.

File metadata

  • Download URL: choc_expr-1.3.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for choc_expr-1.3.6.tar.gz
Algorithm Hash digest
SHA256 9621f0f816fffab01e331399162f1ec8b732442287d3ca792c188c9b1adb085e
MD5 321913f3e633d401cb9a36ef365c5c01
BLAKE2b-256 30cd7fde0c0c84c9341b62df80fd3047a25b11863468f8419dfbd5bfec1d0e48

See more details on using hashes here.

Provenance

The following attestation bundles were made for choc_expr-1.3.6.tar.gz:

Publisher: publish-package.yml on pe-brian/choc-expr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file choc_expr-1.3.6-py3-none-any.whl.

File metadata

  • Download URL: choc_expr-1.3.6-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

Hashes for choc_expr-1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 246f9fe3183c7b2e7fbbddfff6a03b131c31e0f597c273d9fc3560ebd3745a93
MD5 02a675465f0927cb25c8b67ab1693fe7
BLAKE2b-256 b507df51c48464d9030ef47402773d50baf2e9c345fc8eb9307db7b10a9c80b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for choc_expr-1.3.6-py3-none-any.whl:

Publisher: publish-package.yml on pe-brian/choc-expr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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