Typing-validation

Latest version: v1.2.11.post1

Safety actively analyzes 625610 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

1.2.11

**Full Changelog**: https://github.com/hashberg-io/typing-validation/compare/v1.2.10...v1.2.11

1.2.10

Introduced partial support for validation against `Type[T]` (see 18 for limitations of the current implementation).

1.2.9

Introduce support for `TypeVar`.

1.2.8

**Full Changelog**: https://github.com/hashberg-io/typing-validation/compare/v1.2.7...v1.2.8

1.2.7

Added support for NumPy [`dtype`](https://numpy.org/doc/1.21/reference/arrays.dtypes.html#arrays-dtypes) annotations in [`NDArray`](https://numpy.org/devdocs/reference/typing.html#numpy.typing.NDArray) types.

1.2.6

Changed the return type of ``validate`` from ``None`` to ``Literal[True]``, so that validation calls can be gated behind assertions and compiled away in optimised scenarios:

py
from typing_validation import validate

assert validate(val, t) this is compiled away with -O or -OO


Introduced a variant ``is_valid`` of ``validate`` which returns a ``bool``:

py
from typing_validation import is_valid

if is_valid(val, t):
... do stuff
else:
... handle error


In case of validation failure, failure information is made available using ``latest_validation_failure``:

py
from typing_validation import is_valid, latest_validation_failure

if is_valid(val, t):
... do stuff
else:
cause = latest_validation_failure()
... handle error

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.