askput
askput is a lightweight Python library for safe, validated, and interactive console input.
It removes repetitive input-validation logic and helps you build clean, readable CLI programs with minimal effort.
Why askput?
Python’s built-in input():
- always returns strings
- provides no validation
- leads to repeated
try / exceptblocks
askput offers a clean abstraction over these problems while staying simple and dependency-free.
Features
- Integer and float input with bounds
- String length validation
- Email validation
- Secure password input
- Strong password rules
- Yes/No confirmations
- Phrase-based confirmation for dangerous actions
- Menu-based choice selection
- Regex (pattern) based input
- Multiple values input
- Fully tested with
pytest - Zero external dependencies
Installation
pip install askput
Usages
Basic Usage
from askput import ask
age = ask.int("Enter age", min=18)
price = ask.float("Enter price", min=0)
name = ask.string("Enter name", min_len=2)
email = ask.email("Enter email")
print(age, price, name, email)
Passwords and Confirmations
from askput import ask
age = ask.int("Enter age", min=18)
price = ask.float("Enter price", min=0)
name = ask.string("Enter name", min_len=2)
email = ask.email("Enter email")
print(age, price, name, email)
from askput import ask
password = ask.password("Enter password")
strong_password = ask.password_strong("Create strong password")
confirm = ask.confirm("Continue?")
delete = ask.confirm_phrase("Type DELETE to continue", "DELETE")
Choice / Menu Input
from askput import ask
role = ask.choice(
"Select role",
["Admin", "User", "Guest"]
)
print("Selected role:", role)
##Pattern and Multiple Input
from askput import ask
code = ask.pattern("Enter code", r"^[A-Z]{3}\d{3}$")
tags = ask.multi("Enter tags (comma separated)")
print(code, tags)
Example: Simple CLI Flow
from askput import ask
role = ask.choice("Role", ["Admin", "User"])
age = ask.int("Age", min=18)
password = ask.password_strong("Password")
if ask.confirm("Submit form?"):
print("Form submitted")
Testing
askput is fully tested using pytest.
pytest
All tests are before every release.
Metadata
Release files for askput 0.1.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 | |
|---|---|---|---|---|
| askput-0.1.5.tar.gz | 5.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| askput-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / askput-0.1.5.tar.gz
| Download URL | askput-0.1.5.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d11f1d2fff9f5a037de2de093cb197be6e1292e0fcaa8d228b2a30b7d82fffde
|
|
BLAKE2b-256 checksum How to use checksums |
c17f56ddf7c493d1a9f76197a74ab2cd39cec43a74a37d4a75fa7a43d10728b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.7
|
Release files / askput-0.1.5-py3-none-any.whl
| Download URL | askput-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a18119ce27ce0a131205eda5cde785024cf6225006af6961c65779d5f2a50c32
|
|
BLAKE2b-256 checksum How to use checksums |
7032648d315508b60cbbfd440f7095c575d235075ff86e3bc73db9ac920899ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.7
|
Security for askput 0.1.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.