vutils-validator: Data Validation Utilities
This package provides a set of tools that helps with validation of input data.
Installation
To get the package on your system, type
$ pip install vutils-validator
How to Use
Please, read the following subsections to get more info about particular use case.
Basic Validations
Module vutils.validator.basic provides a set of functions for validation of
simple input data forms, like email addresses:
verify_not_empty(value)fails ifvalueis empty.verify_matches(value, regex, message="")fails ifvaluedoes not match regular expressionregex. Since many regular expressions describe entities that have a name (identifier, number, email address, etc.) the default error message can be overridden bymessageargument.verify_email(value)fails ifvalueis not an email address (currently described by simple^\S+@\S+\.[A-Za-z]+$regular expression).
The value passed to all validation functions can be either str or a
ValueHolder (from vutils.validator.value) object. A ValueHolder object
can be used to store additional information about value, like its name and
origin. The synopsis of ValueHolder's constructor is
__init__(self, value, name="The value", location=None), where value,
name, and location are value, its name, and the location of its origin,
respectively. location is a Location (from vutils.validator.value) object
that holds path, line, and column of the value/token origin. ValueHolder
serves to provide more detail about value in error messages issued by
validation functions by raising ValidationError (from
vutils.validator.errors) when the validation fails, example:
from vutils.validator.basic import verify_email
from vutils.validator.errors import ValidationError
from vutils.validator.value import ValueHolder
def get_input(name):
return ValueHolder(input(f"Enter {name}: "), name)
try:
verify_email(get_input("email"))
except ValidationError as exc:
print(exc)
On ill-formed input, the example prints email must be an email address!,
since get_input names a value as email.
Schema Validation
Module vutils.validator.schema provides function validate(data, schema) for
data validation against JSON schema schema. Function returns None in case
of valid data or list of jsonschema.exceptions.{Validation,Schema}Error in
case of invalid data or schema.
Metadata
Release files for vutils-validator 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vutils-validator-0.2.0.tar.gz | 12.7 kB | Without provenance | Details for vutils-validator-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vutils_validator-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for vutils_validator-0.2.0-py2.py3-none-any.whl |
Total release size: 21.4 kB
Release files / vutils-validator-0.2.0.tar.gz
| Download URL | vutils-validator-0.2.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ed287c48572fb28c2effa415bf6fbbfd2adb3ea6c791071d502e077819e76f9
|
|
BLAKE2b-256 checksum How to use checksums |
ff5b89242aaf94e6162c0098d5d814f1fcf3dbb664cbd8ef97d614b74ff9966a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Release files / vutils_validator-0.2.0-py2.py3-none-any.whl
| Download URL | vutils_validator-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2461a8d5960bfa9904ffb42f9205dae494c9c697b76700dcd041cd6598a84eb0
|
|
BLAKE2b-256 checksum How to use checksums |
f44380f35aaf6523a6d64b092d48bde13f35f383a341d41ed6942d3c06cd92da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for vutils-validator 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.