UpgradedInput
A better, minimal input() wrapper for python
Features compared to python's default input()
- Supports hooks for functions (Before and after input, on exception and on runtime error)
- Supports automatic conversion with validation (With hooks too! Read docs)
How to use
Install the module
pip install UpgradedInput
Use the module Example:
from UpgradedInput import UpgradedInput, InputTypes
# initialize
inp = UpgradedInput()
# Example of hooks (All of them can be left at the dafult state (None))
def before():
print("Before!")
def after():
print("After!")
def exception():
print("Exception!")
def runtime_error():
print("Runtime error!")
def invalid_user_input(text):
print(text)
return None
# Initialize the hooks
inp.before_input_function = before
inp.after_input_function = after
inp.end_of_file_input_function = exception
inp.runtime_error_function = runtime_error # say we lost sys.stdin or something else that triggers a runtime error
inp.invalid_user_input_function = invalid_user_input
print(inp.input()) # final call to the wrapper
print(inp.input(prompt="insert text: ")) # supports prompt (from input)
# in case the automatic conversion fails, in this example it calls invalid_user_input
# which prints what the user typed, and returns None (REFER TO DOCUMENTATION!!!!!!!!)
print(inp.input(type=InputTypes.INTEGER)) # supports automatic conversion!
print(inp.input(type=InputTypes.FLOAT)) # floats
print(inp.input(type=InputTypes.BOOL)) # booleans
Testing
Run this command to install the testing suite:
pip install pytest pytest-ordering
Then simply run in the root directory:
pytest
Metadata
Release files for UpgradedInput 0.0.8.5
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 | |
|---|---|---|---|---|
| upgradedinput-0.0.8.5.tar.gz | 5.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| upgradedinput-0.0.8.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / upgradedinput-0.0.8.5.tar.gz
| Download URL | upgradedinput-0.0.8.5.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c337b133304f85da0ad31c4f5f9e09114fbb0d4ab59de2fdb27d8b79629e6de3
|
|
BLAKE2b-256 checksum How to use checksums |
f4591fa14ef09ce8c69536d9aa737054e4e1c21fcece9172a1792354fb7c5855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / upgradedinput-0.0.8.5-py3-none-any.whl
| Download URL | upgradedinput-0.0.8.5-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ee609d42f3fe6aead3a12bd45b0e66bd8d2ed033912f7326444e4c5597fd724
|
|
BLAKE2b-256 checksum How to use checksums |
b78059ce9f2af97fb4cc88c0dcd9dda4d94d262bc7f60cbbb5bd27299998a179
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for UpgradedInput 0.0.8.5
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.