Skip to main content

Type Enforcer

add as a decorator to any python function to enforce type hints, turning python functions from dynamically to statically typed in the runtime.

Enforces python type hints. Parameters and returns that do not have explicit hints will be assumed to have types of typing.Any Supports basic type hinting operations, like Type[], Union[], and GenericAlias objects like dict[] and list[]

Supports recursive type checking in runtime! If you want to check that the contents in a deep nested datastructure match type hints, just enable recursive type checking with "recursive=True". Note that this significantly increases the computation necessary to run functions so it is advisable to only run this during the debugging phase of development. Note that as of now this only works with lists, tuples, sets, and dicts

Overall, best used with debugging

Install

  1. pip install TypeEnforcer
  2. from TypeEnforcer.TypeEnforcement.type_enforcer import TypeEnforcer
  3. @TypeEnforcer.enforcer

Metadata

Release files for TypeEnforcer 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TypeEnforcer 1.5.0
File Size Uploaded Provenance Actions
TypeEnforcer-1.5.0.tar.gz 5.1 kB Without provenance Details for TypeEnforcer-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for TypeEnforcer 1.5.0
File Interpreter ABI Platform Actions
TypeEnforcer-1.5.0-py3-none-any.whl Python 3 none any Details for TypeEnforcer-1.5.0-py3-none-any.whl

Total release size: 11.7 kB

Release files / TypeEnforcer-1.5.0.tar.gz

Download URL TypeEnforcer-1.5.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aeaa24dee13982345945411a9fa1e8a66a2e0d218cf4e8fb9ebc4e544bfa3cdf
BLAKE2b-256 checksum
How to use checksums
cc0b1f2d8eac4683419d8ab89f0ebe0d105ec1b9f0b271dcee214bd08a703886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / TypeEnforcer-1.5.0-py3-none-any.whl

Download URL TypeEnforcer-1.5.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fe7d379f2eca81556f2f18ca9c6efea7a0732976e25f9c11b0d9d76510ba920
BLAKE2b-256 checksum
How to use checksums
ddcbabb048cddbfb27cc775a01256c60b9016b34784b879f8f6c06e5e8d368d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for TypeEnforcer 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page