Skip to main content

A Python 3 easy to use runtime typechecker

Project description


An easy-to-use Python 3 runtime typechecker.


The typical usage for this decorator would be something like this:

def foo(i: int) -> bool:
return a > 0

def to_int(*, s: by_regex("^[0-9]+$")) -> int:
return int(s)

def set_debug_level(self, level: optional(one_of(1, 2, 3)) = 2):
self._level = level

This recipe is extensible with callable predicates, such as

is_even = lambda x: x % 2 == 0

def multiply_by_2(i: int) -> is_even:
return i * 2


The code was written by Dmitri Dvoinikov and maintained by Esteban Ordano
(@eordano on twitter).

Original link:

Project details

Release history Release notifications

This version
History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
typecheck3-0.1.0-py3.3.egg (1.4 kB) Copy SHA256 hash SHA256 Egg 3.3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page