{ "info": { "author": "Jared Deckard", "author_email": "jared@shademaps.com", "bugtrack_url": null, "classifiers": [], "description": "# Marsha\n\n[![pipeline status](https://gitlab.com/deckar01/marsha/badges/master/pipeline.svg)](https://gitlab.com/deckar01/marsha/commits/master)\n[![coverage report](https://gitlab.com/deckar01/marsha/badges/master/coverage.svg)](https://gitlab.com/deckar01/marsha/commits/master)\n\nA serialization and validation library for python 3 based on the typing module.\n\n## Status\n\n### \ud83d\udd2c Experimental\n\nDon't put this code on servers. You can, but you probably shouldn't.\n\n## Documentation\n\n### \ud83d\udcd6 [https://deckar01.gitlab.io/marsha](https://deckar01.gitlab.io/marsha)\n\n## Features\n\n### \ud83d\udc82 Strictness\n\nWhen using python's builtin types for schema annotations, the data **must** be\ninstances of the specified types or the load operation will fail with an exception.\nUnexpected and missing data will error by default.\n\n### \ud83d\udd75 Clarity\n\nValidation errors mirror the structure of the data, provide insight into the values\nthat caused the error, and present meaningful information to help resolve the problem.\n\n### \ud83c\udfc3 Speed\n\nThe default functionality is fast and lean. The performance degrades gracefully as\ncomplex functionality is explicitly opted into by the developer.\n\n### \ud83e\udd38 Flexibility\n\nCustom data types are created by defining formatter classes, then transfored into\ntypes compatible with the builtin typing module.\n\n### \ud83d\udc83 Expressiveness\n\nPython's builtin typing generics can be leveraged to declare complex type unions that\nknow how to automatically handle multiple types using a syntax that is explicit and concise.\n\n## Installation\n\n```sh\npip install marsha\n```\n\n## Usage\n\n_Need to create database model instances from user input and expose them in serialized form?_\n\nCreating a schema that is separate from the model is a useful way to declare a \"view\" and\nallows defining multiple schemas to control how data is exposed in different contexts.\n\n```py\nfrom my_app.database_models import Artist, Album\n\nimport marsha\nfrom typing import List\n\n@marsha.schema(Artist)\nclass ArtistSchema:\n name: str\n\n@marsha.schema(Album)\nclass AlbumSchema:\n title: str\n artists: List[Artist]\n\n# dict -> Album\nalbum = marsha.load(album_data, Album)\n# Do stuff\nalbum.save()\n# Album -> dict\nresponse_data = marsha.dump(album)\n```\n\n_Just need to validate some data and convert it to the correct type?_\n\nYou can automatically register the type annotations of any model as a schema by\nadding the `schema` decorator.\n\n```py\nimport marsha\nfrom typing import List\n\n@marsha.schema()\nclass Artist(dict):\n name: str\n\n@marsha.schema()\nclass Album(dict):\n title: str\n artists: List[Artist]\n\n# dict -> dict\nalbum = marsha.load(album_data, Album)\n# Do stuff\nfirst_artist = album['artists'][0]\n```\n\n## Development\n\n### \ud83d\udcda Dependencies\n\n```sh\n# python >= 3.6\npip install -r dev-requirements.txt\n```\n\n### \ud83c\udfc5 Testing\n\n```sh\n# Quick testing.\nflake8\npytest\n# Ensure all statements and branches are covered with tests.\npytest --cov=marsha --cov-branch --cov-report html --cov-report term\n# Ensure documentations changes render correctly.\nmake html\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/deckar01/marsha", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "marsha", "package_url": "https://pypi.org/project/marsha/", "platform": "", "project_url": "https://pypi.org/project/marsha/", "project_urls": { "Homepage": "https://gitlab.com/deckar01/marsha" }, "release_url": "https://pypi.org/project/marsha/0.2.4/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.2.4" }, "last_serial": 4095090, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "fa7f07f9503b592e942da2065e1a74d0", "sha256": "c8a170fb2b725ef12eac725cd0dabd3efb59e77d218d94186d8d5380dbf97389" }, "downloads": -1, "filename": "marsha-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fa7f07f9503b592e942da2065e1a74d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3944, "upload_time": "2018-06-19T04:10:38", "url": "https://files.pythonhosted.org/packages/f3/ac/31bdae9cf6be7cf144d9e0c1578ecac7b0e24029530e47478cda460b59bd/marsha-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "43e0d0a249525ea617fe87ec4854af01", "sha256": "18ef775f9e8aa54182dbbebe2d3cb4a3861d2ec9f0c89f3656cdd4a1d7431fa6" }, "downloads": -1, "filename": "marsha-0.0.2.tar.gz", "has_sig": false, "md5_digest": "43e0d0a249525ea617fe87ec4854af01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6896, "upload_time": "2018-06-19T04:45:28", "url": "https://files.pythonhosted.org/packages/bb/79/a150e97c16fe00522ab3d6d513678b178d4a1681bae9aeeaaacce25912e7/marsha-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d687b7126445cd52cc2a8ab3f4d5aa6b", "sha256": "ba6526464c8f5196603b3c5638c73bd1fb6562d63a031a6a7b7d8fd074b8f523" }, "downloads": -1, "filename": "marsha-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d687b7126445cd52cc2a8ab3f4d5aa6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7113, "upload_time": "2018-06-20T13:41:28", "url": "https://files.pythonhosted.org/packages/a3/dc/260a6f23201fb8c2d0d9e9a38dbc531a557337d9e5fdbb4da3f0249706a9/marsha-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "1a62f1f167a1c420a5e92b9d5bf23177", "sha256": "28e284891067e569072eed2985253d14a414de8010581fa68f5a5f5b66f3245b" }, "downloads": -1, "filename": "marsha-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1a62f1f167a1c420a5e92b9d5bf23177", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7358, "upload_time": "2018-06-20T22:09:56", "url": "https://files.pythonhosted.org/packages/00/db/c3400264f0fb5e1a54e6f148d8728442a5ee6f0c93cd9b496a9b2e23aea5/marsha-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "038b26b2d52cb54a70a22f91cb9b87c0", "sha256": "f6c6795a2e91439e0af38c3d9ddb181bd7f93c3bebead4f1b0df7d2b289f5c9e" }, "downloads": -1, "filename": "marsha-0.2.0.tar.gz", "has_sig": false, "md5_digest": "038b26b2d52cb54a70a22f91cb9b87c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7712, "upload_time": "2018-06-22T15:05:02", "url": "https://files.pythonhosted.org/packages/bb/3b/f45763d021f5a3d02cdb27c5a62eb13b48eb69678467635f7cd77e5acb6c/marsha-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "df5c2105bf23dfd4ec7bf3403a1c6a2c", "sha256": "6d578d93335fa3b57756e6114669bfa659a8391e738cc16b5ab6374ed1720f34" }, "downloads": -1, "filename": "marsha-0.2.1.tar.gz", "has_sig": false, "md5_digest": "df5c2105bf23dfd4ec7bf3403a1c6a2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7575, "upload_time": "2018-07-23T21:37:18", "url": "https://files.pythonhosted.org/packages/41/97/ff821b26153edaeca4c5dcf5fefffef1f4c988af23711e28ad2ccd8206fc/marsha-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "acaf0c774d634451c39a6051410ccde6", "sha256": "e16bf00baa92b6ba705e63d2e80f95146f5f9a8c47a3b8ad5cb0286d87b0aa3b" }, "downloads": -1, "filename": "marsha-0.2.2.tar.gz", "has_sig": false, "md5_digest": "acaf0c774d634451c39a6051410ccde6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7597, "upload_time": "2018-07-23T21:41:17", "url": "https://files.pythonhosted.org/packages/21/e5/21aebd6dad419d2241d41df58fb0300b2c9d5d80ef60379f0039cdd6a413/marsha-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "da95b347bb7f8904a48fa5836e406761", "sha256": "f1bb508530958e509ba98ba004dd6fcca25016892f8f89694a1079379941323d" }, "downloads": -1, "filename": "marsha-0.2.3.tar.gz", "has_sig": false, "md5_digest": "da95b347bb7f8904a48fa5836e406761", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9473, "upload_time": "2018-07-23T21:58:08", "url": "https://files.pythonhosted.org/packages/2c/d0/c1f6dd70d447a5692d7bc4f076044da56bd97f829ed098ea8ed3a24a4cb6/marsha-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "a1999cabb483b6a8c6d3a843b17d7767", "sha256": "6e41dceded88344c81320575333f50fcc86c14d0ac45f42a46731ecdf4b5ec98" }, "downloads": -1, "filename": "marsha-0.2.4.tar.gz", "has_sig": false, "md5_digest": "a1999cabb483b6a8c6d3a843b17d7767", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9474, "upload_time": "2018-07-23T22:17:34", "url": "https://files.pythonhosted.org/packages/90/9a/8ab8357aa223595fbeae160573a9cc762c6f33410fa387a3b2cb3d9c9651/marsha-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a1999cabb483b6a8c6d3a843b17d7767", "sha256": "6e41dceded88344c81320575333f50fcc86c14d0ac45f42a46731ecdf4b5ec98" }, "downloads": -1, "filename": "marsha-0.2.4.tar.gz", "has_sig": false, "md5_digest": "a1999cabb483b6a8c6d3a843b17d7767", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9474, "upload_time": "2018-07-23T22:17:34", "url": "https://files.pythonhosted.org/packages/90/9a/8ab8357aa223595fbeae160573a9cc762c6f33410fa387a3b2cb3d9c9651/marsha-0.2.4.tar.gz" } ] }