Metadata-Version: 2.4
Name: larzvalidate
Version: 0.1.0
Summary: Validate input data against a schema with clear errors, zero dependencies
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzvalidate
Project-URL: Repository, https://github.com/larz-scripter/larzvalidate
Project-URL: Issues, https://github.com/larz-scripter/larzvalidate/issues
Keywords: validation,schema,forms,api,education,learn-to-code,building-blocks,input,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzvalidate

**Validate input data against a schema — the guard every real app needs.**

Data from forms, APIs and files is untrustworthy: fields go missing, numbers
arrive as text, strings are too long. larzvalidate lets you declare what valid
data looks like — a small schema of fields with rules — and checks input against
it, returning clean, type-coerced data or clear per-field error messages. Zero
dependencies.

## Install

```bash
pip install larzvalidate
```

## Use

```python
from larzvalidate import validate, Field, ValidationError, EMAIL

schema = {
    "name":  Field(str, required=True, min=1, max=50),
    "age":   Field(int, min=0, max=150),
    "email": Field(str, required=True, pattern=EMAIL),
    "role":  Field(str, choices=["user", "admin"], default="user"),
}

clean = validate({"name": "Ada", "age": "36", "email": "a@b.co"}, schema)
# {'name': 'Ada', 'age': 36, 'email': 'a@b.co', 'role': 'user'}
```

## Learn to code with Larz

Part of the **learn-to-code toolkit** in the [Larz stack](https://github.com/larz-scripter) —
see the [Learn to Code platform](https://larzos.com/learn/). The gatekeeper for
real forms and APIs.

## Tests

```bash
python -m unittest discover -s tests -v   # 7 tests
```

## License

MIT (c) larz-scripter
