Easy validation for python
Project description
Requirements
- Python 3.6+
Installation & Upgrade
pip install fastvalidate --upgrade
Usage
from fastvalidate import Validator
validator = Validator({
'first_name': 'Mo',
'last_name': None,
'age': '5',
'email': 'mojtabaa.hn@gmail',
'website': 'yup',
'languages': ['en', 'fa'],
}, {
'first_name': 'required|min:3',
'last_name': 'required|min:3',
'age': 'required|numeric|gt:10|lt:120',
'email': 'required|email',
'website': 'required|url',
'languages': 'required|list|min:3'
})
validator.validate().errors()
# {
# 'first_name': 'Field length must be at least 3 characters',
# 'last_name': 'Field is required',
# 'age': 'Field must be greater than 10',
# 'email': 'Field must be email',
# 'website': 'Field must be url',
# 'languages': 'Field must have at least 3 items'
# }
Testing
# install pytest
pip install pytest
# run tests
python -m pytest
Development
# install requirements
pip install build twine
# Build package
make build
# Push to basalam repository
make push
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
fastvalidate-0.0.3.tar.gz
(5.7 kB
view details)
Built Distribution
File details
Details for the file fastvalidate-0.0.3.tar.gz
.
File metadata
- Download URL: fastvalidate-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b772d88b62bcc0269de39afaea3f33d1d52c5ee4517e9c1d39ba3a966129eb |
|
MD5 | e5430425feb3cc5bd0af5ff52cd49abf |
|
BLAKE2b-256 | 00b84f925d0b779893172a04c46db223cc7e1cbc96fcf2220a84d7b304de11a5 |
File details
Details for the file fastvalidate-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: fastvalidate-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc0479e5020383346305c2e29dfd2a1f8538206a826200867387500d2b340794 |
|
MD5 | bf20189b508d12a5ae3a4df5d03ad554 |
|
BLAKE2b-256 | 2faf7674528d603bb909dd78813f5f039573b8aaef55dce163292bae2aa24745 |