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 details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file zpyval-0.1.0.tar.gz.

File metadata

  • Download URL: zpyval-0.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.11 Windows/10

File hashes

Hashes for zpyval-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62b90c111bc74a8304462d8fdc1b89732e1ab6c5c508eda173c4755215daddb5
MD5 bc83360c1875251e8e6ec0023e0c9f55
BLAKE2b-256 194623c2c5919a80d4a432b1a0a18804e69aa34c65d4f4a4dd61316903635461

See more details on using hashes here.

File details

Details for the file zpyval-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zpyval-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.11 Windows/10

File hashes

Hashes for zpyval-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82d805894ec0173de6306d6533cdfec8b106d5378a4319361c2693d5adb60d75
MD5 a646a4ac004345cc0fc558efd0b83605
BLAKE2b-256 a41dce4e3f7dc8c55bdea0198b543f84703c4cf1ef35aced1fa433509485b075

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