Skip to main content

A package for a domain-centric predefined set of value objects.

Project description

zpyval - Python Value Validator

Overview

zpyval is a Python package designed to facilitate the validation of various types of values in Python programs. It provides a simple and intuitive interface to validate inputs according to specified criteria, allowing developers to ensure data integrity and consistency within their applications.

Installation

You can install zpyval via pip:

pip install zpyval

Usage

Using zpyval is straightforward. Simply import the required Value class you need and instantiate it with the real value. It checks the validation criteria on the fly. Returns object if validation passes otherwise raises a ValueError with the corresponding message.

Here's a basic example:

from zpyval.value import Username, Age, Gender

class User:
    def __init__(self, username, age, gender):
        self.username = username
        self.age = age
        self.gender = gender

user = User(Username('zatha'), Age(23), Gender('male'))

print(user.username.value, user.username()) # get value by property or __call__
print(user.gender())
print(user.age(), user.age.is_adult())

You don't need to worry about data validation and constraints at any point. Additionally, it offers special value object-based utility methods.

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

zpyval-0.1.0.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

zpyval-0.1.0-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page