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 details)
Built Distribution
File details
Details for the file limier-0.0.2.tar.gz
.
File metadata
- Download URL: limier-0.0.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21be88bd624e91ad7d754c2eb9d58af3f92aa9a9e7832f301b8a061fad51be76 |
|
MD5 | 6d1fd2ae45946eed787e88a2fc96a5e0 |
|
BLAKE2b-256 | 25f2be87806a327c85b6b6ec652bdc532466b112f2479064587494bacd3762c7 |
File details
Details for the file limier-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: limier-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4823f5bc6647e73f2f0952a5f87ebacaadd26b43b8b435ba97d5aab5b0e15b1e |
|
MD5 | 9c284c993b72e3a075079e8781fd7dbb |
|
BLAKE2b-256 | 8ad9c8e53c4750e79d71e263804620ec16fcc9cd0bd5c7b9b64a1bb8580a37a7 |