Verdict — Python
The Python implementation of Verdict — a small, zero-dependency, async-native rule-evaluation engine. See the top-level
README.mdfor what Verdict is and why it's shaped this way in narrative form; this doc is just "how do I install it and write my first rule" for Python specifically.This exact file is also what PyPI renders as the package description — none of its sibling files travel with a
pip install, which is why every link below is an absolute GitHub URL rather than a relative path; on GitHub itself they work exactly the same way.
Install
pip install verdict-rules
The distribution on PyPI is named verdict-rules (the name verdict
was already taken by an unrelated package), but the import name is
plain verdict:
from verdict import Rule, FunctionRule, AndRule, OrRule, RulesEngine
A first rule
A FunctionRule's predicate returns a full RuleResult, not a bare
boolean — that keeps it in control of detail/data, not just pass/fail:
import asyncio
from verdict import FunctionRule, AndRule, RuleResult, RulesEngine
async def under_limit(context: dict) -> RuleResult:
return RuleResult(
rule_name="under_limit",
passed=context["requests_this_minute"] < context["limit"],
)
async def in_good_standing(context: dict) -> RuleResult:
return RuleResult(
rule_name="in_good_standing",
passed=context["account_status"] == "active",
)
async def main() -> None:
can_proceed = AndRule(
"can_proceed",
[
FunctionRule("under_limit", under_limit),
FunctionRule("in_good_standing", in_good_standing),
],
)
engine = RulesEngine([can_proceed])
result = await engine.run_named(
"can_proceed",
{"requests_this_minute": 3, "limit": 10, "account_status": "active"},
)
print(result.passed) # True
asyncio.run(main())
Where to go next
| Doc | For |
|---|---|
docs/quickstart.md |
The quickstart — core concepts and a full worked example |
docs/architecture.md |
Why it's shaped this way, in depth — type structure, the execution model |
docs/extension.md |
Building on top of it from your own code, with no changes here |
docs/maintenance.md |
Changing this package itself |
docs/testing.md |
How the test suite is organized, and what a change needs to prove |
docs/samples/ |
Worked examples — dynamic discounts, fee waivers, tier promotions, moderation routing, data-driven rule sets |
examples/ |
Full, tested mini-projects behind the more comprehensive samples — real code, real tests, real docs |
Development
uv sync
uv run pytest
Release files for verdict-rules 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| verdict_rules-0.2.0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| verdict_rules-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:17.1 kB
Release files / verdict_rules-0.2.0.tar.gz
| Download URL | verdict_rules-0.2.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d4d79b162594d49f236cb03cf818783a3f2cd9736b66db8aa0d1c6e32fb5511
|
|
BLAKE2b-256 checksum How to use checksums |
5e2c6f9baef7e75e87b1aa121c73b870181a79ee4d0dfbeaa61b24a4aa0de8f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 12, 2026.
Transparency logRelease files / verdict_rules-0.2.0-py3-none-any.whl
| Download URL | verdict_rules-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f45a4329d521ed0cdb447251997dc6ba51c5244dc7e6aede5f7aa5ce2bd67ba2
|
|
BLAKE2b-256 checksum How to use checksums |
26bcafc52130bf3d896fcfa3765b5722c986bb51706b7357598877ee992d8f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 12, 2026.
Transparency log