Skip to main content

Validation utilities

Project description

Documentation Status

easyvalidate

A Python package containing utilities for different types of validations:

  • Validation of types
  • Validation of values based on various conditions

Installation

You can install the package from PyPI using pip:

$ pip install easyvalidate

Feature Highlights

Typehint Validation

The package contains a decorator: validate_types(). Add it to any function you want to validate types for, but make sure you have type hints on your function:

import typing

from easyvalidate import validate_typehints

@validate_typehints()
def foo(x: int, y: typing.Union[int, str]):
    print(x, y)

foo(5, 10) # works
foo(5, 'hello!') # also works
foo(5, []) # error!

The decorator comes with a few arguments:

  • all: bool = True: whether to require that all arguments (except self) are type-hinted. It's enabled by default.
  • deep: bool = False: whether to recursively validate all members of collections passed to the function. This can be painfully slow on large datasets so it's disabled by default.

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

easyvalidate-0.0.2.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

easyvalidate-0.0.2-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easyvalidate-0.0.2.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for easyvalidate-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0a51954ad292c48d564e7174e4e2b7ee8b561b14b4782b7819931d16bd1197f6
MD5 316ac9d7fb9d636b6d877fcab32de01d
BLAKE2b-256 26f166ad0ace21409bb7030b784046b17dc8aa79f7c84446d0306d9b18b8a9b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easyvalidate-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for easyvalidate-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa6ef98361153abc2376c9726b1d0f4b41d859a447b97408e96d165484ec3395
MD5 dcde0636791a6cc28d170835bb104079
BLAKE2b-256 4ece758dadee6400dc4908d27e0c10ce6f7a261946a6af01234fbe353e713717

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