pyvalidx


Namepyvalidx JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryCustom field validation
upload_time2025-07-28 00:06:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords validation pydantic forms data-validation python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyValidX

[![PyPI version](https://badge.fury.io/py/pyvalidx.svg)](https://badge.fury.io/py/pyvalidx)
[![Python versions](https://img.shields.io/pypi/pyversions/pyvalidx.svg)](https://pypi.org/project/pyvalidx/)
[![PyPI - Status](https://img.shields.io/pypi/status/pyvalidx)](https://pypi.org/project/pyvalidx/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Custom field validation for Python with Pydantic**

PyValidX is a powerful and flexible validation library built on top of Pydantic that provides a rich set of validators for common use cases while allowing you to create custom validation logic with ease.

## ✨ Features

- **🎯 Easy to Use**: Simple validation with clear, readable syntax
- **🔧 Flexible**: Support for custom validators and conditional validation
- **📝 Type Safe**: Built on Pydantic with full type annotation support
- **🌍 Comprehensive**: Wide range of built-in validators for strings, numbers, dates, and more
- **🚀 Performance**: Efficient validation with minimal overhead
- **📖 Well Documented**: Comprehensive documentation with examples

## 🚀 Quick Example

```python
from pyvalidx import ValidatedModel, field_validated
from pyvalidx.core import is_required
from pyvalidx.string import is_email, is_strong_password
from pyvalidx.numeric import min_value

class User(ValidatedModel):
    name: str = field_validated(is_required())
    email: str = field_validated(is_required(), is_email())
    password: str = field_validated(is_required(), is_strong_password())
    age: int = field_validated(is_required(), min_value(18))

# This will validate automatically
try:
    user = User(
        name="John Doe",
        email="john@example.com", 
        password="SecurePass123!",
        age=25
    )
    print("User created successfully!")
except ValidationException as e:
    print(f"Validation failed: {e.to_dict()}")
```

## 📦 Installation

Install PyValidX using pip:

```bash
pip install pyvalidx
```

Or with poetry:

```bash
poetry add pyvalidx
```

## 🎯 Core Concepts

### Validators
Validators are functions that check if a value meets certain criteria. They return `True` if valid, `False` otherwise.

### ValidatedModel
A Pydantic model that automatically runs custom validators on initialization and provides error handling.

### field_validated
A field decorator that attaches validators to model fields.

### ValidationException
A custom exception that provides structured error information when validation fails.

## 📚 Available Validators

### Core Validators
- `is_required()` - Ensures field is not None, empty string, or empty list
- `min_length()` - Minimum string/list length
- `max_length()` - Maximum string/list length
- `same_as()` - Field must match another field
- `required_if()` - Conditional requirement based on another field

### String Validators
- `is_email()` - Valid email format
- `is_strong_password()` - Strong password requirements
- `matches_regex()` - Custom regex pattern matching
- `no_whitespace()` - No spaces allowed
- `is_phone()` - Colombian phone number format

### Numeric Validators
- `is_positive()` - Positive numbers only
- `is_integer()` - Integer type validation
- `is_float()` - Float type validation
- `min_value()` - Minimum numeric value
- `max_value()` - Maximum numeric value

### Date Validators
- `is_date()` - Valid date format
- `is_future_date()` - Date must be in the future
- `is_past_date()` - Date must be in the past
- `is_today()` - Date must be today

### Type Validators
- `is_dict()` - Dictionary type validation
- `is_list()` - List type validation
- `is_boolean()` - Boolean type validation
- `is_in()` - Value must be in specified choices

## 🔗 Quick Links

- [Getting Started](https://harrison-gaviria.github.io/pyvalidx/getting-started/installation/) - Install and set up PyValidX
- [Validators](https://harrison-gaviria.github.io/pyvalidx/validators/core/) - Explore all available validators
- [API Reference](https://harrison-gaviria.github.io/pyvalidx/api-reference/validated-model/) - Complete API documentation

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/harrison-gaviria/pyvalidx/blob/main/LICENSE) file for details.

## 👤 Author

**Harrison Alonso Arroyave Gaviria**
- GitHub: [@harrison-gaviria](https://github.com/harrison-gaviria)
- Email: harrisonarroyaveg@gmail.com

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyvalidx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Harrison Alonso Arroyave Gaviria <harrisonarroyaveg@gmail.com>",
    "keywords": "validation, pydantic, forms, data-validation, python",
    "author": null,
    "author_email": "Harrison Alonso Arroyave Gaviria <harrisonarroyaveg@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7b/59/93f996631d8e9517a5923596e586f40c5af3c10ba11a7556103cebe24b70/pyvalidx-0.1.2.tar.gz",
    "platform": null,
    "description": "# PyValidX\r\n\r\n[![PyPI version](https://badge.fury.io/py/pyvalidx.svg)](https://badge.fury.io/py/pyvalidx)\r\n[![Python versions](https://img.shields.io/pypi/pyversions/pyvalidx.svg)](https://pypi.org/project/pyvalidx/)\r\n[![PyPI - Status](https://img.shields.io/pypi/status/pyvalidx)](https://pypi.org/project/pyvalidx/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n**Custom field validation for Python with Pydantic**\r\n\r\nPyValidX is a powerful and flexible validation library built on top of Pydantic that provides a rich set of validators for common use cases while allowing you to create custom validation logic with ease.\r\n\r\n## \u2728 Features\r\n\r\n- **\ud83c\udfaf Easy to Use**: Simple validation with clear, readable syntax\r\n- **\ud83d\udd27 Flexible**: Support for custom validators and conditional validation\r\n- **\ud83d\udcdd Type Safe**: Built on Pydantic with full type annotation support\r\n- **\ud83c\udf0d Comprehensive**: Wide range of built-in validators for strings, numbers, dates, and more\r\n- **\ud83d\ude80 Performance**: Efficient validation with minimal overhead\r\n- **\ud83d\udcd6 Well Documented**: Comprehensive documentation with examples\r\n\r\n## \ud83d\ude80 Quick Example\r\n\r\n```python\r\nfrom pyvalidx import ValidatedModel, field_validated\r\nfrom pyvalidx.core import is_required\r\nfrom pyvalidx.string import is_email, is_strong_password\r\nfrom pyvalidx.numeric import min_value\r\n\r\nclass User(ValidatedModel):\r\n    name: str = field_validated(is_required())\r\n    email: str = field_validated(is_required(), is_email())\r\n    password: str = field_validated(is_required(), is_strong_password())\r\n    age: int = field_validated(is_required(), min_value(18))\r\n\r\n# This will validate automatically\r\ntry:\r\n    user = User(\r\n        name=\"John Doe\",\r\n        email=\"john@example.com\", \r\n        password=\"SecurePass123!\",\r\n        age=25\r\n    )\r\n    print(\"User created successfully!\")\r\nexcept ValidationException as e:\r\n    print(f\"Validation failed: {e.to_dict()}\")\r\n```\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nInstall PyValidX using pip:\r\n\r\n```bash\r\npip install pyvalidx\r\n```\r\n\r\nOr with poetry:\r\n\r\n```bash\r\npoetry add pyvalidx\r\n```\r\n\r\n## \ud83c\udfaf Core Concepts\r\n\r\n### Validators\r\nValidators are functions that check if a value meets certain criteria. They return `True` if valid, `False` otherwise.\r\n\r\n### ValidatedModel\r\nA Pydantic model that automatically runs custom validators on initialization and provides error handling.\r\n\r\n### field_validated\r\nA field decorator that attaches validators to model fields.\r\n\r\n### ValidationException\r\nA custom exception that provides structured error information when validation fails.\r\n\r\n## \ud83d\udcda Available Validators\r\n\r\n### Core Validators\r\n- `is_required()` - Ensures field is not None, empty string, or empty list\r\n- `min_length()` - Minimum string/list length\r\n- `max_length()` - Maximum string/list length\r\n- `same_as()` - Field must match another field\r\n- `required_if()` - Conditional requirement based on another field\r\n\r\n### String Validators\r\n- `is_email()` - Valid email format\r\n- `is_strong_password()` - Strong password requirements\r\n- `matches_regex()` - Custom regex pattern matching\r\n- `no_whitespace()` - No spaces allowed\r\n- `is_phone()` - Colombian phone number format\r\n\r\n### Numeric Validators\r\n- `is_positive()` - Positive numbers only\r\n- `is_integer()` - Integer type validation\r\n- `is_float()` - Float type validation\r\n- `min_value()` - Minimum numeric value\r\n- `max_value()` - Maximum numeric value\r\n\r\n### Date Validators\r\n- `is_date()` - Valid date format\r\n- `is_future_date()` - Date must be in the future\r\n- `is_past_date()` - Date must be in the past\r\n- `is_today()` - Date must be today\r\n\r\n### Type Validators\r\n- `is_dict()` - Dictionary type validation\r\n- `is_list()` - List type validation\r\n- `is_boolean()` - Boolean type validation\r\n- `is_in()` - Value must be in specified choices\r\n\r\n## \ud83d\udd17 Quick Links\r\n\r\n- [Getting Started](https://harrison-gaviria.github.io/pyvalidx/getting-started/installation/) - Install and set up PyValidX\r\n- [Validators](https://harrison-gaviria.github.io/pyvalidx/validators/core/) - Explore all available validators\r\n- [API Reference](https://harrison-gaviria.github.io/pyvalidx/api-reference/validated-model/) - Complete API documentation\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/harrison-gaviria/pyvalidx/blob/main/LICENSE) file for details.\r\n\r\n## \ud83d\udc64 Author\r\n\r\n**Harrison Alonso Arroyave Gaviria**\r\n- GitHub: [@harrison-gaviria](https://github.com/harrison-gaviria)\r\n- Email: harrisonarroyaveg@gmail.com\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Custom field validation",
    "version": "0.1.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/harrison-gaviria/pyvalidx/issues",
        "Documentation": "https://harrison-gaviria.github.io/pyvalidx/",
        "Homepage": "https://github.com/harrison-gaviria/pyvalidx",
        "Repository": "https://github.com/harrison-gaviria/pyvalidx"
    },
    "split_keywords": [
        "validation",
        " pydantic",
        " forms",
        " data-validation",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "87bd9d1fe4b564a9a23cc9e8bce1b03b0bdd7fa28c19583bb93f1e60bdb4648f",
                "md5": "b23956496450757ad085f75104b49699",
                "sha256": "cf92870a0a9c67be067d38a1e3773ceed2ea3ad77c4918fab4bdc36181dc6525"
            },
            "downloads": -1,
            "filename": "pyvalidx-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b23956496450757ad085f75104b49699",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 11222,
            "upload_time": "2025-07-28T00:06:27",
            "upload_time_iso_8601": "2025-07-28T00:06:27.377769Z",
            "url": "https://files.pythonhosted.org/packages/87/bd/9d1fe4b564a9a23cc9e8bce1b03b0bdd7fa28c19583bb93f1e60bdb4648f/pyvalidx-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7b5993f996631d8e9517a5923596e586f40c5af3c10ba11a7556103cebe24b70",
                "md5": "1c7409833aa812141424311e3cb28674",
                "sha256": "4e09ba553928e13587b7c5d8ab255f0ee7cc180e9812c74d56ec3527d47306e1"
            },
            "downloads": -1,
            "filename": "pyvalidx-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1c7409833aa812141424311e3cb28674",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10508,
            "upload_time": "2025-07-28T00:06:28",
            "upload_time_iso_8601": "2025-07-28T00:06:28.902890Z",
            "url": "https://files.pythonhosted.org/packages/7b/59/93f996631d8e9517a5923596e586f40c5af3c10ba11a7556103cebe24b70/pyvalidx-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 00:06:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "harrison-gaviria",
    "github_project": "pyvalidx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyvalidx"
}
        
Elapsed time: 0.44246s