Skip to main content

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


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.2.tar.gz (41.0 kB view hashes)

Uploaded Source

Built Distribution

koda_validate-3.1.2-py3-none-any.whl (52.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page