Metadata-Version: 2.5
Name: pyrulecc
Version: 0.0.2
Summary: Evaluate field conditions against records, with dotted paths.
Project-URL: Homepage, https://github.com/lqxnjk/pyrulecc
Author: lqxnjk
License: MIT
License-File: LICENSE
Keywords: conditions,filter,match,records,rules
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pyrulecc

Declarative record filtering — put the conditions in data instead of writing
one `if` chain per dataset.

## Install

```console
pip install pyrulecc
```

## Usage

```python
from pyrulecc import filter_records, match_record

row = {"name": "alice", "age": 30, "org": {"code": "A1"}}

match_record(row, {"age": (">=", 18)})            # True
match_record(row, {"name": ("contains", "li")})   # True
match_record(row, {"org.code": "A1"})             # True  dotted path

rows = [{"n": 1}, {"n": 5}, {"n": 9}]
filter_records(rows, {"n": (">", 2)})            # [{'n': 5}, {'n': 9}]
```

## Operators

`eq`, `ne`, `gt`, `ge`, `lt`, `le`, `in`, `contains`, `startswith`,
`endswith`, `regex`.

A bare value means `eq`. Unknown operators raise `ValueError` instead of
quietly matching nothing.

## Missing fields

A rule on a field the record does not have never matches — filtering data with
holes should not silently pass records through.

## License

MIT
