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.

Files for limier, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size limier-0.0.2-py3-none-any.whl (8.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size limier-0.0.2.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page