Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.
/ limier Public archive

Smart conversion and validation toolkit powered by type annotations

License

Notifications You must be signed in to change notification settings

florimondmanca/limier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Limier

Limier is a smart toolkit for conversion and validation of function arguments in Python powered by type annotations.

A typical use case is the conversion of route parameters in the context of web routing.

Install

pip install limier

Basic usage

from limier import converted, chain

# Custom converter: validate that the input value is positive
def positive(value: int) -> int:
    if value < 0:
        raise ValueError("Expected positive value")
    return value

@converted
def compute(x: int, times: chain(int, positive)) -> float:
    return x * times

result = compute("2", times="2.5")
assert result == 5

About

Smart conversion and validation toolkit powered by type annotations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages