Skip to main content

vcti-predicate

VCollab Predicate - condition evaluation engine with extensible operators and modifiers

Overview

Filtering, validation, workflow conditionals and routing logic all need to evaluate conditions such as "is this value greater than X?", "does this string contain Y?" or "is Z in this list?". vcti-predicate provides two entry points, check() and evaluate(), that take a symbol ("==", "^=", "is_empty") and pick the comparison by the type of the left-hand operand. Each operator belongs to a group that normalizes its operands (strings compare case-insensitively by default) and declares the modifiers it accepts (case_sensitive, tolerance, inclusive). Symbols, operators and groups live in a registry you can extend or copy.


Installation

pip install vcti-predicate

In requirements.txt

vcti-predicate>=2.0.1

In pyproject.toml dependencies

dependencies = [
    "vcti-predicate>=2.0.1",
]

Quick Start

from vcti.predicate import check

# ── Binary: check(lhs, symbol, rhs) ──

# String (case-insensitive by default)
check("Hello", "==", "hello")         # True
check("filename.pdf", "$=", "pdf")    # True
check("filename", "?=", "name")       # True

# Integer (exact)
check(5, ">", 3)     # True
check(5, "==", 5)    # True

# Float (with tolerance)
check(1.0, "==", 1.001, tolerance=0.01)   # True

# Case-sensitive via modifier or suffix
check("Hello", "==", "hello", case_sensitive=True)  # False
check("Hello", "^=cs", "Hello")                     # True

# Collection operations
check(2, "@=", [1, 2, 3])                  # True
check(["a", "b"], "all", ["a", "b", "c"])  # True

# Regex matching with options
check("test123", "~=", r"\d+")                          # True
check("line1\nline2", "~=", r"^line2", multiline=True)  # True

# Negation
check("hello", "!^=", "xyz")    # True (does not start with)
check("hello", "!~=", r"\d+")   # True (no digits)
check(4, "!@=", [1, 2, 3])     # True (not in list)

# Range (rhs is a (lo, hi) pair: tuple, list, or any two-element iterable)
check(5, "between", (1, 10))       # True
check(0, "!between", (1, 10))      # True

# ── Unary: check(value, symbol) ──

check("", "is_empty")           # True
check(None, "exists")           # False
check("/tmp/f.txt", "is_file")  # True (if file exists)
check("/tmp", "is_dir")         # True (if directory exists)

Entry Points

Function Argument order Use case
check(lhs, op, rhs?) Value-first Primary user-facing function — binary and unary
evaluate(op, lhs, rhs?) Symbol-first For rule engines and programmatic use

Both use the same resolution, normalization, and dispatch engine.


Symbol Summary

Comparison

Symbol Alias Description
== eq Equal
!= ne Not equal
< <= > >= lt le gt ge Ordering

String

Symbol Alias Negation Description
^= startswith !^= Starts with
$= endswith !$= Ends with
?= contains !?= Contains
@= in !@= In collection/string

Regex

Symbol Alias Negation Description
~= matches !~= Regex search

Unary

Symbol Description
is_empty / exists / is_numeric Value checks
is_file / is_dir / path_exists Filesystem checks

Range

Symbol Description
between / !between Value within bounds (rhs is a (lo, hi) pair)

Modifier Suffixes

Append cs or ic to string symbols for case control: ^=cs, $=ic, ?=cs, @=ic, ~=cs. A suffix fixes the case handling, so it cannot be combined with the case_sensitive modifier.

For the complete symbol reference, see the Symbol Reference.


Modifiers

Pass modifiers as keyword arguments to control behavior:

check("Hello", "==", "hello", case_sensitive=True)   # False
check(1.0, "==", 1.001, tolerance=0.01)              # True
check(5, "between", (1, 10), inclusive=False)         # True
check("text", "~=", r"^line", multiline=True)        # regex option
Modifier Type Groups Default Effect
case_sensitive bool string, collection, regex False Case-sensitive comparison
tolerance float (int accepted) float 0.0 Maximum absolute difference for equality (float LHS only; finite, >= 0)
inclusive bool range True Include bounds in range check
multiline, dotall bool regex operators (options) False re.MULTILINE / re.DOTALL

Values are checked against the declared type, so case_sensitive="false" raises TypeError instead of being read as true. Types no group handles (lists, None, dates, ...) compare with plain Python operators and accept no modifiers.


Dependencies

None. vcti-predicate uses only the Python standard library.


Documentation

If you want to… Read
Get started using the package Quick Start above
Look up every symbol and which types it supports docs/symbols.md
See practical, real-world usage docs/patterns.md
Understand the architecture and design decisions docs/design.md
Navigate and understand the source docs/source-guide.md
Extend the library with operators, groups and symbols docs/extending.md

Metadata

Release files for vcti-predicate 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcti-predicate 2.0.1
File Size Uploaded Provenance Actions
vcti_predicate-2.0.1.tar.gz 47.9 kB With provenance Details for vcti_predicate-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vcti-predicate 2.0.1
File Interpreter ABI Platform Actions
vcti_predicate-2.0.1-py3-none-any.whl Python 3 none any Details for vcti_predicate-2.0.1-py3-none-any.whl

Total release size: 73.2 kB

Release files / vcti_predicate-2.0.1.tar.gz

Download URL vcti_predicate-2.0.1.tar.gz
Size 47.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c3468faa7664b7643fc820af4ae3c0de50ce2e19d14c3bbeaabb4ca88e5ad158
BLAKE2b-256 checksum
How to use checksums
c75fde5f523b1feb4c04b64b396f403bf88370fb6880c526f72b88b512ce253f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / vcti_predicate-2.0.1-py3-none-any.whl

Download URL vcti_predicate-2.0.1-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
292a0c3f7743f355d9743424729447ea419513892ec8a7013c9b6c39f84751aa
BLAKE2b-256 checksum
How to use checksums
6f49c73af5b73f4dab0a70e4bb05710133f0d4c217d6aaf37e1ce606eb998029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for vcti-predicate 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vcti_predicate-2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page