← Back to all products
$29
Data Validation Toolkit
Pydantic models, custom validators, schema evolution patterns, and data quality frameworks for Python applications.
PythonYAMLMarkdownJSON
Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
Interactive Reader (Free Preview) ⚙ Try Demo Tools Download Free SampleFile Structure 16 files
data-validation-toolkit/
├── LICENSE
├── README.md
├── configs/
│ ├── rules/
│ │ └── business_rules.yaml
│ └── schemas/
│ └── user_schema.yaml
├── examples/
│ └── validate_user_data.py
├── guides/
│ └── data-validation-guide.md
├── src/
│ ├── decorators.py
│ ├── pipeline.py
│ ├── reporters.py
│ └── validators/
│ ├── base.py
│ ├── business_rules.py
│ ├── file_validator.py
│ ├── schema_validator.py
│ └── type_validator.py
└── tests/
└── test_validators.py
Documentation Preview README excerpt
Data Validation Toolkit — Composable Validation for Python
Type-safe, pipeline-driven validation with schema support, business rules, and detailed error reporting.
What You Get
- 5 validator types — base, type, schema, business rules, and file validators
- Composable pipeline — chain validators in sequence with short-circuit or collect-all modes
- YAML-driven schemas — define validation rules in config, not code
- Rich error reports — JSON, plain text, or structured output with field paths
- Function decorators — validate arguments automatically on function call
File Tree
data-validation-toolkit/
├── README.md
├── manifest.json
├── LICENSE
├── src/
│ ├── validators/
│ │ ├── base.py # Abstract base + ValidationError
│ │ ├── type_validator.py # Runtime type checking
│ │ ├── schema_validator.py # YAML-driven schema validation
│ │ ├── business_rules.py # Configurable business rules
│ │ └── file_validator.py # File existence, size, format
│ ├── pipeline.py # Validation pipeline orchestrator
│ ├── reporters.py # Error formatting & reporting
│ └── decorators.py # @validate_args decorator
├── configs/
│ ├── schemas/
│ │ └── user_schema.yaml # Example schema definition
│ └── rules/
│ └── business_rules.yaml # Example business rules
├── examples/
│ └── validate_user_data.py # End-to-end usage example
├── tests/
│ └── test_validators.py # Comprehensive test suite
└── guides/
└── data-validation-guide.md
Getting Started
Basic type validation
from src.validators.type_validator import TypeValidator
validator = TypeValidator({"name": str, "age": int, "active": bool})
errors = validator.validate({"name": "Alice", "age": "thirty", "active": True})
# errors[0].field == "age", errors[0].message == "Expected int, got str"
Schema validation from YAML
from src.validators.schema_validator import SchemaValidator
validator = SchemaValidator.from_yaml("configs/schemas/user_schema.yaml")
*... continues with setup instructions, usage examples, and more.*
Code Sample .py preview
src/decorators.py
"""Validation decorators — validate function arguments automatically.
Usage:
@validate_args(name=str, age=int)
def create_user(name: str, age: int) -> dict:
return {"name": name, "age": age}
create_user("Alice", 30) # OK
create_user("Alice", "thirty") # Raises ValidationException
"""
from __future__ import annotations
import functools
import inspect
from typing import Any, Callable, TypeVar
from .validators.base import Severity, ValidationError, ValidationException
F = TypeVar("F", bound=Callable[..., Any])
def validate_args(**type_spec: type | tuple[type, ...]) -> Callable[[F], F]:
"""Decorator that validates function arguments at call time.
Checks that each named argument matches the specified type(s). Raises
:class:`ValidationException` on mismatch.
Args:
**type_spec: Keyword arguments mapping parameter names to expected types.
Returns:
Decorator.
Example::
@validate_args(name=str, count=int)
def greet(name: str, count: int) -> None:
...
"""
def decorator(func: F) -> F:
sig = inspect.signature(func)
@functools.wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
bound = sig.bind(*args, **kwargs)
bound.apply_defaults()
errors: list[ValidationError] = []
# ... 77 more lines ...