Metadata-Version: 2.5
Name: smart-validator
Version: 0.1.0
Summary: Reusable Python validation library
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# Smart Validator

A lightweight, reusable Python library for validating integer values against configurable minimum thresholds.

## Features

- Simple and reusable validation API
- Configurable minimum values
- Boolean validation results
- Custom exception handling
- Type validation
- Unit tests using pytest
- Compatible with Python 3.11+

## Installation

### Install from source

Clone or download the project, navigate to the project directory, and run:

```bash
python -m pip install .
```

For local development:

```bash
python -m pip install -e ".[dev]"
```

## Quick Start

```python
from smart_validator import Validator

validator = Validator(min_value=18)

print(validator.validate(25))  # True
print(validator.validate(12))  # False
```

## Exception Handling

The library provides custom exceptions for validation errors.

```python
from smart_validator import Validator, ValidationError

validator = Validator(min_value=18)

try:
    validator.validate_or_raise(12)
except ValidationError as error:
    print(f"Validation failed: {error}")
```

Expected output:

```text
Validation failed: Value must be >= 18
```

## API Reference

### Validator(min_value=0)

Creates a validator with a configurable minimum integer value.

### validate(value: int) -> bool

Returns `True` when the integer meets the minimum threshold and `False` otherwise.

Raises `InvalidTypeError` for unsupported input types.

### validate_or_raise(value: int) -> None

Raises `InvalidValueError` when the integer is below the configured threshold. Returns `None` on success.

## Development

Create a virtual environment:

```bash
python3 -m venv .venv
source .venv/bin/activate
```

Install development dependencies:

```bash
python -m pip install -e ".[dev]"
```

Run tests:

```bash
python -m pytest -v
```

Build distribution packages:

```bash
python -m build
```

The build produces a wheel and source distribution inside the `dist/` directory.

## Project Structure

```text
smart-validator/
├── pyproject.toml
├── README.md
├── LICENSE
├── src/
│   └── smart_validator/
│       ├── __init__.py
│       ├── validator.py
│       └── exceptions.py
└── tests/
    └── test_validator.py
```

## License

This project is licensed under the MIT License. See the LICENSE file for details.
