parasite


Nameparasite JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://hendrikboeck.github.io/parasite
SummaryData validation for Python 3
upload_time2024-06-16 11:43:59
maintainerNone
docs_urlNone
authorHendrik Boeck
requires_python<4.0,>=3.11
licenseMIT
keywords data validation python zod datastructures types objects schema runtime-evaluation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Stars][stars-shield]
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]


<br />
<div align="center">
<a href="https://github.com/hendrikboeck/parasite">
    <img src="https://raw.githubusercontent.com/hendrikboeck/parasite/main/.github/parasite_logo.png" alt="Logo" width="128" height="128">
</a>

<h1 align="center">parasite <code>v0.1</code></h1>

<p align="center">
    <code>zod</code> inspired library for Python 3.11+
    <br />
    <a href="https://github.com/hendrikboeck/parasite/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
    |
    <a href="https://github.com/ohendrikboeck/parasite/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>

> [!WARNING]
>
> This library is under active development, expect things to break or not to work as expected.
> Creating an issue for bugs you encounter would be appreciated. Documentation is currently work in
> progress.

## Table of Contents

- [Why?](#why)
- [What about the name?](#what-about-the-name)
- [Getting Started](#getting-started)
  - [Installing](#installing)
  - [Example usage](#example-usage)
- [Documentation](#documentation)
- [License (_MIT License_)](#license-mit-license)

## Why?

Data and object validation in Python is essential to ensure that the inputs to a program are
accurate and adhere to expected formats, thereby preventing runtime errors and enhancing code
reliability. The TypeScript library `zod` offers a concise and expressive syntax for schema
validation, making it easier to define and enforce data structures. Implementing a similar library
in Python would greatly benefit developers by providing a streamlined, declarative approach to
validation, reducing boilerplate code and improving maintainability. This would facilitate more
robust data handling and enhance the overall quality of Python applications.

## What about the name?

I chose the name "Parasite" for this library because it draws heavy inspiration from the TypeScript
`zod` library, which excels in schema validation with its concise and expressive syntax. The name
"Parasite" is also a nod to one of Superman's iconic supervillains, serving as an homage to the
library that inspired this creation.

## Getting Started

### Installing

Install using `pip`:

```sh
pip install parasite
```

Install using `poetry` CLI:

```sh
poetry add parasite
```

or using `pyproject.toml`:

```toml
[tool.poetry.dependencies]
parasite = "^0.1.0"
```

### Example usage

```python
from parasite import p

schema = p.obj({
    "name": p.string().required(),
    "age": p.number().integer().min(0).optional(),
}).strip()

data = {
    "name": "John Doe",
    "age": 42,
    "extra": "This will be stripped",
}

schema.parse(data)   # {'name': 'John Doe', 'age': 42}
schema.parse({})   # ValidationError: Missing required key: 'name'
```

## Documentation

> [!IMPORTANT]
>
> You can find the sphinx online documentation [here](https://hendrikboeck.github.io/parasite)!

## License (_MIT License_)

Copyright (c) 2024, Hendrik Böck <<hendrikboeck.dev@protonmail.com>>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

[license-shield]: https://img.shields.io/github/license/hendrikboeck/parasite?style=for-the-badge
[license-url]: https://github.com/hendrikboeck/parasite/blob/main/LICENSE
[issues-shield]: https://img.shields.io/github/issues/hendrikboeck/parasite?style=for-the-badge
[issues-url]: https://github.com/hendrikboeck/parasite/issues
[forks-shield]: https://img.shields.io/github/forks/hendrikboeck/parasite?style=for-the-badge
[forks-url]: https://github.com/hendrikboeck/parasite/forks
[contributors-shield]: https://img.shields.io/github/contributors/hendrikboeck/parasite?style=for-the-badge
[contributors-url]: https://github.com/hendrikboeck/parasite/contributors
[stars-shield]: https://img.shields.io/github/stars/hendrikboeck/parasite?style=for-the-badge


            

Raw data

            {
    "_id": null,
    "home_page": "https://hendrikboeck.github.io/parasite",
    "name": "parasite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "data, validation, python, zod, datastructures, types, objects, schema, runtime-evaluation",
    "author": "Hendrik Boeck",
    "author_email": "hendrikboeck.dev@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/b7/b30b0849f61e70412568764c089c5040955f1a0fb4b2c58a523f5eb3a2c7/parasite-0.1.6.tar.gz",
    "platform": null,
    "description": "![Stars][stars-shield]\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\n\n<br />\n<div align=\"center\">\n<a href=\"https://github.com/hendrikboeck/parasite\">\n    <img src=\"https://raw.githubusercontent.com/hendrikboeck/parasite/main/.github/parasite_logo.png\" alt=\"Logo\" width=\"128\" height=\"128\">\n</a>\n\n<h1 align=\"center\">parasite <code>v0.1</code></h1>\n\n<p align=\"center\">\n    <code>zod</code> inspired library for Python 3.11+\n    <br />\n    <a href=\"https://github.com/hendrikboeck/parasite/issues/new?labels=bug&template=bug-report---.md\">Report Bug</a>\n    |\n    <a href=\"https://github.com/ohendrikboeck/parasite/issues/new?labels=enhancement&template=feature-request---.md\">Request Feature</a>\n</p>\n</div>\n\n> [!WARNING]\n>\n> This library is under active development, expect things to break or not to work as expected.\n> Creating an issue for bugs you encounter would be appreciated. Documentation is currently work in\n> progress.\n\n## Table of Contents\n\n- [Why?](#why)\n- [What about the name?](#what-about-the-name)\n- [Getting Started](#getting-started)\n  - [Installing](#installing)\n  - [Example usage](#example-usage)\n- [Documentation](#documentation)\n- [License (_MIT License_)](#license-mit-license)\n\n## Why?\n\nData and object validation in Python is essential to ensure that the inputs to a program are\naccurate and adhere to expected formats, thereby preventing runtime errors and enhancing code\nreliability. The TypeScript library `zod` offers a concise and expressive syntax for schema\nvalidation, making it easier to define and enforce data structures. Implementing a similar library\nin Python would greatly benefit developers by providing a streamlined, declarative approach to\nvalidation, reducing boilerplate code and improving maintainability. This would facilitate more\nrobust data handling and enhance the overall quality of Python applications.\n\n## What about the name?\n\nI chose the name \"Parasite\" for this library because it draws heavy inspiration from the TypeScript\n`zod` library, which excels in schema validation with its concise and expressive syntax. The name\n\"Parasite\" is also a nod to one of Superman's iconic supervillains, serving as an homage to the\nlibrary that inspired this creation.\n\n## Getting Started\n\n### Installing\n\nInstall using `pip`:\n\n```sh\npip install parasite\n```\n\nInstall using `poetry` CLI:\n\n```sh\npoetry add parasite\n```\n\nor using `pyproject.toml`:\n\n```toml\n[tool.poetry.dependencies]\nparasite = \"^0.1.0\"\n```\n\n### Example usage\n\n```python\nfrom parasite import p\n\nschema = p.obj({\n    \"name\": p.string().required(),\n    \"age\": p.number().integer().min(0).optional(),\n}).strip()\n\ndata = {\n    \"name\": \"John Doe\",\n    \"age\": 42,\n    \"extra\": \"This will be stripped\",\n}\n\nschema.parse(data)   # {'name': 'John Doe', 'age': 42}\nschema.parse({})   # ValidationError: Missing required key: 'name'\n```\n\n## Documentation\n\n> [!IMPORTANT]\n>\n> You can find the sphinx online documentation [here](https://hendrikboeck.github.io/parasite)!\n\n## License (_MIT License_)\n\nCopyright (c) 2024, Hendrik B\u00f6ck <<hendrikboeck.dev@protonmail.com>>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[license-shield]: https://img.shields.io/github/license/hendrikboeck/parasite?style=for-the-badge\n[license-url]: https://github.com/hendrikboeck/parasite/blob/main/LICENSE\n[issues-shield]: https://img.shields.io/github/issues/hendrikboeck/parasite?style=for-the-badge\n[issues-url]: https://github.com/hendrikboeck/parasite/issues\n[forks-shield]: https://img.shields.io/github/forks/hendrikboeck/parasite?style=for-the-badge\n[forks-url]: https://github.com/hendrikboeck/parasite/forks\n[contributors-shield]: https://img.shields.io/github/contributors/hendrikboeck/parasite?style=for-the-badge\n[contributors-url]: https://github.com/hendrikboeck/parasite/contributors\n[stars-shield]: https://img.shields.io/github/stars/hendrikboeck/parasite?style=for-the-badge\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Data validation for Python 3",
    "version": "0.1.6",
    "project_urls": {
        "Documentation": "https://hendrikboeck.github.io/parasite",
        "Homepage": "https://hendrikboeck.github.io/parasite",
        "Repository": "https://github.com/hendrikboeck/parasite"
    },
    "split_keywords": [
        "data",
        " validation",
        " python",
        " zod",
        " datastructures",
        " types",
        " objects",
        " schema",
        " runtime-evaluation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d05b43581b2cc18c7ef12b62f92c093aa5f9e582d14731f6f02b81ca6cdc9530",
                "md5": "4bc52382da62bb417b7da83c60bf9ac7",
                "sha256": "e2ac9b05b114de87e33fb95a82452167eeaec0ea812a09294514465715120e87"
            },
            "downloads": -1,
            "filename": "parasite-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4bc52382da62bb417b7da83c60bf9ac7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 23584,
            "upload_time": "2024-06-16T11:43:57",
            "upload_time_iso_8601": "2024-06-16T11:43:57.827795Z",
            "url": "https://files.pythonhosted.org/packages/d0/5b/43581b2cc18c7ef12b62f92c093aa5f9e582d14731f6f02b81ca6cdc9530/parasite-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ab7b30b0849f61e70412568764c089c5040955f1a0fb4b2c58a523f5eb3a2c7",
                "md5": "b508b18fc9c6d0524e13f65fcb9a745f",
                "sha256": "2654290dca8a75e47844a506724ba6d10099d475112f25aa438825cfd01a386d"
            },
            "downloads": -1,
            "filename": "parasite-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "b508b18fc9c6d0524e13f65fcb9a745f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 17136,
            "upload_time": "2024-06-16T11:43:59",
            "upload_time_iso_8601": "2024-06-16T11:43:59.123401Z",
            "url": "https://files.pythonhosted.org/packages/7a/b7/b30b0849f61e70412568764c089c5040955f1a0fb4b2c58a523f5eb3a2c7/parasite-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-16 11:43:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hendrikboeck",
    "github_project": "parasite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "parasite"
}
        
Elapsed time: 0.25887s