Skip to main content

Ultra-fast data validation for Python - 28M validations/sec, 3x faster than Rust alternatives

Project description

dhi - Ultra-Fast Data Validation for Python

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

🚀 Performance

28 million validations/sec - 3x faster than satya (Rust), 3x faster than msgspec (C)

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

users = [{"name": "Alice", "email": "[email protected]", "age": 25}, ...]

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

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

✨ Features

  • �� Fastest: 3x faster than satya (Rust) and msgspec (C)
  • 🎯 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

pip install dhi

🎯 Quick Start

from dhi import _dhi_native

users = [
    {"name": "Alice", "email": "[email protected]", "age": 25},
    {"name": "Bob", "email": "[email protected]", "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

dhi:     28M users/sec  🥇
satya:    9M users/sec  (3.0x slower)
msgspec:  9M users/sec  (3.1x slower)

📝 License

MIT License - see LICENSE file

🔗 Links

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

dhi-1.1.21.tar.gz (142.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dhi-1.1.21-py3-none-any.whl (133.1 kB view details)

Uploaded Python 3

File details

Details for the file dhi-1.1.21.tar.gz.

File metadata

  • Download URL: dhi-1.1.21.tar.gz
  • Upload date:
  • Size: 142.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for dhi-1.1.21.tar.gz
Algorithm Hash digest
SHA256 390c2e234fca6bd0846264fa2f1af479ec948975831d4fa2224138af2c16f360
MD5 8e8d0c19a473d28362f326d303b175f2
BLAKE2b-256 6b8c4cdeaba3140e6b2491f4904c3ea07e90805967c24bbc0c400489289a406c

See more details on using hashes here.

File details

Details for the file dhi-1.1.21-py3-none-any.whl.

File metadata

  • Download URL: dhi-1.1.21-py3-none-any.whl
  • Upload date:
  • Size: 133.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for dhi-1.1.21-py3-none-any.whl
Algorithm Hash digest
SHA256 e21feff4996a04c260f1ef083168c7027748a54a45ec43e49b33f7fae57ff4d1
MD5 3f7c81fec7dac53a4df032c94a827491
BLAKE2b-256 b66191ad5a9df5c50b096d3b2a77dcc2a63a37b3df70e879844b54593c5055fd

See more details on using hashes here.

Supported by

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