Ultra-fast data validation for Python - 24M validations/sec, powered by Zig
Project description
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
# 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
pip install dhi
🎯 Quick Start
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/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dhi-1.2.0.tar.gz.
File metadata
- Download URL: dhi-1.2.0.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3b87cd947499835c441c7bd370df066a8f46383d15476bb74008c5c3cd7f1f9
|
|
| MD5 |
0cb517d8a7c2de31714dea822ab6a2db
|
|
| BLAKE2b-256 |
e76c7600d864642f7c2ce6cdc914126ba427e8344f522f6101a47755f00f9979
|
File details
Details for the file dhi-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 771.4 kB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66e7c8a244da27db827cd6fc04dabae525cb7ce08c3d6af4de6b85d0b3a2f14a
|
|
| MD5 |
09a0c19607a99f6ea9ce90c0fea66c25
|
|
| BLAKE2b-256 |
e93f88c6e1f368bdc6c5611316f41329522c0ccf9842aaddb7605a13d999db53
|
File details
Details for the file dhi-1.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 759.9 kB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
051cef9a12433375951a310a38639585d1de9c631368598d971d665a1c3b1e55
|
|
| MD5 |
44a5258c09fef2ef14d13b9d477b2126
|
|
| BLAKE2b-256 |
671cb6a3064fe10369f44b2550920895bb10f2203da430981836b1f71b38903e
|
File details
Details for the file dhi-1.2.0-cp313-cp313t-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313t-macosx_13_0_arm64.whl
- Upload date:
- Size: 134.0 kB
- Tags: CPython 3.13t, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd0ac6b8d73a63611028f8aebedadee97efad52082288743cf74fbc0a3399b1
|
|
| MD5 |
1fdf12e12767dcbf16672cbda928875a
|
|
| BLAKE2b-256 |
f9f29a027fe41c23c95fc73a35bc2249c7ccb85b0c6c944732add4e07e42713c
|
File details
Details for the file dhi-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 754.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06124147eb3d4876a52870cb6d9911ef923ba7b084d292ebe9dfa518fbcb6bfe
|
|
| MD5 |
8da7a5a6b05c0440a288487a692c6582
|
|
| BLAKE2b-256 |
c1da00cf594c76d2fb476d1214c284bab20544a9873dd3ecbd2eb9b0beac63f2
|
File details
Details for the file dhi-1.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 738.3 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12ff4fe46997b4ce920394879f620d9964f46322efd41e64c5a60ead3a40f8b
|
|
| MD5 |
68cea63c951d1dfc1a9711e652a275d7
|
|
| BLAKE2b-256 |
542e770d654acb1f98e0367f18ad850136736d046ef69a1d18ed29c44a0923d5
|
File details
Details for the file dhi-1.2.0-cp313-cp313-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp313-cp313-macosx_13_0_arm64.whl
- Upload date:
- Size: 131.2 kB
- Tags: CPython 3.13, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54cbee753b5714a9555661d3263dd12b0a7167e0005d3d08cdf767e288f790ec
|
|
| MD5 |
97ad582905c82537557096eaa0351883
|
|
| BLAKE2b-256 |
643acf413a73af58a78e2f6b82b1341632f92bb622e3852634b0a9e7382c8243
|
File details
Details for the file dhi-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 754.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
290d6faa3f135931a71fff57d25c19432ee43867849db46c2e5b4d433e551413
|
|
| MD5 |
054694ae3caaa0e75d90581f6cdc5848
|
|
| BLAKE2b-256 |
6ca052ce1acc1ee9169bf121ff1aa96658bfffab69eda49cb1ea5fc0a960c9a1
|
File details
Details for the file dhi-1.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 738.3 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6894a922f96ad0d51e53b640ca27661f215832ed25630dee15750b1bcc6800af
|
|
| MD5 |
839a2ea1537774579fecdc629256d920
|
|
| BLAKE2b-256 |
a7644e04bec341f5c3536655ab0714ee51ae2eecdfd656c20c1305010a522331
|
File details
Details for the file dhi-1.2.0-cp312-cp312-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 131.2 kB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f5b27a7449b38eb75a9239855c3271d93cd3b4966a9cbf76d3daa6a067f8805
|
|
| MD5 |
92d141ec0ae65c2334534c36173dd48c
|
|
| BLAKE2b-256 |
9e8e205b2108907350c86acaff7dee021a361efdd7e4c37da78a3a78dd50b061
|
File details
Details for the file dhi-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 739.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
750b02abc9af5866d2cdad6d4015250be4cbd043d8a176961d3d117698846422
|
|
| MD5 |
cc1244c132351c4f9e175fc4b062ad24
|
|
| BLAKE2b-256 |
8f71cb062e9b93bb47ac984e8424a0167e68e0b8d0194da0c0beeb3bfe884bcb
|
File details
Details for the file dhi-1.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 724.7 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a818a02d7d08aa64fcb8f8bd9be0c3c8fd34b19bcfdc679d578de3c1c2fe395
|
|
| MD5 |
db58493eea394550460d487e9783b2dd
|
|
| BLAKE2b-256 |
9a286ef36be018aea0c54f227bf539c84bccefde2d38147056f70c152939403a
|
File details
Details for the file dhi-1.2.0-cp311-cp311-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 130.9 kB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c491e13034be10a39ef632285c08607bb5a616ae0f46abf401432f1ed1a1c15d
|
|
| MD5 |
a5a33201dc19a25e8db0daf4e8e30bda
|
|
| BLAKE2b-256 |
f8ceec5bafae2c94497082e5fe9b8e5033e516e9426de1d1dad4c13762d1beeb
|
File details
Details for the file dhi-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 732.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3867380abf3f39e69dbb27fd312f537e876f45c562248623c57c105c279a1e5
|
|
| MD5 |
de23d3da9a307ab87a9c2d6eda0f3963
|
|
| BLAKE2b-256 |
223628f842ac4a58e6d28dde5d2c758ede1c7e13bc7ae5a849dd0c8c30859d74
|
File details
Details for the file dhi-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 717.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ed087233b9f248423f9feec8278936f31d0a505be3000047cc9ec4efb30b89d
|
|
| MD5 |
3f13e3dc33ce7661f27ae65e2d69849d
|
|
| BLAKE2b-256 |
db9d87955865e0098b103b7ee3ba62123f3d82de99dfbecb97428fac644cde34
|
File details
Details for the file dhi-1.2.0-cp310-cp310-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 130.9 kB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e559f0db59926da7220e5d2481487b9038729f7d874730e7cbde9f80cb9840f2
|
|
| MD5 |
e0d17268ceb6de51035c30705da47977
|
|
| BLAKE2b-256 |
e623b044d79ae6dd917eb51091e065277c9b5a79be5c364c1489513b4079b532
|
File details
Details for the file dhi-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: dhi-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 731.7 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd1378888afb0e125e47f55c39e8660221c8bd6c11115314d375ba4b27a65091
|
|
| MD5 |
8f705ec328c01a095e8207da4b6273b3
|
|
| BLAKE2b-256 |
f0c1e499ede9460524caf281ae904484e74ff7f05c023e6b8d250303be8c50b0
|
File details
Details for the file dhi-1.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: dhi-1.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 716.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5865430841451a786e7d311ff32308ec5e6231a5a34cc999be6a240cc27db9e1
|
|
| MD5 |
2ce571a7c8a2c5f2b82c86c57eb2e0ae
|
|
| BLAKE2b-256 |
640b9f3f733befadd0f83e223b907f3a0b5b30f44617bf33e876d9bd4af91288
|
File details
Details for the file dhi-1.2.0-cp39-cp39-macosx_13_0_arm64.whl.
File metadata
- Download URL: dhi-1.2.0-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 130.8 kB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d48be39423c8cc2c95b79f0c90c102169403d297cd7bbd16d35b675ab9ec8db
|
|
| MD5 |
4ab9d34299f3632d66e0977682a4b799
|
|
| BLAKE2b-256 |
32036ca4f3e198e337466e807c6d2a2c212b974fc796b48da8483b540b1d560c
|