InputPowertools
Eliminate the annoyances of getting input or building a cli in python!
Prolog
I love using command line interfaces and I think most people like building these small tools as well, but its really annoying to have to build the interface between the user and your program, hence I build this python package to take care of this part for you.
Installation
$ pip install InputPowertools
Examples
input()
Alpha
>>> print(f"Result: {input('Type your name:', Mode.ALPHA)}")
Type your name: >? 123
🛑 Please enter a value that is completely alphabetic (no punctuation, numbers, emojis or nothing)...
Type your name: >? Malte
Result: Malte
Numeric
>>> print(f"Result: {input('How old are you:', Mode.NUMERIC, domain=lambda x: x % 1 == 0)}")
How old are you: >? 😀
🛑 Please enter a number...
How old are you: >? 13.5
🛑 Please enter a value that fits the answers domain...
How old are you: >? 16
Result: 16
Options
>>> print(f"Result: {input('Are you a what kind of person are you?', Mode.OPTIONS, options=['Cat person', 'Dog person', 'Bird person'])}")
Are you a what kind of person are you?
1 -> Cat person
2 -> Dog person
3 -> Bird person
Select option [1-3]: >? Though question
🛑 Please enter a number...
Select option [1-3]: >? 0
🛑 Please enter a value that fits the answers domain...
Select option [1-3]: >? 4
🛑 Please enter a value that fits the answers domain...
Select option [1-3]: >? 2
Result: (1, 'Dog person')
Regex
>>> print(f"Result: {input('What is your favorite hex color?', Mode.REGEX, regex=r'(#([a-fA-F0-9]{6}|[a-fA-F0-9]{3}))', regex_description='Hexadecimal Color. Something like #123 or #FF32CD')}")
What is your favorite hex color? >? red
🛑 Please enter a value that fits this description: Hexadecimal Color. Something like #123 or #FF32CD
What is your favorite hex color? >? #F00
Result: #F00
Defaults
Just pressing enter
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}")
Type your name: (Hannes) >?
Result: Hannes
Typing something else
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, default='Hannes')}")
Type your name: (Hannes) >? Malte
Result: Malte
Confirm
>>> print(f"Result: {input('Type your name:', Mode.ALPHA, confrim=True)}")
Type your name: >? Malte
Do you want to select "Malte"?
1 -> yes
2 -> no
Select option [1-2]: (2) >? 1
Result: Malte
CLI
Guide
$ python examples/example\ 1.py
For more information: examples/example 1.py --help
Analysing the docstring and type hints to generate --help
$ python examples/example\ 1.py --help
Some function
A function that is truly amazing... wow!
Return: Some fascinating thing
Options:
--help
Prints out information about the program.
Type: bool
Default: False
--a
Is a variable called a
--b
Is a variable called b
Type: str
--c
Is a variable called c
Type: list
--d
Is a variable called d
Type: bool
Default: False
Analysing the function parameters to generate cli
$ python examples/example\ 1.py --a lol --b "this is a value with spaces" --c 4 2 "test123" --d
a='lol' b='this is a value with spaces' c=[4, 2, 'test123'] d=True
Metadata
Release files for InputPowertools 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| inputpowertools-1.0.4.tar.gz | 9.7 kB | Without provenance | Details for inputpowertools-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inputpowertools-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for inputpowertools-1.0.4-py3-none-any.whl |
Total release size: 16.3 kB
Release files / inputpowertools-1.0.4.tar.gz
| Download URL | inputpowertools-1.0.4.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fef8347ec7db44165683068906949ea81d658853fdb6e3ddc6f9ca7bbf03885e
|
|
BLAKE2b-256 checksum How to use checksums |
1ca34a746016f5422d188cfb09930b0708ee024ab4e126950478101d827ddc78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / inputpowertools-1.0.4-py3-none-any.whl
| Download URL | inputpowertools-1.0.4-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
186b9b34d0664a3840f3852620618d6099319e7730e1075973615f562543407b
|
|
BLAKE2b-256 checksum How to use checksums |
13bf46c34720ff157cd425d7a311d9f26b4f2fc6d6407a6d9596ba2fdbc9a0e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for InputPowertools 1.0.4
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.