{ "info": { "author": "DanH91", "author_email": "danielk.developer@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# jstruct\n\nAn eloquent and opinionated python library for nested object models definition offering simple serialization and deserialization into python dictionaries.\n\n[![Build Status](https://dev.azure.com/danielkobina0854/danielkobina/_apis/build/status/DanH91.jstruct?branchName=master)](https://dev.azure.com/danielkobina0854/danielkobina/_build/latest?definitionId=1&branchName=master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cbe02771e00e42cd882ab48543782b40)](https://www.codacy.com/app/DanH91/jstruct?utm_source=github.com&utm_medium=referral&utm_content=DanH91/jstruct&utm_campaign=Badge_Grade) \t\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n## Why\n\nThe deserialization of JSON or yaml into python data types is a common practice useful in many ways.\n - Configuration file reading and writing\n - REST API message response generation and request processing\n - Object-Document Mapping for a document store\n - Data import parsing or export generation \n\n## How\n\n`JStruct` leverage [attrs](https://www.attrs.org/en/stable/) the great `Classes without boilerplate` library to define structs without boilerplate.\n\n## What\n\nThe result is a simple and intuitive syntax familiar to a pythonista that brings `Validation`, `Deserialization` and `Serialization`.\n\n## Requirements\n\n - Python 3.6 and +\n\n## Installation\n\nInstall using pip\n\n```shell\npip install jstruct\n```\n\n## Usage\n\n```python\nimport attr\nfrom typing import List\nfrom jstruct import struct, JList\n\n@struct\nclass Person:\n first_name: str\n last_name: str\n\n@struct\nclass RoleModels:\n scientists: List[Person] = JList[Person]\n\n\npayload = {\n \"scientists\": [{\"first_name\": \"John\", \"last_name\": \"Doe\"}] \n}\n\nrole_models = RoleModels(**payload)\n\nprint(role_models)\n\n# RoleModels(scientists=[Person(first_name='John', last_name='Doe')])\n\nprint(attr.asdict(role_models))\n\n# {'scientists': [{'first_name': 'John', 'last_name': 'Doe'}]}\n\n```\n\n## Authors\n\n- **Daniel K.** - [@DanHK91](https://twitter.com/DanHK91) | [https://danielk.xyz](https://danielk.xyz/) \n\n## Contribute\n\nContributors are welcomed.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/DanH91/jstruct/blob/document-jstruct/LICENSE) file for details\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/DanH91/jstruct", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "jstruct", "package_url": "https://pypi.org/project/jstruct/", "platform": "", "project_url": "https://pypi.org/project/jstruct/", "project_urls": { "Homepage": "https://github.com/DanH91/jstruct" }, "release_url": "https://pypi.org/project/jstruct/2019.5.1/", "requires_dist": [ "attrs (==18.2.0)" ], "requires_python": "", "summary": "Readable serializable and deserializable Python nested models", "version": "2019.5.1" }, "last_serial": 5330850, "releases": { "2019.5.1": [ { "comment_text": "", "digests": { "md5": "e917c2edac20bf583b0472df5b7f860f", "sha256": "a2087226d9b64abc19e9ee64b595768818158a0d43fce8d0c7ff2b309603869f" }, "downloads": -1, "filename": "jstruct-2019.5.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e917c2edac20bf583b0472df5b7f860f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5174, "upload_time": "2019-05-29T07:18:35", "url": "https://files.pythonhosted.org/packages/46/08/6ec6b9cf9dd167c22b76c6f52e46a047638cb15174f908f131227d0b8596/jstruct-2019.5.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e917c2edac20bf583b0472df5b7f860f", "sha256": "a2087226d9b64abc19e9ee64b595768818158a0d43fce8d0c7ff2b309603869f" }, "downloads": -1, "filename": "jstruct-2019.5.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e917c2edac20bf583b0472df5b7f860f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5174, "upload_time": "2019-05-29T07:18:35", "url": "https://files.pythonhosted.org/packages/46/08/6ec6b9cf9dd167c22b76c6f52e46a047638cb15174f908f131227d0b8596/jstruct-2019.5.1-py3-none-any.whl" } ] }