Skip to main content

Strict hint

Strict hint provides a way to do runtime type checks based based on type hint annotations introduced by PEP-484.

Usage is quite simple, just add type annotations to a function or method and decorate it with @strict:

from strict_hint import strict

@strict
def add(a: int: b: int) -> int:
    return a+b

If non int will be passed, a TypeError will be raised. Same will happen if function would return different type than expected.

Type checks support (for arguments and returned values):
  • all primitive type hints: int, float, list, tuple, set, dict, etc.,

  • standard interpreter types eg.: FunctionType and other,

  • tuples of types, eg: (int, float) will allow for both types to be accepted,

  • default values, also of different type than annotation: eg. a: int = None

  • used defined classes and class inheritance

Metadata

Release files for strict-hint 0.3.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 strict-hint 0.3.0
File Size Uploaded Provenance Actions
strict-hint-0.3.0.tar.gz 2.8 kB Without provenance Details for strict-hint-0.3.0.tar.gz

Release files / strict-hint-0.3.0.tar.gz

Download URL strict-hint-0.3.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e26f6067514eb383a59b28627a592f36afb7a2ff19d8364fedcb15075d8096a0
BLAKE2b-256 checksum
How to use checksums
f055b07238c96085d15acc9b91b52b7e4a641b9d5cc0384aef2da6bdb36c3930
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for strict-hint 0.3.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