{ "info": { "author": "Nitipit Nontasuwan", "author_email": "nitipit@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "\n\n## Python `dict` and `json` verification for humankind :)\n\n`dictify` is python library to verify `dict` object and `json` with easy syntax and chainable rules.\n\n## Install\n```bash\npip install dictify\n```\n\n## Example:\n```python\nfrom dictify import *\nimport uuid\n\nclass User(Model):\n id = Field().default(uuid.uuid4()).type(uuid.UUID)\n name = Field().required().type(str).length(max=100)\n email = Field().required().match('.+@.+')\n gender = Field().anyof(['m', 'f'])\n age = Field().number(min=0, max=150)\n```\n\n## Features\n### Auto verify new dict object.\n```python\n>>> user = User()\nValueError: {'name': ['Required.'], 'email': ['Required.']}\n\n>>> user = User({\n... 'name': 'test-user',\n... 'email': 'user@example.com'\n... })\n\n>>> user\n{'id': UUID('11fadebb-3c70-47a9-a3f0-ebf2a3815993'),\n 'name': 'test-user',\n 'email': 'user@example.com',\n 'gender': None,\n 'age': None}\n```\n\n### Verify dict object on the fly.\n```python\n>>> user['age'] = 200 # user['age'] rule is number(min=0, max=150)\nValueError: ['Value is 200, must be 0 to 150']\n>>> user['age'] = 20\n>>> user['gender'] = 'm'\n{'name': 'test-user',\n 'email': 'user@example.com',\n 'id': UUID('b3acc59d-93cc-4f58-92d6-a3340b7a6678'),\n 'gender': 'm',\n 'age': 20}\n```\n\n### Chainable rules.\nAs you can see in `User(Model)` in example above, fields' rules is chainable.\n```python\nname = Field().required().type(str).length(max=100)\n# `name` value required string type with max length = 100\n```\n\n## To use with `json`\nuse `json` package to transform between `json` and `dict`\n```python\nfrom dictify import *\nimport json\n\nclass User(Model):\n name = Field().required().type(str).length(max=100)\n email = Field().required().type(str).length(max=100)\n\nuser = json.loads('{\"name\": \"test-user\", \"email\": \"user@example.com\"}')\nuser = User(user)\n```\n\n## Rules\n- `anyof(members: list)`: Value must be any of defined `members`\n- `apply(func: function)`: Apply function to value. The applied function will get field's value as it's first argument. For example:\n ```python\n from dictify import Model, Field\n import uuid\n from unittest import TestCase\n\n test_case = TestCase()\n\n class User(Model):\n def uuid4_rule(value):\n id_ = uuid.UUID(value)\n test_case.assertEqual(id_.version, 4)\n\n id_ = Field().apply(uuid4_rule)\n ```\n- `default(default_: Any)`: Set default value.\n- `length(min: int, max: int)`: min/max constrain to value's length using `len()`.\n- `listof(type_: type)`: A list which contain object type as specified. For example:\n ```python\n comments = Field().listof(str)\n ```\n- `match(re_: 'regex pattern')`: Check value match with regex pattern.\n- `number(min: 'number', max: 'number')`: Define min/max number constrain to value.\n- `required()`: Value is required (Not `None` or `''`).\n- `subset(members: list)`: Value must be subset of defined `members`\n- `type(type_: type`): Define value's type.\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/nitipit/dictify", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "dictify", "package_url": "https://pypi.org/project/dictify/", "platform": "", "project_url": "https://pypi.org/project/dictify/", "project_urls": { "Homepage": "https://github.com/nitipit/dictify" }, "release_url": "https://pypi.org/project/dictify/1.1.3/", "requires_dist": null, "requires_python": "", "summary": "Python `dict` and `json` verification for humankind :)", "version": "1.1.3" }, "last_serial": 4850473, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "445868171a3b1dfe82d5e7d252055c34", "sha256": "121799f20d96f2ec46f25a0f9c4a19aadbac1e920512e947d456c57b2469eed8" }, "downloads": -1, "filename": "dictify-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "445868171a3b1dfe82d5e7d252055c34", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 1819, "upload_time": "2018-08-18T10:02:40", "url": "https://files.pythonhosted.org/packages/81/e8/8adda81241eedd2bb8ad5c67b4ca1f44458dd73568fd289eeb9df85d656e/dictify-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e84dec5dcf042cea325f2737fb0d6688", "sha256": "be579f6329614ad1174150d0cc375d06816391a7634c64534be53c28d953969d" }, "downloads": -1, "filename": "dictify-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e84dec5dcf042cea325f2737fb0d6688", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1446, "upload_time": "2018-08-18T10:02:42", "url": "https://files.pythonhosted.org/packages/fd/93/5848ed4b1012857e7fb1be265c1c54e9905f2a821e29f94d978bb496bc50/dictify-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "a4ffcc139dc624ef900f4986c1220faa", "sha256": "ad65f4545decc6e99a07b05ee2c75baca4a28e62d049d180ebbe3b54686a5a28" }, "downloads": -1, "filename": "dictify-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a4ffcc139dc624ef900f4986c1220faa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4748, "upload_time": "2018-08-22T18:52:18", "url": "https://files.pythonhosted.org/packages/95/22/d79c2898597c6764a0b2a6cf6ed54aff182abb33101b3628cd0487561d0d/dictify-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "97e49f06b642df7de8a45e1f93d37eb3", "sha256": "8c6aaa4a9ced014034cc668e67fc816e1c995c52fb8356156b8196ed6a45d3d9" }, "downloads": -1, "filename": "dictify-0.1.0.tar.gz", "has_sig": false, "md5_digest": "97e49f06b642df7de8a45e1f93d37eb3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4352, "upload_time": "2018-08-22T18:52:19", "url": "https://files.pythonhosted.org/packages/40/d0/922336943fe5c0b54944b60e0b389004dbc5d9ee4a78a9582fad231acf33/dictify-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "511a8fa5b797b3fe2b71f3871ec65235", "sha256": "a04a31b8253f82d0044e0428b9f06a11f747ba6043c4525589637ef63a6a517d" }, "downloads": -1, "filename": "dictify-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "511a8fa5b797b3fe2b71f3871ec65235", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5134, "upload_time": "2018-08-23T20:08:27", "url": "https://files.pythonhosted.org/packages/62/60/25c461c737e473076b17a886e203cc65fced12cf2652ce58c1158671267a/dictify-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c62ce3010ad49503001b4b2f5ca793ff", "sha256": "0a30c10d712ebe6b9a371fd083ba86258bb8c1d50c41ad8d864827555824231f" }, "downloads": -1, "filename": "dictify-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c62ce3010ad49503001b4b2f5ca793ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4770, "upload_time": "2018-08-23T20:08:30", "url": "https://files.pythonhosted.org/packages/78/e3/e492e7b5dc6eb78b7da6f51dedb3cd0e058167fecfa9cebf108657dd76df/dictify-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7e63c3428bf8893dc81bd448760073db", "sha256": "e3eee2be70f0cf40a02c59497715026b79b09b181f40031b26544dc2fa21204c" }, "downloads": -1, "filename": "dictify-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7e63c3428bf8893dc81bd448760073db", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5197, "upload_time": "2018-09-09T10:45:07", "url": "https://files.pythonhosted.org/packages/2e/f5/b0082e58231312d17985ecbcf95417fa3b6fb9f954189e396ae7eb170bc0/dictify-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb664cb7c8958972d486b529da389849", "sha256": "dc9230922f56926275872063e3e2aea5b3c701d8d1bc767a1d9747306f8762bd" }, "downloads": -1, "filename": "dictify-0.1.2.tar.gz", "has_sig": false, "md5_digest": "eb664cb7c8958972d486b529da389849", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4825, "upload_time": "2018-09-09T10:45:09", "url": "https://files.pythonhosted.org/packages/e1/8b/8f03606052b40a31f8f9e64979256f8f15a132d72807046e77643009a515/dictify-0.1.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "66abde8945d86dd1f13068bc6847f335", "sha256": "7df70bd6f8379214306c390effbf11a363646feb4252bab2fab317ac294300f9" }, "downloads": -1, "filename": "dictify-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "66abde8945d86dd1f13068bc6847f335", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6229, "upload_time": "2018-11-16T08:19:41", "url": "https://files.pythonhosted.org/packages/a2/75/0f3c9435575afca927eb5503e811d4d3fbfb7e51f4edb4761bbd369fab03/dictify-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f60b56b7d428c52805c6d8680e533c0d", "sha256": "7648d02ba3a0fc0d16b2dc40403b7d0bcc4619fc00a36c4f8bd3ae3e7655139d" }, "downloads": -1, "filename": "dictify-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f60b56b7d428c52805c6d8680e533c0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4949, "upload_time": "2018-11-16T08:19:43", "url": "https://files.pythonhosted.org/packages/00/55/fd4ecf9d1cdce2b0f162b8565fe03b083bf0acf2f16044d7e4be2f82cfe2/dictify-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "329db2cea47fc288a5ed589354ac9cd6", "sha256": "6d80e7c1c6fd6943893c1cc065385ca5f1e68c70cd96aa066017304f94df9ab9" }, "downloads": -1, "filename": "dictify-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "329db2cea47fc288a5ed589354ac9cd6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6318, "upload_time": "2018-11-16T19:24:42", "url": "https://files.pythonhosted.org/packages/1d/46/99e9c7b4a03c5d42a2e27f5734545454326c6ab6d232a6a5c1d6e1ada173/dictify-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8fa9821674615976aed4b651eae3baa", "sha256": "552b6c6e9a2ee2b7a5b5f3743d49b21054d6e212e2817aa33dfa9ebb68c290bf" }, "downloads": -1, "filename": "dictify-1.1.0.tar.gz", "has_sig": false, "md5_digest": "f8fa9821674615976aed4b651eae3baa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5023, "upload_time": "2018-11-16T19:24:43", "url": "https://files.pythonhosted.org/packages/f9/a9/d497aa7c1406393ec07b07a4bba54d0dd6771b6cbe39b4b102b658c285e4/dictify-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "90ec59242125a46e4c293c8c95611783", "sha256": "a5ef1acee88275370f488816fb20e87c53561b1b61d6d480526847e301870c37" }, "downloads": -1, "filename": "dictify-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "90ec59242125a46e4c293c8c95611783", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6257, "upload_time": "2018-12-16T18:48:27", "url": "https://files.pythonhosted.org/packages/b8/14/33571f5537cfaf3d7a6c6afef3771cb90f6cd095ce2798b00d1e7d0ca66b/dictify-1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "82acb10b6bb8418208003baef3ba9780", "sha256": "25da13cdbdc08491abc9d45b6080659f53f00619c1438e07a786d12b2319f96f" }, "downloads": -1, "filename": "dictify-1.1.1.tar.gz", "has_sig": false, "md5_digest": "82acb10b6bb8418208003baef3ba9780", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4962, "upload_time": "2018-12-16T18:48:29", "url": "https://files.pythonhosted.org/packages/e3/05/1a8dca5d21d907d48ec1e17fe6125f3321bbaf4da162d52492e7ffd66451/dictify-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "60b690e9505b50c17c43e35a6885bc47", "sha256": "c2438ab180ee94b23d8dff3c0f87c73fd76a2e1d62b205956235eeca0a40216a" }, "downloads": -1, "filename": "dictify-1.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "60b690e9505b50c17c43e35a6885bc47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6411, "upload_time": "2019-01-04T08:04:05", "url": "https://files.pythonhosted.org/packages/4f/df/3f40494577028c5cc5474b8768d1993087c4c5665194a7ea5b46cee7fed6/dictify-1.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "df748b83dcf2e15b7439fd3237a889ac", "sha256": "4a382c29613fb44023696ae22463e95e735050e81fae3bd8ab2f5d89d9c7bd88" }, "downloads": -1, "filename": "dictify-1.1.2.tar.gz", "has_sig": false, "md5_digest": "df748b83dcf2e15b7439fd3237a889ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5072, "upload_time": "2019-01-04T08:04:07", "url": "https://files.pythonhosted.org/packages/ae/c5/6a2c7f8d67f11f3a6689d96ec4f3aa4a6537ec7bef85283145b09b486e1e/dictify-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "3443e425c94b4340cfffa3933c450b77", "sha256": "a9c16beb47435647f9307ead02effa9da93b6faada0cce499a1e9073c6f5c0e3" }, "downloads": -1, "filename": "dictify-1.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3443e425c94b4340cfffa3933c450b77", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6422, "upload_time": "2019-02-21T14:59:38", "url": "https://files.pythonhosted.org/packages/94/29/4086e5145d7a86a7327f0378dbfb3a79ab5d3446b873f66866df031174c4/dictify-1.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a20aa3cde9ccadbd49f4c3dd6a8d42c3", "sha256": "c92d99b34755bf4323a027f9a055c93116e2a94aab07f708aa42496b8ad6f8ac" }, "downloads": -1, "filename": "dictify-1.1.3.tar.gz", "has_sig": false, "md5_digest": "a20aa3cde9ccadbd49f4c3dd6a8d42c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5087, "upload_time": "2019-02-21T14:59:40", "url": "https://files.pythonhosted.org/packages/8c/bd/3af1a9ec2bb90e03c688c4d36c4236b1f88052a51a42fd653b86129a4990/dictify-1.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3443e425c94b4340cfffa3933c450b77", "sha256": "a9c16beb47435647f9307ead02effa9da93b6faada0cce499a1e9073c6f5c0e3" }, "downloads": -1, "filename": "dictify-1.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "3443e425c94b4340cfffa3933c450b77", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6422, "upload_time": "2019-02-21T14:59:38", "url": "https://files.pythonhosted.org/packages/94/29/4086e5145d7a86a7327f0378dbfb3a79ab5d3446b873f66866df031174c4/dictify-1.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a20aa3cde9ccadbd49f4c3dd6a8d42c3", "sha256": "c92d99b34755bf4323a027f9a055c93116e2a94aab07f708aa42496b8ad6f8ac" }, "downloads": -1, "filename": "dictify-1.1.3.tar.gz", "has_sig": false, "md5_digest": "a20aa3cde9ccadbd49f4c3dd6a8d42c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5087, "upload_time": "2019-02-21T14:59:40", "url": "https://files.pythonhosted.org/packages/8c/bd/3af1a9ec2bb90e03c688c4d36c4236b1f88052a51a42fd653b86129a4990/dictify-1.1.3.tar.gz" } ] }