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.1.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.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: x24109487_validator-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8b5c8fe283efaad6388f64aaa308225dad1895048ceb60bb36721766cd2e43e9
MD5 0def240585a0b5d9efa5a1c36468513f
BLAKE2b-256 42fd610492c2a997aacdb698bb2648691e0b082042231a5bc600f4eb390d5b41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for x24109487_validator-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03b3445fbbfe0997ddc2a6d1a09937ec292a182c1445322851a61c59ec342075
MD5 ad6be7bd141e53afcc346edd7533c935
BLAKE2b-256 7cfb4f46dead9e1265181664bf977fb4bac0d6e9c296aa676a41e9d2a7b53275

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