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.7.tar.gz (5.6 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.7-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

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

Hashes for choc_expr-1.3.7.tar.gz
Algorithm Hash digest
SHA256 67b31255d91079312f32f198bab0789f53d13f9b20900016f2c9c8b98c0287a0
MD5 04208d8078a20f5fab4d3c0b8235076b
BLAKE2b-256 dc5d0af5cf3b8d45f6c8eafa9c3ff3dbf03360c90b5b7cbebe9372d080bcca55

See more details on using hashes here.

Provenance

The following attestation bundles were made for choc_expr-1.3.7.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.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

Hashes for choc_expr-1.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f0cfbbc5c1003381e626c6060397f161d715b278e1f832d9c296b4e9f3e11d00
MD5 334f496423157d74082014ea091ed089
BLAKE2b-256 2f87f9ff65b76623817a3274ff36f6ce2fda5c433406da8ae9c858bf7a9f9f0d

See more details on using hashes here.

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

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