Wisepy
RTPY is an intuitive and effective CLI framework which is scalable and practical.
The most common use case might be an alternative of Python’s argparser, also you can enrich your terminal commands by using wisepy.
The terminal utilities have been removed from wisepy. One project, one goal.
Install
pip install -U Redy rbnf wisepy
Usage
from wisepy.talking import Talking
talking = Talking()
@talking
def add(left: 'an integer', right: 'another integer'):
"""
add up two numbers.
"""
left = int(left)
right = int(right)
return left + right
if __name__ == '__main__':
talking.on()
And then use this python script:
cmd> python add --help # not only `cmd`, support all terminal as well.
add
add up two numbers.
- left(positional or keyword arg) : an integer
- right(positional or keyword arg) : another integer
cmd> python demo.py add 1 2
3
Another example here shows that wisepy can translate python functions with any kinds of parameter signatures into terminal command.
@talking.alias('sum')
def another(*args,
to_float: bool = False,
double=None,
additional_add: int = None):
"""
my sum command
"""
# using type annotation in keyword argument makes the argument
# cast to the specific type.
ret = sum(map(int, args))
if double:
ret = ret * 2
if to_float:
ret = float(ret)
if additional_add:
ret += additional_add
return ret
See terminal:
cmd> python demo.py sum --help
sum
my sum command
- args(*args)
- to_float(keyword only) = False : <class 'bool'>
- double(keyword only) = None
- additional_add(keyword only) = None : <class 'int'>
cmd> python demo.py sum 1 2 3
6
cmd> python demo.py sum 1 2 3 --double
12
cmd> python demo.py sum 1 2 3 -additional_add 5 --double --to_float
17.0
Metadata
Release files for wisepy 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wisepy-0.2.10-py3-none-any.whl | Python 3 | none | any | Details for wisepy-0.2.10-py3-none-any.whl |
Release files / wisepy-0.2.10-py3-none-any.whl
| Download URL | wisepy-0.2.10-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5a8ddb9f34a086ac5d636abce3db13238dce9794157d5ad8483f8b21b6e2349
|
|
BLAKE2b-256 checksum How to use checksums |
702da8dad34233af19d5f13e264b635474a85d26fffd2b3db91bd096d9bd228b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.6
|
Security for wisepy 0.2.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.