Skip to main content

A modular Python library designed to simplify secure and flexible user input

Project description

Matheric

A modular Python library designed to simplify secure and flexible user input.

Matheric provides advanced console input utilities with built-in validation, retry systems, type checking and optional confirmation protocols.

✅ Features

  • Secure and validated user input
  • Automatic retry on invalid input
  • Built-in type verification
  • Integer and float range control
  • String length validation
  • Optional input confirmation system
  • Custom exception messages
  • Modular architecture

📦 Installation

Bash

pip install matheric

💡 Quick Example

Python

from matheric import secureinput

age = secureinput(
    "Enter your age: ",
    type="int",
    min=0,
    except_msg = Please enter a valid age
)

print(age)

Supported Types

Matheric currently supports:

  • "string"
  • "int"
  • "float"

String Validation

Python

name = secureinput(
    "Enter your name : ",
    type="string",
    str_min=3,
    str_max=20
)

The msg can be ommitted if it is placed first

Integer Validation

Python

number = secureinput(
    "Enter a number : ",
    type="int",
    min=1,
    max=10
)

Float Validation

Python

price = secureinput(
    msg="Enter the price : ",
    type="float",
    min=0
)

Input Confirmation System

Python

password = secureinput(
    msg="Enter password : ",
    type="string",
    validation=True
)

The validation system allows the user to confirm the entered value before final submission.

⚙️ Parameters

Parameter type Description Default Value
msg string Message displayed before input ""
type string / int / float Expected input type (string, int, float) string
max int / float Maximum allowed numeric value NotDefined
min int / float Minimum allowed numeric value NotDefined
str_length int Exact required string length Any
str_max int Maximum allowed string length NotDefined
str_min int Minimum allowed string length NotDefined
except_msg string Message displayed on invalid input type ERROR
validation bool Enables validation protocol False
validation_msg string Validation confirmation message Enter 1 to confirm the input
validation_caractere string / int / float Value required to validation input 1

💡 Example With Validation

Python

from matheric import secureinput

code = secureinput(
    msg="Enter access code : ",
    type="string",
    str_length=6,
    validation=True,
    validation_msg="Confirm the code [y/N] "
    validation_caractere="y"
)

Project Structure

matheric/
│
├── pyproject.toml
├── README.md
├── LICENSE
│
└── src/
    └── matheric/
        ├── __init__.py
        │
        ├── secure_input/
        │   ├── __init__.py
        │   └── input.py
        │
        └── utils/
            ├── __init__.py
            └── helpers.py

🖥️ Command Line

After installation:

Bash

matheric

Displays general information about the library.

📜 License

This project is licensed under the License

👨‍💻 Author

Orphéric SANGNIDJO

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

matheric-0.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matheric-0.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file matheric-0.1.1.tar.gz.

File metadata

  • Download URL: matheric-0.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for matheric-0.1.1.tar.gz
Algorithm Hash digest
SHA256 205e25ce1737cd6b20640948f9c6f00eca2ec6823acd9ead583488b77b4b6420
MD5 31ee304f3828d2f1a003e6cd48de96b5
BLAKE2b-256 3c3c99f90a01a9c3d145b839a822c99e6475da7733c8a9b9b773a9c155bb9487

See more details on using hashes here.

File details

Details for the file matheric-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: matheric-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for matheric-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59ff89da7d24dbcbfcbf8f3fa9ff11acc4992172085d0ca31d7e9e9fdf1fc7a7
MD5 5e5cfdcebd9c5ffa27d1f94835be0a5e
BLAKE2b-256 55e98341905216bf3f179814a1eb4446c67dc69fba0857daa314f09bea166c33

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