Skip to main content

AskRow — Simple, Safe User Input for Python

PyPI Version Python Versions

AskRow is a beginner-friendly Python library that makes handling user input easy, clean, and reliable. It replaces Python's built-in input() with a smarter, more structured approach that automatically validates data, handles errors, and ensures users provide the correct input without writing repetitive code.

Installation

pip install askrow-py

Features

  • Type-safe input - Get integers, floats, text, booleans with automatic type conversion
  • Built-in validation - Validate ranges, length, patterns, and email formats
  • Automatic retry - Re-prompts users when invalid input is entered
  • Clear error messages - Friendly, human-readable error messages
  • Simple API - Minimal, intuitive design for beginners
  • Password input - Hidden password entry
  • Choice menus - Select from a list of options
  • Form builder - Collect multiple fields at once
  • Confirm dialogs - Yes/No confirmation and value matching
  • File picker - Validate file paths with extensions

Quick Start

from askrow_py import ask

age = ask.int("Enter your age: ", min_value=0, max_value=120)
name = ask.text("Enter your name: ", min_length=1, max_length=50)
email = ask.email("Enter your email: ")
is_student = ask.bool("Are you a student? (yes/no): ")

API Reference

ask.text(prompt, min_length, max_length, pattern, required)

Get text input with optional validation.

name = ask.text("Enter your name: ", min_length=2, max_length=50)

ask.int(prompt, min_value, max_value)

Get integer input with optional range validation.

age = ask.int("Enter your age: ", min_value=0, max_value=120)
score = ask.int("Enter your score: ", min_value=0, max_value=100)

ask.float(prompt, min_value, max_value)

Get float input with optional range validation.

price = ask.float("Enter price: ", min_value=0.0)
height = ask.float("Enter height (cm): ", min_value=0, max_value=300)

ask.bool(prompt, true_values, false_values)

Get boolean input with customizable true/false values.

is_active = ask.bool("Is active? (yes/no): ")

ask.email(prompt)

Get validated email address.

email = ask.email("Enter your email: ")

ask.password(prompt, min_length, max_length)

Get hidden password input.

password = ask.password("Enter password: ", min_length=8)

ask.choice(prompt, options, case_sensitive)

Select from a list of options.

color = ask.choice("Choose color: ", options=["red", "green", "blue"])
day = ask.choice("Choose day: ", options=["Monday", "Tuesday", "Wednesday"])

ask.confirm(prompt, default) or ask.confirm(prompt, match=value)

Get yes/no confirmation OR confirm if input matches a value.

# Yes/No confirmation
if ask.confirm("Delete file?", default=False):
    print("File deleted")

# Password confirmation (match two inputs)
password = ask.password("Enter password: ", min_length=8)
confirm = ask.confirm("Confirm password: ", match=password)

ask.menu(prompt, options)

Display a numbered menu and get user selection.

choice = ask.menu("Select option:", ["Create Project", "Run App", "Exit"])
print(f"You chose: {choice}")

ask.file(prompt, exists, extensions, must_be_file, must_be_dir)

Get file path with validation.

file_path = ask.file("Select file:", exists=True, extensions=[".json", ".txt"])

ask.form(fields)

Collect multiple fields in a single form.

user = ask.form([
    {"name": "name", "type": "text", "message": "Name:"},
    {"name": "age", "type": "int", "message": "Age:"},
    {"name": "email", "type": "email", "message": "Email:"},
    {"name": "password", "type": "password", "message": "Password:"}
])
print(user)  # {"name": "John", "age": 25, "email": "john@example.com", "password": "..."}

License

MIT License

Metadata

Release files for askrow-py 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for askrow-py 1.0.0
File Size Uploaded
askrow_py-1.0.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for askrow-py 1.0.0
File Interpreter ABI Platform
askrow_py-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / askrow_py-1.0.0.tar.gz

Download URL askrow_py-1.0.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0a048dc7c93d42a563fc9b8481719e87e561375638fab823d5449ead1cc9c298
BLAKE2b-256 checksum
How to use checksums
edbae47cb4226b51fcd32b51be302e2d0921a37370ba5bdb87f7ba31afbbfd85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release files / askrow_py-1.0.0-py3-none-any.whl

Download URL askrow_py-1.0.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c254ea0618acecb585f8b711868b80ec3631247dfd75f76abc01f378d544589d
BLAKE2b-256 checksum
How to use checksums
cf3562df251044bfc085c81a78781ab8c2d09e801c4c358283403cf13f0823a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page