Skip to main content

A runtime strict type-checking module for Python designed to validate parametrized (nested) types.

Project description

Nested Type Checker (Beta)

A runtime strict type-checking module for Python, designed to validate parametrized (nested) types. It supports both Python built-in types and custom types.

Example Usage

To check if an object matches a specified parametrized type, use the function is_object_of_type(your_obj, your_type):

from nested_type_checker import is_object_of_type

obj = [123, ({"": True},)]

CorrectType = list[int | tuple[dict[str, bool]]]
WrongType = list[bool | tuple[dict[str, bool]]]

a = is_object_of_type(obj, CorrectType)
b = is_object_of_type(obj, WrongType)

print(a)  # outputs True
print(b)  # outputs False

Support

The module can validate parametrized types of data, such as mappings, tuples, lists, sets, frozensets, callables, unions, optionals, as well as any other unparametrized types, including the custom ones.

Installation

To install, use Python's pip package manager:

pip install nested_type_checker

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

nested_type_checker-0.9.7.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

nested_type_checker-0.9.7-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file nested_type_checker-0.9.7.tar.gz.

File metadata

  • Download URL: nested_type_checker-0.9.7.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for nested_type_checker-0.9.7.tar.gz
Algorithm Hash digest
SHA256 5957fa2f0bf51bd4978e53f5758183bf63efc98a77cc11ed59c4782a8a524cb1
MD5 f6b8c63e5ee6cc4af8d7a59e5a1ce2d5
BLAKE2b-256 12b9b0da431177c995ff0ac289745975d894f4c0324ee145edef918303325d72

See more details on using hashes here.

File details

Details for the file nested_type_checker-0.9.7-py3-none-any.whl.

File metadata

File hashes

Hashes for nested_type_checker-0.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 deba2bc1956d5f420842d05d4f78d96dd3e7823536ef4bf332b8b017a657cc29
MD5 15cc8f11f00648dca8f4a458d77a6737
BLAKE2b-256 af6539c7a3601cc3ad77e786133153fc8fc08c9926b7344aef8fa89ee4d62703

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