Skip to main content

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


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
limier-0.0.2-py3-none-any.whl (8.1 kB) Copy SHA256 hash SHA256 Wheel py3
limier-0.0.2.tar.gz (6.0 kB) Copy SHA256 hash SHA256 Source None

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