rdee-series toolkits: python-easyarg
Project description
rdee-python-easyarg
- Used to run any function with generic arguments from CLI
- Support two modes: CLI app or CLI executor
Install
pip install rdee-easyarg
Examples
CLI-app mode
- In this mode, we use a decorator to generate CLI interface automatically, mimicing typer in general
import easyarg
ea = easyarg.EasyArg()
@ea.command()
def f1(x: int, y: int):
print(x+y)
if __name__ == "__main__":
ea.parse()
- You can run the script directly, such as
./a.py f1 --x 1 --y 2, and get 3 -h/--helpfor app level and function level are both supported
CLI-executor mode
- In this mode, we can run a function without modifying any of its code
- For instance, given the
funcs.py
def add(x: int, y: int = 0) -> int:
print(x + y)
def mul(a: float, B: float, c: float = 1.0) -> float:
print(a * B * c)
- just run
python -m easyarg funcs.py add --x 1 --y 2to execute the function "add"
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
rdee_easyarg-25.1.16.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rdee_easyarg-25.1.16.tar.gz.
File metadata
- Download URL: rdee_easyarg-25.1.16.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00919ffc5537583d28db01ac3e02899fd1064abf959ecb4a0c6e104c1dfe0ae0
|
|
| MD5 |
a2dc219fcbd5ac5985a26bf048ad55e5
|
|
| BLAKE2b-256 |
d3227fd1b0ec80515fc1dc662b3eddb1f481ee60c584d20846b00a0b1f169cc2
|
File details
Details for the file rdee_easyarg-25.1.16-py2.py3-none-any.whl.
File metadata
- Download URL: rdee_easyarg-25.1.16-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7233ab16356a8135f150af02a25c07be7ef46662c879eddeaa6a6259ef28d409
|
|
| MD5 |
d84a24e5a2478d3c7e38285dda038345
|
|
| BLAKE2b-256 |
c8fc8825fce7cb2cb54d0d167488cbeb5d33bf3a17ba0edcd78aa7bdbaf3c115
|