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
pip install larzvalidate
Use
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 — see the Learn to Code platform. The gatekeeper for real forms and APIs.
Tests
python -m unittest discover -s tests -v # 7 tests
License
MIT (c) larz-scripter
Metadata
Release files for larzvalidate 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| larzvalidate-0.1.0.tar.gz | 8.1 kB | Without provenance | Details for larzvalidate-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| larzvalidate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for larzvalidate-0.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / larzvalidate-0.1.0.tar.gz
| Download URL | larzvalidate-0.1.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
456a5b73dba77935b28ef8e20773a6df6f2d5782253a5b79c5576957b876485d
|
|
BLAKE2b-256 checksum How to use checksums |
9b1d582b79c13bd7e8764c48c1d1ff03a4dc15b566b9817957e319904b04aeb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larzvalidate-0.1.0-py3-none-any.whl
| Download URL | larzvalidate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18dc1a60a22754d1172a8f6f488e2e5e549bb30779f9b1bd846d8cb81273727d
|
|
BLAKE2b-256 checksum How to use checksums |
a181a2dfa1e6070f1ba3c3d4e3745f49c4aaadfb4173923178d57b22e4ad6b49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larzvalidate 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.