janus-validation


Namejanus-validation JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for robust data validation, serialization, and schema versioning.
upload_time2024-12-07 21:36:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords data validation schema versioning json yaml serialization
VCS
bugtrack_url
requirements PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Janus

![Latest Version](https://img.shields.io/pypi/v/janus-validation)
![Downloads](https://img.shields.io/pypi/dm/janus-validation)
![Status](https://img.shields.io/badge/status-alpha-orange)
![License: MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg)

**Janus** is a modern Python library for data validation, serialization, and schema versioning. It provides developers with a flexible, performant, and extensible toolkit to handle input validation, data transformation, and API schema compatibility with ease.

[Click here for the documentation](https://github.com/altxriainc/janus/wiki)

---

## 🚀 Key Features

- **Robust Data Validation**: Includes a comprehensive set of validators for strings, numbers, dates, collections, and more.
- **Nested Schema Validation**: Supports complex and deeply nested data structures.
- **Schema Versioning**: Seamlessly handle schema evolution and data migration between API versions.
- **Serialization**: Convert Python objects to JSON or YAML formats with error handling.
- **Custom Validators**: Easily extend Janus with custom validation rules.
- **Open for Personal & Commercial Use**: Use Janus freely in personal and commercial projects (not for resale as a standalone product).

---

## 🛠️ How to Use Janus

### Step 1: Install Janus

Install Janus via pip:

```bash
pip install janus-validation
```

### Step 2: Validate Your First Data

Define a validation schema:

```python
from janus.utils.validators import is_required, is_type, is_email
from janus.core.validator import SchemaValidator

schema = {
    "name": [is_required, is_type(str)],
    "email": [is_required, is_email],
    "age": [is_type(int)],
}

validator = SchemaValidator(schema)

data = {"name": "Alice", "email": "alice@example.com", "age": 30}
validated_data = validator.validate(data)
print("Validated Data:", validated_data)
```

### Step 3: Use Schema Versioning

Manage schema evolution with ease:

```python
from janus.core.schema_versioning import SchemaVersioning

versioning = SchemaVersioning()

# Register schemas
versioning.register_schema("v1", {"name": [is_required]})
versioning.register_schema("v2", {"name": [is_required], "email": [is_email]})

# Validate data with specific schema versions
data = {"name": "Alice", "email": "alice@example.com"}
validated = versioning.validate_with_version("v2", data)
print("Validated:", validated)
```

### Step 4: Serialize Data

Convert Python objects to JSON or YAML:

```python
from janus.core.serializer import JSONSerializer, YAMLSerializer

serializer = JSONSerializer()
json_data = serializer.serialize({"name": "Alice", "age": 30})
print("Serialized JSON:", json_data)

yaml_serializer = YAMLSerializer()
yaml_data = yaml_serializer.serialize({"name": "Alice", "age": 30})
print("Serialized YAML:", yaml_data)
```

---

## 🔍 Project Status

![Issues Closed](https://img.shields.io/github/issues-closed/altxriainc/janus)
![Bug Issues](https://img.shields.io/github/issues/altxriainc/janus/bug)
![Enhancement Issues](https://img.shields.io/github/issues/altxriainc/janus/enhancement)

---

## 📜 License and Usage

Janus is free to use for both personal and commercial projects. However, Janus itself cannot be resold or distributed as a standalone product.

---

## 🤝 Contributors

Developed and maintained by **Altxria Inc.** with contributions from a growing community of passionate developers.

![Contributors](https://contrib.rocks/image?repo=altxriainc/janus)

[See All Contributors](https://github.com/altxriainc/janus/graphs/contributors)

---

## ❤️ Support Janus

If you find Janus useful, consider sponsoring us to support ongoing development and new features!

[![Sponsor Janus](https://img.shields.io/badge/Sponsor-Janus-blue?logo=github-sponsors)](https://github.com/sponsors/altxriainc)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N516SMZ6)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "janus-validation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "data validation, schema versioning, json, yaml, serialization",
    "author": null,
    "author_email": "\"Altxria Inc.\" <company@altxria.com>",
    "download_url": "https://files.pythonhosted.org/packages/74/64/bbf74a0f20ef013fbd976097b1ee4491d56e4d9d756a6ef8a8c5ebe0b16e/janus_validation-0.1.1.tar.gz",
    "platform": null,
    "description": "\r\n# Janus\r\n\r\n![Latest Version](https://img.shields.io/pypi/v/janus-validation)\r\n![Downloads](https://img.shields.io/pypi/dm/janus-validation)\r\n![Status](https://img.shields.io/badge/status-alpha-orange)\r\n![License: MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg)\r\n\r\n**Janus** is a modern Python library for data validation, serialization, and schema versioning. It provides developers with a flexible, performant, and extensible toolkit to handle input validation, data transformation, and API schema compatibility with ease.\r\n\r\n[Click here for the documentation](https://github.com/altxriainc/janus/wiki)\r\n\r\n---\r\n\r\n## \ud83d\ude80 Key Features\r\n\r\n- **Robust Data Validation**: Includes a comprehensive set of validators for strings, numbers, dates, collections, and more.\r\n- **Nested Schema Validation**: Supports complex and deeply nested data structures.\r\n- **Schema Versioning**: Seamlessly handle schema evolution and data migration between API versions.\r\n- **Serialization**: Convert Python objects to JSON or YAML formats with error handling.\r\n- **Custom Validators**: Easily extend Janus with custom validation rules.\r\n- **Open for Personal & Commercial Use**: Use Janus freely in personal and commercial projects (not for resale as a standalone product).\r\n\r\n---\r\n\r\n## \ud83d\udee0\ufe0f How to Use Janus\r\n\r\n### Step 1: Install Janus\r\n\r\nInstall Janus via pip:\r\n\r\n```bash\r\npip install janus-validation\r\n```\r\n\r\n### Step 2: Validate Your First Data\r\n\r\nDefine a validation schema:\r\n\r\n```python\r\nfrom janus.utils.validators import is_required, is_type, is_email\r\nfrom janus.core.validator import SchemaValidator\r\n\r\nschema = {\r\n    \"name\": [is_required, is_type(str)],\r\n    \"email\": [is_required, is_email],\r\n    \"age\": [is_type(int)],\r\n}\r\n\r\nvalidator = SchemaValidator(schema)\r\n\r\ndata = {\"name\": \"Alice\", \"email\": \"alice@example.com\", \"age\": 30}\r\nvalidated_data = validator.validate(data)\r\nprint(\"Validated Data:\", validated_data)\r\n```\r\n\r\n### Step 3: Use Schema Versioning\r\n\r\nManage schema evolution with ease:\r\n\r\n```python\r\nfrom janus.core.schema_versioning import SchemaVersioning\r\n\r\nversioning = SchemaVersioning()\r\n\r\n# Register schemas\r\nversioning.register_schema(\"v1\", {\"name\": [is_required]})\r\nversioning.register_schema(\"v2\", {\"name\": [is_required], \"email\": [is_email]})\r\n\r\n# Validate data with specific schema versions\r\ndata = {\"name\": \"Alice\", \"email\": \"alice@example.com\"}\r\nvalidated = versioning.validate_with_version(\"v2\", data)\r\nprint(\"Validated:\", validated)\r\n```\r\n\r\n### Step 4: Serialize Data\r\n\r\nConvert Python objects to JSON or YAML:\r\n\r\n```python\r\nfrom janus.core.serializer import JSONSerializer, YAMLSerializer\r\n\r\nserializer = JSONSerializer()\r\njson_data = serializer.serialize({\"name\": \"Alice\", \"age\": 30})\r\nprint(\"Serialized JSON:\", json_data)\r\n\r\nyaml_serializer = YAMLSerializer()\r\nyaml_data = yaml_serializer.serialize({\"name\": \"Alice\", \"age\": 30})\r\nprint(\"Serialized YAML:\", yaml_data)\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd0d Project Status\r\n\r\n![Issues Closed](https://img.shields.io/github/issues-closed/altxriainc/janus)\r\n![Bug Issues](https://img.shields.io/github/issues/altxriainc/janus/bug)\r\n![Enhancement Issues](https://img.shields.io/github/issues/altxriainc/janus/enhancement)\r\n\r\n---\r\n\r\n## \ud83d\udcdc License and Usage\r\n\r\nJanus is free to use for both personal and commercial projects. However, Janus itself cannot be resold or distributed as a standalone product.\r\n\r\n---\r\n\r\n## \ud83e\udd1d Contributors\r\n\r\nDeveloped and maintained by **Altxria Inc.** with contributions from a growing community of passionate developers.\r\n\r\n![Contributors](https://contrib.rocks/image?repo=altxriainc/janus)\r\n\r\n[See All Contributors](https://github.com/altxriainc/janus/graphs/contributors)\r\n\r\n---\r\n\r\n## \u2764\ufe0f Support Janus\r\n\r\nIf you find Janus useful, consider sponsoring us to support ongoing development and new features!\r\n\r\n[![Sponsor Janus](https://img.shields.io/badge/Sponsor-Janus-blue?logo=github-sponsors)](https://github.com/sponsors/altxriainc)\r\n\r\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N516SMZ6)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for robust data validation, serialization, and schema versioning.",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/altxriainc/janus/issues",
        "Documentation": "https://github.com/altxriainc/janus/wiki",
        "Source Code": "https://github.com/altxriainc/janus"
    },
    "split_keywords": [
        "data validation",
        " schema versioning",
        " json",
        " yaml",
        " serialization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d487414dad2b8191f759b7e489d71316940863986c78ba93080d869c5a83410",
                "md5": "1561b499fc98f1b6b545377f1817d3a2",
                "sha256": "3d05413a04a9a8168edf55a6dff80d396e65e7e8797498cae1c8da5651c54e33"
            },
            "downloads": -1,
            "filename": "janus_validation-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1561b499fc98f1b6b545377f1817d3a2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7692,
            "upload_time": "2024-12-07T21:36:03",
            "upload_time_iso_8601": "2024-12-07T21:36:03.219508Z",
            "url": "https://files.pythonhosted.org/packages/4d/48/7414dad2b8191f759b7e489d71316940863986c78ba93080d869c5a83410/janus_validation-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7464bbf74a0f20ef013fbd976097b1ee4491d56e4d9d756a6ef8a8c5ebe0b16e",
                "md5": "58a3a774cb25e09b519ed1f82cde21e4",
                "sha256": "fee86cfe45d9593df62f9c734931319a7dca6fad16bb47cac2f5bbe21a804e52"
            },
            "downloads": -1,
            "filename": "janus_validation-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "58a3a774cb25e09b519ed1f82cde21e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8627,
            "upload_time": "2024-12-07T21:36:04",
            "upload_time_iso_8601": "2024-12-07T21:36:04.831842Z",
            "url": "https://files.pythonhosted.org/packages/74/64/bbf74a0f20ef013fbd976097b1ee4491d56e4d9d756a6ef8a8c5ebe0b16e/janus_validation-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-07 21:36:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "altxriainc",
    "github_project": "janus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "PyYAML",
            "specs": []
        }
    ],
    "lcname": "janus-validation"
}
        
Elapsed time: 0.50662s