Metadata-Version: 2.4
Name: dhi
Version: 1.2.0
Summary: Ultra-fast data validation for Python - 24M validations/sec, powered by Zig
Author-email: Rach Pradhan <rach@rachpradhan.com>
License: MIT
Project-URL: Homepage, https://github.com/justrach/dhi
Project-URL: Documentation, https://github.com/justrach/dhi#readme
Project-URL: Repository, https://github.com/justrach/dhi
Project-URL: Issues, https://github.com/justrach/dhi/issues
Keywords: validation,data-validation,pydantic,zig,performance,fast,validator,email,url,uuid,schema
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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 :: Other
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Dynamic: license-file

# dhi - Ultra-Fast Data Validation for Python

**The fastest data validation library for Python.** Powered by Zig for maximum performance.

## 🚀 Performance

**24 million validations/sec** - 4x faster than msgspec (C), 31x faster than msgspec-ext, 523x faster than Pydantic

```python
# Validate 10,000 users in 0.36ms
from dhi import _dhi_native

users = [{"name": "Alice", "email": "alice@example.com", "age": 25}, ...]

field_specs = {
    'name': ('string', 2, 100),
    'email': ('email',),
    'age': ('int_positive',),
}

results, valid_count = _dhi_native.validate_batch_direct(users, field_specs)
# 24M users/sec! 🔥
```

## ✨ Features

- **⚡ Fastest**: 4x faster than msgspec (C), 31x faster than msgspec-ext, 523x faster than Pydantic
- **🎯 24+ Validators**: Email, URL, UUID, IPv4, dates, numbers, strings
- **🔋 Zero Python Overhead**: C extension extracts directly from dicts
- **🌍 General Purpose**: Works with any dict structure
- **💪 Production Ready**: Thoroughly tested and benchmarked

## 📦 Installation

```bash
pip install dhi
```

## 🎯 Quick Start

```python
from dhi import _dhi_native

users = [
    {"name": "Alice", "email": "alice@example.com", "age": 25},
    {"name": "Bob", "email": "bob@example.com", "age": 30},
]

field_specs = {
    'name': ('string', 2, 100),
    'email': ('email',),
    'age': ('int_positive',),
}

results, valid_count = _dhi_native.validate_batch_direct(users, field_specs)
print(f"Valid: {valid_count}/{len(users)}")
```

## �� Available Validators

### String: `email`, `url`, `uuid`, `ipv4`, `base64`, `iso_date`, `iso_datetime`, `string`
### Number: `int`, `int_gt`, `int_gte`, `int_lt`, `int_lte`, `int_positive`, `int_non_negative`, `int_multiple_of`

## 🏆 Benchmarks

10,000 users validated with email, URL, and positive-int checks:

```
dhi (Zig+C):      24M users/sec  🥇
msgspec (C):       5.8M users/sec  (4.2x slower)
satya (Rust):      2.1M users/sec  (11.5x slower)
msgspec-ext:       777K users/sec  (31x slower)
Pydantic V2:        46K users/sec  (523x slower)
```

## 📝 License

MIT License - see LICENSE file

## Links

- GitHub: https://github.com/justrach/dhi
- PyPI: https://pypi.org/project/dhi/
