Skip to main content

IntputLib

PyPI PyPI Downloads

Because typing int(input()) everywhere is a rite of passage we'd rather skip.

⚠️ Disclaimer: This started as a joke among friends after someone accidentally typed intput. Don't take it too seriously.


What is this?

IntputLib is a tiny Python library designed to save you from the repetitive strain of capturing numerical input from users. It handles the boring try-except loops so you can focus on the fun parts of your code.

No more writing this masterpiece of error-handling over and over again:

while True:
    try:
        x = int(input("Enter a number: "))
        break
    except ValueError:
        print("Invalid input. Please enter a number.")

Installation

Just a simple pip install away (if only everything in life were this easy):

pip install intputlib

Usage

Here’s how you can reclaim your time and sanity.

Basic Integer Input

Use intput() as a smarter, more patient version of int(input()).

from intputlib import intput

age = intput("Enter your age (or fake it, we won't judge): ")
print(f"You are {age} years old!")

Integer Input with a Custom Error Message

Tired of the generic "invalid input"? Give your users a custom message.

from intputlib import intput

score = intput("Enter your score: ", error_msg="Come on, numbers only!")
print(f"Your score: {score}")

Integer Input within a Range

Keep your users in line by specifying a minimum and maximum value.

from intputlib import intput_range

level = intput_range("Choose a level (1-10): ", min_val=1, max_val=10)
print(f"You selected level {level}!")

Custom Error Message for Range Input

You can also customize the error message for out-of-range inputs.

difficulty = intput_range(
    "Select difficulty (1-5): ",
    min_val=1,
    max_val=5,
    error_msg="Oops! Only numbers between 1 and 5 are allowed."
)
print(f"Difficulty set to {difficulty}")

Basic Float Input

For when you need those decimal points.

from intputlib import floatput

height = floatput("Enter your height in meters (e.g., 1.75): ")
print(f"Your height: {height} m")

Features

  • Simplified Input: Read integers and floats with a single, clean function call.
  • Hassle-Free Validation: Automatically handles ValueError and keeps asking until a valid number is entered.
  • Range Enforcement: Easily restrict integer inputs to a specified range.
  • Customizable Prompts: Tailor your input prompts and error messages.
  • No More Crashes: Saves your scripts from the dreaded ValueError when a user types "abc" instead of "123".

Why Use This?

Because life is too short to write the same validation loop for the hundredth time. Let intput() handle the nagging for you, so you can get back to building amazing things.


License

MIT License. Because sharing is caring.


https://github.com/KaykCaputo/Intput-Lib

Metadata

Release files for intputlib 1.1.4

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

Source distribution (sdist)

Source distribution for intputlib 1.1.4
File Size Uploaded Provenance Actions
intputlib-1.1.4.tar.gz 3.7 kB Without provenance Details for intputlib-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for intputlib 1.1.4
File Interpreter ABI Platform Actions
intputlib-1.1.4-py3-none-any.whl Python 3 none any Details for intputlib-1.1.4-py3-none-any.whl

Total release size: 7.9 kB

Release files / intputlib-1.1.4.tar.gz

Download URL intputlib-1.1.4.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
15863004ef58636914c105f937edcca55e9cec2e24c8aa308eb67285282b43ca
BLAKE2b-256 checksum
How to use checksums
e10d2821cf21b8840280a58c50034acacfb164991bbaeabcfee63ece0bf66fee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / intputlib-1.1.4-py3-none-any.whl

Download URL intputlib-1.1.4-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3510224931b5492927123128c7cd49830835fa8e7df92bd380cefff7e685ea45
BLAKE2b-256 checksum
How to use checksums
69cffc65cac6ed0084afbd5dac06dff6acc900a094a26434a343bd2b6a2e9478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for intputlib 1.1.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.

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files No provenance

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