pydwrap


Namepydwrap JSON
Version 0.5.8 PyPI version JSON
download
home_pagehttps://github.com/luwqz1/pydwrap
Summarypydwrap stores a Option object to implement unpacking of values if they are not None. The BaseModel object is also a little extended to work with the Option object.
upload_time2023-04-21 20:44:51
maintainer
docs_urlNone
authorGeorgy howl
requires_python>=3.9,<4.0
licenseMIT
keywords python wrapping optional handle basemodel fields option pydwrap
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ♻️ pydwrap pydantic optional fields ♻️


pydwrap stores a **Option** object to implement unpacking of values if they are not **None**. The **BaseModel** object is also a little extended to work with the **Option** object.


[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pypi](https://img.shields.io/pypi/v/pydwrap.svg)](https://pypi.python.org/pypi/pydwrap)
[![versions](https://img.shields.io/pypi/pyversions/pydwrap.svg)](https://github.com/luwqz1/pydwrap)
[![license](https://img.shields.io/github/license/luwqz1/pydwrap.svg)](https://github.com/luwqz1/pydwrap/blob/main/LICENSE)


# ⭐️ A simple example ⭐️
```python
from pydwrap import BaseModel, Option

class User(BaseModel):
    name: Option[str]
    age: int

data = {
    "age": 20
}
user = User(**data)
#> User(name=Option(None), age=20)
print("Hello", user.name.unwrap(error_msg="What's your name?") + "!")
#> ValueError: What's your name?
```

# 📚 Documentation 📚
* In 🇷🇺 [**Russian**](https://github.com/luwqz1/pydwrap/blob/main/docs/RU.md) 🇷🇺
* In 🇺🇸 [**English**](https://github.com/luwqz1/pydwrap/blob/main/docs/EN.md) 🇺🇸
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/luwqz1/pydwrap",
    "name": "pydwrap",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "python,wrapping,optional handle,basemodel fields,option,pydwrap",
    "author": "Georgy howl",
    "author_email": "howluwqz1@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/87/0a/7f64e402c87e4849b6d37974ce22d09d9a6525099fd620e4544449db59f7/pydwrap-0.5.8.tar.gz",
    "platform": null,
    "description": "# \u267b\ufe0f pydwrap pydantic optional fields \u267b\ufe0f\n\n\npydwrap stores a **Option** object to implement unpacking of values if they are not **None**. The **BaseModel** object is also a little extended to work with the **Option** object.\n\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![pypi](https://img.shields.io/pypi/v/pydwrap.svg)](https://pypi.python.org/pypi/pydwrap)\n[![versions](https://img.shields.io/pypi/pyversions/pydwrap.svg)](https://github.com/luwqz1/pydwrap)\n[![license](https://img.shields.io/github/license/luwqz1/pydwrap.svg)](https://github.com/luwqz1/pydwrap/blob/main/LICENSE)\n\n\n# \u2b50\ufe0f A simple example \u2b50\ufe0f\n```python\nfrom pydwrap import BaseModel, Option\n\nclass User(BaseModel):\n    name: Option[str]\n    age: int\n\ndata = {\n    \"age\": 20\n}\nuser = User(**data)\n#> User(name=Option(None), age=20)\nprint(\"Hello\", user.name.unwrap(error_msg=\"What's your name?\") + \"!\")\n#> ValueError: What's your name?\n```\n\n# \ud83d\udcda Documentation \ud83d\udcda\n* In \ud83c\uddf7\ud83c\uddfa [**Russian**](https://github.com/luwqz1/pydwrap/blob/main/docs/RU.md) \ud83c\uddf7\ud83c\uddfa\n* In \ud83c\uddfa\ud83c\uddf8 [**English**](https://github.com/luwqz1/pydwrap/blob/main/docs/EN.md) \ud83c\uddfa\ud83c\uddf8",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pydwrap stores a Option object to implement unpacking of values if they are not None. The BaseModel object is also a little extended to work with the Option object.",
    "version": "0.5.8",
    "split_keywords": [
        "python",
        "wrapping",
        "optional handle",
        "basemodel fields",
        "option",
        "pydwrap"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e3afa92ef6fb3651400fcccc7c70372898610e231a581b17479eccba9d59da0",
                "md5": "1856e28af3162898b37a0e7ed737597c",
                "sha256": "7d5f95be689b1dec47819d0710b5df1b0679ad2157a454ca109a65107846b346"
            },
            "downloads": -1,
            "filename": "pydwrap-0.5.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1856e28af3162898b37a0e7ed737597c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4261,
            "upload_time": "2023-04-21T20:44:49",
            "upload_time_iso_8601": "2023-04-21T20:44:49.346767Z",
            "url": "https://files.pythonhosted.org/packages/2e/3a/fa92ef6fb3651400fcccc7c70372898610e231a581b17479eccba9d59da0/pydwrap-0.5.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "870a7f64e402c87e4849b6d37974ce22d09d9a6525099fd620e4544449db59f7",
                "md5": "41b432f700a7e4bb36cf44c6efa9b73a",
                "sha256": "e05376b2e5ae43c7f9a3698f9aa34ebf110935667b588d7a37aa51c01446cc24"
            },
            "downloads": -1,
            "filename": "pydwrap-0.5.8.tar.gz",
            "has_sig": false,
            "md5_digest": "41b432f700a7e4bb36cf44c6efa9b73a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 3905,
            "upload_time": "2023-04-21T20:44:51",
            "upload_time_iso_8601": "2023-04-21T20:44:51.268859Z",
            "url": "https://files.pythonhosted.org/packages/87/0a/7f64e402c87e4849b6d37974ce22d09d9a6525099fd620e4544449db59f7/pydwrap-0.5.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-21 20:44:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "luwqz1",
    "github_project": "pydwrap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pydwrap"
}
        
Elapsed time: 0.13823s