Metadata-Version: 2.4
Name: pyvalidYR
Version: 0.1.0
Summary: A lightweight Python validation library for checking data before using it.
Author: Ramosh99
License-Expression: MIT
Project-URL: Homepage, https://github.com/ramosh99/pyvalidYR
Project-URL: Repository, https://github.com/ramosh99/pyvalidYR
Keywords: validation,validator,forms,input-validation,data-validation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# PyValidX

PyValidX is a small Python validation library that helps developers check data before using it.

It is useful for form input, API request bodies, configuration files, and any place where incoming data should follow clear rules.

## Installation

```bash
pip install pyvalidx
```

## Quick Start

```python
from pyvalidx import validate

validate("john@example.com", ["required", "email"])
validate("secure-password", ["required", "min:8"])
validate(25, ["required", "between:18,100"])
```

If the value is invalid, PyValidX raises a `ValidationError`.

```python
from pyvalidx import ValidationError, validate

try:
    validate("", ["required"])
except ValidationError as error:
    print(error)
```

## Available Rules

| Rule | Example | Meaning |
| --- | --- | --- |
| `required` | `required` | Value cannot be empty |
| `email` | `email` | Value must look like an email address |
| `min` | `min:8` | Value length or number must be at least 8 |
| `max` | `max:100` | Value length or number must be at most 100 |
| `between` | `between:18,100` | Number must be between 18 and 100 |
| `regex` | `regex:^[A-Z]+$` | Value must match a regular expression |
| `in` | `in:admin,user` | Value must be one of the allowed options |

## Validate Dictionaries

```python
from pyvalidx import validate_data

rules = {
    "name": ["required", "min:2"],
    "email": ["required", "email"],
    "age": ["required", "between:18,100"],
}

validate_data(
    {"name": "Jane", "email": "jane@example.com", "age": 30},
    rules,
)
```

## Custom Validators

```python
from pyvalidx import validate

def starts_with_a(value):
    return str(value).startswith("A")

validate("Alice", [starts_with_a])
```

Custom validators can return:

- `True` for valid
- `False` for invalid
- A string error message for invalid

## Development

```bash
python -m pip install -e . pytest build twine
python -m pytest
python -m build
python -m twine check dist/*
```

## Publish to PyPI

First test with TestPyPI:

```bash
python -m twine upload --repository testpypi dist/*
```

Then upload to PyPI:

```bash
python -m twine upload dist/*
```
