Skip to main content

MATLAB-style function argument validation for Python - clean, simple, and reliable.

Project description

func-validator

PyPI Latest Release PyPI pyversions license

MATLAB-style function argument validation for Python.

Installation

$ pip install func-validator

Usage

from typing import Annotated
from func_validator import (validate_func_args_at_runtime, MustBePositive,
                            MustBeNegative)


@validate_func_args_at_runtime
def func(a: Annotated[int, MustBePositive],
         b: Annotated[float, MustBeNegative]):
    pass


func(10, -10)  # ✅ Correct
func(-10, 10)  # ❌ Wrong -10 is not positive and 10 is not negative
func(0, -10)  # ❌ Wrong 0 is not positive

License

MIT License

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

func_validator-0.8.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

func_validator-0.8.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file func_validator-0.8.0.tar.gz.

File metadata

  • Download URL: func_validator-0.8.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for func_validator-0.8.0.tar.gz
Algorithm Hash digest
SHA256 14fda437ac4e63d08a8efbab36a9d0bba017ad4d0ab6ac1a4883e429d04d973f
MD5 6ad61abb66ddda2effc35d04bf2d069d
BLAKE2b-256 fcc981e788a967b2687b97635c5e6823824a1732e12908e6b307c31448d62442

See more details on using hashes here.

Provenance

The following attestation bundles were made for func_validator-0.8.0.tar.gz:

Publisher: func-validator-publish.yml on patrickboateng/func-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file func_validator-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: func_validator-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for func_validator-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc405b08465883cffc603377ea2623e1e708d4dabd6a0a2e673ffbe36a11f09
MD5 87c9f9b7ea0d70ba10f86afbfb9c9c81
BLAKE2b-256 9435c2c0434b71c54e086aef74b9b5e1c314e6a58f26429a91c3e8dbe1e52296

See more details on using hashes here.

Provenance

The following attestation bundles were made for func_validator-0.8.0-py3-none-any.whl:

Publisher: func-validator-publish.yml on patrickboateng/func-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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