{ "info": { "author": "Tomoya Kose", "author_email": "tomoya@mitsuse.jp", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# typedjson\n\n[![License][license-badge]][license]\n[![Pypi][pypi-badge]][pypi]\n[![CI][ci-badge]][ci]\n\nJSON decoding for Python with type hinting (PEP 484).\n\n\n## Requirements and Restrictions\n\n- Python >= 3.6\n- Use non-generic or parameterized class to decode JSON.\n- Use type hints without forward references.\n\n\n## Features\n\n- Support decoding types as below:\n - primitive types like `str`, `int`, `float`, `bool` and `None`.\n - `Union` and `Optional`.\n - homogeneous and heterogeneous `Tuple` and `List`.\n - variable-length `Tuple`.\n - non-generic and parameterized dataclasses.\n- Support API like `json.load` and `json.loads`.\n\n\n## Example\n\n\n```python\nfrom typing import Optional\n\nimport typedjson\nfrom dataclasses import dataclass\n\n\n@dataclass(frozen=True)\nclass NameJson:\n first: str\n last: Optional[str]\n\n\n@dataclass(frozen=True)\nclass CatJson:\n id: str\n age: int\n name: Optional[NameJson]\n\n\njson = {\n 'id': 'test-cat',\n 'age': 13,\n 'name': {\n 'first': 'Jiji',\n },\n}\n\nprint(typedjson.decode(CatJson, json)) # Output: CatJson(id='test-cat', age=13, name=NameJson(first='Jiji', last=None))\n\nprint(typedjson.decode(CatJson, {})) # Output: DecodingError(TypeMismatch(('id',)))\n```\n\nPlease refer to [test codes](/tests/) for more detail.\n\n\n## Contributions\n\nPlease read [CONTRIBUTING.md](/CONTRIBUTING.md).\n\n\n## TODO\n\n- Prohibit decoding `Set` and `Dict` explicitly.\n- Provide the API document.\n- Explain why typedjson uses undocumented APIs.\n- Explain what typedjson resolves.\n- Improve API to dump like `json.dump` and `json.dumps`.\n - Provide mypy plugin to check whether the class is encodable as JSON or not with `@typedjson.encodable` decorator.\n- Support type hints with forward reference.\n\n\n[license-badge]: https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat-square\n[license]: LICENSE\n[pypi-badge]: https://img.shields.io/pypi/v/typedjson.svg?style=flat-square\n[pypi]: https://pypi.org/project/typedjson/\n[ci-badge]: https://img.shields.io/travis/mitsuse/typedjson-python/master.svg?style=flat-square\n[ci]: https://travis-ci.org/mitsuse/typedjson-python\n[pep-563]: https://www.python.org/dev/peps/pep-0563/\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "Tomoya Kose", "maintainer_email": "tomoya@mitsuse.jp", "name": "typedjson", "package_url": "https://pypi.org/project/typedjson/", "platform": "", "project_url": "https://pypi.org/project/typedjson/", "project_urls": null, "release_url": "https://pypi.org/project/typedjson/0.7.4/", "requires_dist": [ "dataclasses (>=0.6.0,<0.7.0)", "typing-extensions (>=3.7,<4.0)", "black (==19.03b)" ], "requires_python": ">=3.6,<4.0", "summary": "JSON decoding for Python with type hinting (PEP 484)", "version": "0.7.4" }, "last_serial": 5343354, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "efad672d80b8d9d030e32bb1e4f797b6", "sha256": "3027ac74e31d1a1d25f5c6315d3aeb87c0a8c7459dd3eaa70e3a37fc8a918d95" }, "downloads": -1, "filename": "typedjson-0.1.0.tar.gz", "has_sig": false, "md5_digest": "efad672d80b8d9d030e32bb1e4f797b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2878, "upload_time": "2018-12-18T12:34:50", "url": "https://files.pythonhosted.org/packages/84/40/42ee81c9e6bfcf532a6e644e43703099238616ef4b57d1442f3023804194/typedjson-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "957f69b261a6bb5ea86f75e02ddd2e1f", "sha256": "60365845d4cd379792280f610a19100dbbf7ea7bbc683a28f596c6b9632db4bf" }, "downloads": -1, "filename": "typedjson-0.2.0.tar.gz", "has_sig": false, "md5_digest": "957f69b261a6bb5ea86f75e02ddd2e1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3244, "upload_time": "2018-12-22T18:04:23", "url": "https://files.pythonhosted.org/packages/dc/6b/f3783da4bb523c92bfcdc6422d96eb223b5947ad073508896526227f2fb8/typedjson-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "a34251118a1e8442c548da169c342749", "sha256": "dce1a1961e09398ef816cf296c4049a67f209b100bce11ba2672bf66f089be7e" }, "downloads": -1, "filename": "typedjson-0.3.0.tar.gz", "has_sig": false, "md5_digest": "a34251118a1e8442c548da169c342749", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3591, "upload_time": "2018-12-24T16:22:59", "url": "https://files.pythonhosted.org/packages/69/7a/20ecfea6b3cf1caf37ac8a02bb430d1ba19a9a501f8ac82eb31b2c1c4db7/typedjson-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "42954c08da224c50f32cb7565d1ba1d4", "sha256": "36be6d759dcf608a41f9995f8503831da5ae8979756ed09b41b18ae636ac67cf" }, "downloads": -1, "filename": "typedjson-0.4.0.tar.gz", "has_sig": false, "md5_digest": "42954c08da224c50f32cb7565d1ba1d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3835, "upload_time": "2018-12-26T08:47:08", "url": "https://files.pythonhosted.org/packages/ce/d4/fa2cc33b4e31d5daf322e54beb21c950608c90b34f566301fdb958386416/typedjson-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "69ffebba06211295e6e601ea1a09f670", "sha256": "c290ab3c11adcc817eb2a749c51db92180554214bc0a1ab0a80506884ac16909" }, "downloads": -1, "filename": "typedjson-0.5.0.tar.gz", "has_sig": false, "md5_digest": "69ffebba06211295e6e601ea1a09f670", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4045, "upload_time": "2018-12-30T17:57:56", "url": "https://files.pythonhosted.org/packages/c0/2f/4acd2b17eaec7cb70e58308f498a54d4df1cbe3a2ad3888ac9511751e781/typedjson-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "aad26a32f3c5ff7b9a1ab3c5f61a8455", "sha256": "36967d368d496a3fb494ecc76044291515a3107d98db7e7671c5a81b74c7836d" }, "downloads": -1, "filename": "typedjson-0.6.0.tar.gz", "has_sig": false, "md5_digest": "aad26a32f3c5ff7b9a1ab3c5f61a8455", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4580, "upload_time": "2019-01-06T07:54:15", "url": "https://files.pythonhosted.org/packages/85/bc/b1c84e2357ac90e60480995377e375d98deb1d060074333e350e0ac0e508/typedjson-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "5db882e9b9b838ee304df00db67ed481", "sha256": "6af379efd1607bf608101137690b766972643dd51be3cf5b969cdf2dd2cfd660" }, "downloads": -1, "filename": "typedjson-0.7.0.tar.gz", "has_sig": false, "md5_digest": "5db882e9b9b838ee304df00db67ed481", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4603, "upload_time": "2019-01-15T00:39:51", "url": "https://files.pythonhosted.org/packages/6e/4a/fc8be38e57c90585821239d47168de08fc83963b5a1a8770e492225d5abf/typedjson-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "365b6764bb8900da4ae648f3be57df67", "sha256": "c4560d71749e24f702eb32d9dfdc2741c99514d9ee7c76c98131676149c5fc77" }, "downloads": -1, "filename": "typedjson-0.7.1.tar.gz", "has_sig": false, "md5_digest": "365b6764bb8900da4ae648f3be57df67", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4606, "upload_time": "2019-01-16T13:40:40", "url": "https://files.pythonhosted.org/packages/f4/5a/d2e89070c584a4471f316ff6d4a75c043f4c37f643aba196f4036cc727fa/typedjson-0.7.1.tar.gz" } ], "0.7.3": [ { "comment_text": "", "digests": { "md5": "f6830d1dcc050471efbf459632be1175", "sha256": "8745fc32041421baec8124579eb2840be49cd012d6d2df4e77dd1e60ae0ef8f3" }, "downloads": -1, "filename": "typedjson-0.7.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f6830d1dcc050471efbf459632be1175", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 6194, "upload_time": "2019-05-29T16:03:57", "url": "https://files.pythonhosted.org/packages/f8/e5/7a5e714e73f976aa16f3bbf3821ff857c11f66f341a49acbaed6d56d7ab0/typedjson-0.7.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "542c49f615d8d0b8c4650c6db2d0aebb", "sha256": "0b2e278472ec3259c0987ca3e62d663781dae0e2c4682f48c55faf0008dab1cb" }, "downloads": -1, "filename": "typedjson-0.7.3.tar.gz", "has_sig": false, "md5_digest": "542c49f615d8d0b8c4650c6db2d0aebb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5319, "upload_time": "2019-05-29T16:03:58", "url": "https://files.pythonhosted.org/packages/e6/e5/3fd84de302e31ff23a9c3453af81bf3c9c953524cdb3bb0d9c6bf67073e0/typedjson-0.7.3.tar.gz" } ], "0.7.4": [ { "comment_text": "", "digests": { "md5": "7f3242e3c746a84f46729b1c0b9d5bb0", "sha256": "1dcc5a90fa0ed096f9e54b8a91a3b587f6728d3697f55c2498eb28e46851488a" }, "downloads": -1, "filename": "typedjson-0.7.4-py3-none-any.whl", "has_sig": false, "md5_digest": "7f3242e3c746a84f46729b1c0b9d5bb0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 6225, "upload_time": "2019-05-31T15:34:46", "url": "https://files.pythonhosted.org/packages/91/63/8541f4d58fccb1981f020056146911493b80b862d7127293df336bb6accf/typedjson-0.7.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60dceaeb297c69e5887b474c64fedd46", "sha256": "dac1e2d31560463b9477fc555b1a78bae2d19d1fdb295983c5576ab9c8566dd2" }, "downloads": -1, "filename": "typedjson-0.7.4.tar.gz", "has_sig": false, "md5_digest": "60dceaeb297c69e5887b474c64fedd46", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5315, "upload_time": "2019-05-31T15:34:48", "url": "https://files.pythonhosted.org/packages/7a/34/33f31aa65e04901c047b20b70e78d695f028000a46d337af900b641b34c3/typedjson-0.7.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f3242e3c746a84f46729b1c0b9d5bb0", "sha256": "1dcc5a90fa0ed096f9e54b8a91a3b587f6728d3697f55c2498eb28e46851488a" }, "downloads": -1, "filename": "typedjson-0.7.4-py3-none-any.whl", "has_sig": false, "md5_digest": "7f3242e3c746a84f46729b1c0b9d5bb0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 6225, "upload_time": "2019-05-31T15:34:46", "url": "https://files.pythonhosted.org/packages/91/63/8541f4d58fccb1981f020056146911493b80b862d7127293df336bb6accf/typedjson-0.7.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60dceaeb297c69e5887b474c64fedd46", "sha256": "dac1e2d31560463b9477fc555b1a78bae2d19d1fdb295983c5576ab9c8566dd2" }, "downloads": -1, "filename": "typedjson-0.7.4.tar.gz", "has_sig": false, "md5_digest": "60dceaeb297c69e5887b474c64fedd46", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 5315, "upload_time": "2019-05-31T15:34:48", "url": "https://files.pythonhosted.org/packages/7a/34/33f31aa65e04901c047b20b70e78d695f028000a46d337af900b641b34c3/typedjson-0.7.4.tar.gz" } ] }