Repository navigation
v0.1.0
libtexpr v0.1.0
Changelog
Added
- Parser for placeholders such as
[ДОЛГ.СУММА * 2 | деньги: кратко]: fields, numbers, words, names in Latin or Cyrillic, arithmetic with parentheses and unary minus, and a pipeline of functions with arguments Enginewithregister,validate,evaluateandrender_text, which leaves a placeholder that fails exactly as writtenFunctionandParam: a function declares its name, code, input and output types, and arguments with allowed values and defaults- Typed values between functions:
TEXTisstr,NUMBERisDecimal,DATEisdatetime.date;evaluateconverts to the input type of each function and always returns text - Exact arithmetic with
Decimal; numbers in data may use a comma as the decimal separator and spaces as thousands separators, and dates areYYYY-MM-DD validatereturns every problem found:UNKNOWN_FIELD,UNKNOWN_FUNCTION,TYPE_MISMATCHandBAD_ARGUMENT- Errors rooted in
TexprError:ParseErrorsubclasses carry the position of the error, an exception or a wrongly typed result from a function becomesFunctionError - Limits of 500 characters and 20 nesting levels, exposed as
Placeholder.MAX_LENGTHandPlaceholder.MAX_NESTINGand reported asLimitExceededError Placeholder.parseandPlaceholder.extractto read a placeholder and to find the placeholders in a text- No runtime dependencies; Python 3.12 or newer
Install
Latest
uv add libtexprVersioned
uv add libtexpr==0.1.0Full Changelog: https://github.com/StafLoker/libtexpr/commits/v0.1.0