Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Strict type runtime checks for arguments and return types.

Project Description

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
Release History

Release History

This version
History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
strict-hint-0.2.0.tar.gz (2.2 kB) Copy SHA256 Checksum SHA256 Source Mar 1, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting