Skip to main content

Predicate Evaluator

Purpose

VCollab applications frequently need to evaluate conditions — "is this value greater than X?", "does this string contain Y?", "does this list include Z?" These checks appear in filtering, validation, workflow conditionals, and routing logic.

The vcti-predicate package provides two entry points — check() and evaluate() — that resolve the right comparison logic based on the operand types, apply type-appropriate normalization, and support extensible operators with group-level and operator-specific options.

This package has zero external dependencies.


Installation

pip install vcti-predicate

In requirements.txt

vcti-predicate>=1.0.7

In pyproject.toml dependencies

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

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 tuple of bounds)
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 tuple)

Modifier Suffixes

Append cs or ic to string symbols for case control: ^=cs, $=ic, ?=cs, @=ic, ~=cs

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 Groups Default Effect
case_sensitive string, collection, regex False Case-sensitive comparison
tolerance float 0.0 Maximum difference for equality
inclusive range True Include bounds in range check

Documentation

Metadata

Release files for vcti-predicate 1.0.7

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 1.0.7
File Size Uploaded
vcti_predicate-1.0.7.tar.gz 25.3 kB Details

Built distribution (wheel)

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

Total release size: 43.3 kB

Release files / vcti_predicate-1.0.7.tar.gz

Download URL vcti_predicate-1.0.7.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
389d4e5c3c72fce2208845801bf980f49e72860dbe51c11e762ae9c8be72739a
BLAKE2b-256 checksum
How to use checksums
90ac0eb3ca4e567069b81d3974784d186b515f95c07941f5b1f3ce1e145a6e39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 22, 2026.

Transparency log

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

Download URL vcti_predicate-1.0.7-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97e72b4e03ea40819e7f244b713f4af87d6d38313ad14222c1453c0f8427f7ef
BLAKE2b-256 checksum
How to use checksums
a1dcc85ebda3749123e16d61d07188af7059980f8fd8fb040a077131b0df8a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

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