func-validator
MATLAB-style function argument validation for Python - clean, simple, and reliable.
Table of Contents
Installation
pip install func-validator
Imports
-
Import for the function decorator
from func_validator import validate_params
-
Import for the validators
from func_validator import MustBeGreaterThan, MustMatchRegex from func_validator.validators.numeric_arg_validators import MustBeGreaterThan
There are 3 other modules you can import validators from, namely:
Usage
from typing import Annotated
from func_validator import validate_params
from func_validator.validators.numeric_arg_validators import (MustBePositive,
MustBeNegative)
@validate_params
def func(a: Annotated[int, MustBePositive()],
b: Annotated[float, MustBeNegative()]):
return (a, b)
func(10, -10) # ✅ Correct
func(-10, -10) # ❌ Wrong -10 is not positive and 10 is not negative
# A validation error is raised with a message.
func(0, -10) # ❌ Wrong 0 is not positive
# A validation error is raised with a message.
func(20, 10) # ❌ Wrong 10 is not negative
# A validation error is raised with a message.
Validators
This is not the exhaustive list for all validators, checkout the docs for more examples.
Collection Validators
| MustBeMemberOf | Validate that argument value is in a collection |
| MustBeEmpty | Validate that argument value is empty |
DataType Validators
| MustBeA | Validates that the value is of the specified type |
Numeric Validators
| MustBePositive | Validate that argument value is positive |
| MustBeNegative | Validate that argument value is negative |
Text Validators
| MustMatchRegex | Validates that the value matches the provided regular expression. |
Dependent Argument Validator
| DependsOn | Validates that the value of one argument depends on the value or presence of another argument. |
License
MIT License
Metadata
Release files for func-validator 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| func_validator-1.5.0.tar.gz | 14.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| func_validator-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / func_validator-1.5.0.tar.gz
| Download URL | func_validator-1.5.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2775d0a68eb11b41e1b71303c61916e479b9a55ab36bfdbc6ca66810a0b4c875
|
|
BLAKE2b-256 checksum How to use checksums |
096f791ea6c6665f78dafec9c995c2837a0b8fd11ff5f569352b220e217c515e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logRelease files / func_validator-1.5.0-py3-none-any.whl
| Download URL | func_validator-1.5.0-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10d28bc89550ca83e17fe9646b43037ed3f16a8b0aeb5339827a67b82994a190
|
|
BLAKE2b-256 checksum How to use checksums |
d189d92fff7536cc4d86755a62d9cd2ed09b666ad0deab545aebd0019436898b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logSecurity for func-validator 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for func_validator-1.5.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.