Smart toolkit for conversion and validation of function arguments powered by type annotations
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
limier-0.0.2.tar.gz
(6.0 kB
view hashes)
Built Distribution
limier-0.0.2-py3-none-any.whl
(8.1 kB
view hashes)