https://github.com/orpheric73/matheric
A modular Python library for secure and flexible user input validation
https://github.com/orpheric73/matheric
input-validation library pip pypi python python-package secure-input
Last synced: about 16 hours ago
JSON representation
A modular Python library for secure and flexible user input validation
- Host: GitHub
- URL: https://github.com/orpheric73/matheric
- Owner: orpheric73
- License: mit
- Created: 2026-05-21T02:33:19.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-21T05:13:25.000Z (about 1 month ago)
- Last Synced: 2026-05-21T11:57:37.450Z (about 1 month ago)
- Topics: input-validation, library, pip, pypi, python, python-package, secure-input
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
Bash
pip install matheric
```
## π‘ Quick Example
```Python
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
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
Python
number = secureinput(
"Enter a number : ",
type="int",
min=1,
max=10
)
```
### Float Validation
```Python
Python
price = secureinput(
msg="Enter the price : ",
type="float",
min=0
)
```
### Input Confirmation System
```Python
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 |
| `language` | `EN / FR` | Output language used for automatic responses | EN |
## π‘ Example With Validation
```Python
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
```text
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
Bash
matheric
```
Displays general information about the library.
## π License
This project is licensed under the [](LICENSE)
## π¨βπ» Author
OrphΓ©ric SANGNIDJO