Skip to main content

A library is a lightweight Python package with key focus to handle data validation on primitive and non primitive data types in python.

Project description

Validator Library

Overview

This Validator library is a lightweight Python library with key focus to handle data validation on primitive and non primitive data types in python. It provides a short, simple, easy to use syntax to validate a common data types e.g string, int, Date etc. through a collection of reusable and intuitive validation methods e.g less than, greather than, equals to etc on these common data types.


Motivation

In modern application development, data validation is an important aspect of data processing and storage. This ensures the reliability of and security of data in an applications. With this library, implementing validation logic becomes easier, reduce code duplication, and inconsistencies.

The motivation behind creating this library stems from the following challenges:

  1. Reusability: Less repetitive validation logic for common data types like strings, integers, and emails. This library provides a centralized and reusable solution for such validations.

  2. Readability: Validation logic can clutter the main application code, making it harder to read and maintain. Using this library, the code becomes cleaner and more readable because it allows focus on main appliaction.

  3. Flexibility: Applications often require custom validation rules that are specific to their domain.


Features

  • Includes common validators for strings, numbers, booleans, dates, emails, phone numbers etc.
  • Combine multiple or chained validation rules for a single field.
  • Provides error messages for invalid fields.

Example Usage

from ... import Valid, validate

validations = {
    "email": ("JohnDoe@email.com", [Valid.Email, Valid.NotEmpty]),
    "age": (25, [Valid.Int, Valid.GT(18)]),
    "username": ("johndoe", [Valid.String, Valid.Length(3, 15)]),
}

errors = validate(validations)

if errors:
    print( errors)
else:
    print("Valid!")

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

x24109487_validator-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

x24109487_validator-0.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file x24109487_validator-0.0.2.tar.gz.

File metadata

  • Download URL: x24109487_validator-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for x24109487_validator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7327e67e2b65666f8332748cea77eb1f13267019457d8a502242f9a2b2c28db0
MD5 deba58c2a3803f13127714dcb7cb462d
BLAKE2b-256 80b5fe46d5e8882597d97563b9698597a57d9775020d5d378a65dc81e81cb346

See more details on using hashes here.

File details

Details for the file x24109487_validator-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for x24109487_validator-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a4e23e49bd08b64097753db8cb6e35946b5c27b4f8a64779d412cbad0f87a1c
MD5 6270ad30851c9ae55ef727997812d917
BLAKE2b-256 96bc360fe59980b8b35d56e80074f38a330e7f2bf9a5e722f790672ac0d91eb7

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