Skip to main content

A library for easy input validation with kwargs

Project description

inp_kwargs

Easily validate user inputs with Python, no hassle required!

A Python library for easy input validation using kwargs. This library helps to easily validate inputs such as integers, strings, and more, without needing to write complex validation logic.

Example

Validating an Integer Input

from inp_kwargs import input_int

# Request a number between 1 and 100
number = input_int("Enter a number between 1 and 100: ", 
                   error_txt="Error: You have to input an integer.",
                   min_value=1, 
                   error_min="Error: The number must be greater than or equal to 1.",
                   max_value=100, 
                   error_max="Error: The number must be less than or equal to 100.")

print(f"You entered: {number}")

# Request a number between 1 and 100 without custom error messages
number = input_int("Enter a number: ", min_value=1, max_value=100)
print(f"You entered: {number}")

Features

  • Validate integer inputs with custom error messages.
  • Set minimum and maximum value constraints.
  • Simple and reusable functions for input validation.

Installation

You can install inp_kwargs directly from PyPI:

pip install inp_kwargs

License

MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inp_kwargs-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file inp_kwargs-0.1.0.tar.gz.

File metadata

  • Download URL: inp_kwargs-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.0

File hashes

Hashes for inp_kwargs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f6c0629f76bb055ab100629c537a64acfac992e71fc13f02c77d8567a910d6d
MD5 9b4ab833a48f52c9da6d72c497f14e5f
BLAKE2b-256 9c17bccb44b997bc7c83398fa3970df75f7e3c968c056a392025360e4e4af3bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page