Framework for writing CLI application quickly
Project description
Clea - A lightweight framework for creating CLI applications in python
Clea is uses type annotations to generate the command/group defintions and parse the arguments at the runtime. To start with clea run
pip3 install clea
Define you first command using
from typing_extensions import Annotated
from clea.params import Integer
from clea.wrappers import command
@command
def add(
n1: Annotated[int, Integer()],
n2: Annotated[int, Integer()],
) -> None:
"""Add two numbers"""
print(f"Total {n1 + n2}")
Invoke the command at runtime using
from clea.runner import run
if __name__ == "__main__":
run(cli=add)
The example is taken from add.py in the examples folder.
You can check the command definition using
$ python add.py --help
Usage: add [OPTIONS] N1 N2
Add two numbers
Options:
--help Show help and exit.
Execute the command using
$ python add.py 2 3
Total 5
Read more about the usage of clea in the docs
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
clea-0.1.0rc4.tar.gz
(20.7 kB
view details)
Built Distribution
clea-0.1.0rc4-py3-none-any.whl
(22.8 kB
view details)
File details
Details for the file clea-0.1.0rc4.tar.gz
.
File metadata
- Download URL: clea-0.1.0rc4.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9d128bab506ab88bae384aa546ff26060e8a64075bffd7ff9e600007e76880d |
|
MD5 | 3f9b668dd9accfc38f0dce04bbe77f5f |
|
BLAKE2b-256 | a1b6ae418dbf3c37d54394787783879b5526e91ce7fc693c26b1c49ac9fc2d3c |
File details
Details for the file clea-0.1.0rc4-py3-none-any.whl
.
File metadata
- Download URL: clea-0.1.0rc4-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5220c52c698cd1936abbe01c5281ea3906bffbefd29e1ffdc913ef5c9b06f444 |
|
MD5 | 9feaef139b8467e0c54537cc1727b8e3 |
|
BLAKE2b-256 | 7a790bbb288f230bb3e7e320857214e59b2ac585722317596f904df3a8f1ddb0 |