Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typy

Static Typing in Python without the Type Annotation Syntax
Version: 1.1

Description

This light-weight library provides decorators and functions that can be used to implement statically-typed behaviour in Python projects without needing the type annotation syntax. Works with built-in as well as custom classes. Decorators can be used together or stand alone.

Example Usage

from typy import *

class Bar():
	@argtype(s=str)
	def __init__(self, s):
		self.s = s

@argtype(a=int, b=int, c=Bar)
@returntype(float)
def foo(a, b, c):
	return a / b

bar = Bar('test')
print(foo(6, 3, bar))

x = vartype(int, 5)
y = vartype(Bar, Bar('test'))

About

Add static typing to Python projects without the type annotation syntax

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages