Metadata-Version: 2.4
Name: pytastic
Version: 0.0.1
Summary: A dependency-free JSON validation library using TypedDict and Annotated
Author: Tersoo
Author-email: tersoo@example.com
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
Description-Content-Type: text/markdown

# Pytastic

A dependency-free, high-performance JSON validation library using Python's native `TypedDict` and `Annotated`.

## Highlights
- **Zero Dependencies**: Pure Python standard library.
- **Dual API**: 
    - `vx.User(data)` for clean, dynamic usage.
    - `vx.validate(User, data)` for full IDE type safety.
- **Rich Constraints**: `min`, `max`, `regex`, `unique`, `one_of`, `Literal`, and nested validation.

## Installation

```bash
pip install pytastic
```

## Usage

```python
from pytastic import Pytastic
from typing import TypedDict, Annotated, List, Literal

vx = Pytastic()

# 1. Define Schema
class User(TypedDict):
    username: Annotated[str, "min_len=3; regex=^[a-z_]+$"]
    age: Annotated[int, "min=18"]
    role: Literal["admin", "user"]

vx.register(User)

# 2. Validate
try:
    # Typed validation (IDE friendly)
    user = vx.validate(User, {"username": "tersoo", "age": 25, "role": "admin"})
    print(user)

    # 3. Export JSON Schema
    print(vx.schema(User))
except Exception as e:
    print(e)
```

## License

MIT

