Typesafe, composable validation
Project description
Koda Validate
Build typesafe validators automatically or explicitly -- or write your own. Combine them to build validators of arbitrary complexity. Koda Validate is async-friendly, pure Python, and 1.5x - 12x faster than Pydantic.
Docs: https://koda-validate.readthedocs.io/en/stable/
from typing import TypedDict
from koda_validate import (StringValidator, MaxLength, MinLength,
ListValidator, TypedDictValidator)
from koda_validate.signature import validate_signature
# Explicit Validators
string_validator = StringValidator(MinLength(8), MaxLength(20))
list_string_validator = ListValidator(string_validator)
# Derived Validators
class Person(TypedDict):
name: str
hobbies: list[str]
person_validator = TypedDictValidator(Person)
# Runtime type checking
@validate_signature
def add(a: int, b: int) -> int:
return a + b
There's much, much more... Check out the Docs.
Something's Missing Or Wrong
Open an issue on GitHub please!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
koda_validate-3.1.1.tar.gz
(40.9 kB
view hashes)
Built Distribution
Close
Hashes for koda_validate-3.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a58d378978c737c8b963d2ca95dabd60771e66691fab0fcf1c8a9f3b91681ba |
|
MD5 | d604f1e246402e973585cca4adb8c1d3 |
|
BLAKE2b-256 | 67815d583bfea51e9c66952ba2736169f3d4a913d3e3b41fc1f233e430ce2797 |