Smart conversion and validation toolkit powered by type annotations
Project description
Limier
Limier is a smart Python conversion and validation toolkit powered by type annotations.
It is especially handy to automatically cast parameters passed to functions. A typical use case is processing route parameters in the context of web routing.
Install
Limier is released to PyPI and can be installed using pip
:
pip install limier
Basic usage
from limier import deduce, 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
@deduce
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.1.tar.gz
(6.7 kB
view details)
Built Distribution
File details
Details for the file limier-0.0.1.tar.gz
.
File metadata
- Download URL: limier-0.0.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 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 | f9081bdb514901f885924dc1d4f5b5c7e8f993a75bf1f914ad7a70220cc700c8 |
|
MD5 | 9e32459a1d019861a4a41e80b9fa80e9 |
|
BLAKE2b-256 | b6a2d772921408cbb73e9f6e534a97b1c3e94a08f5affc700dd13072ffa5ebb7 |
File details
Details for the file limier-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: limier-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 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 | 91ee975023a37cb5ca0fb9aded9aafe7c2c70a94ac9efec6c744184af5cc7cad |
|
MD5 | f4102ce1153fbd6c14dff228ecfd0973 |
|
BLAKE2b-256 | aba68e7920de06a0999d00c1ad5cc2a2ad448e0d23a930bfd4e15d3d900d553f |