{ "info": { "author": "Scott Stafford", "author_email": "scott.stafford+pylidator@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# pylidator\npylidator is a validation framework for Python projects.\n\nMany business systems have complex validation rules. This library provides a method of organizing those rules for\nconvenience and testability. A `validator` method is written for each rule (or group of rules), which simply returns a\nlist of errors if any are found.\n\n## Validators\n\nA validator method checks the validity of one or a closely-related group of\nassertions about a piece of data. They all look basically like this:\n\n```python\nimport pylidator\n\n@pylidator.validator(of=\"child\")\ndef child_is_valid(child):\n messages = []\n\n if child['age'] >= 18:\n messages.append({\"age\": \"Child is too old.\"}\n\n if child['type'] != 'human':\n messages.append({\"type\": \"Only humans allowed.\"}\n\n return messages\n```\n\n(Alternately, you can return just a dict of `{field: message}` items.)\n\n## Validating Something\n\nOnce you have authored some `@pylidator.validator` methods as above, you can use them! Try this:\n\n```python\nimport pylidator\n\nobjs = {\n 'name': \"Mrs. Teacher's Class\",\n 'children': [\n {'name': \"Joe\", 'age': 15, 'type': 'human'},\n {'name': \"Sarah\", 'age': 19, 'type': 'human'},\n ]\n}\n\n# Define a provider\ndef _provide_child(obj):\n for i, c in enumerate(obj['children']):\n yield c, {\"description\": \"Child {}\".format(i)}\n\nproviders = {\"child\": _provide_something} # \"child\" matches the `of` argument of the `@pylidator.validator`.\nret = pylidator.validate(objs, {pylidator.ERROR: [some_values_are_valid]}, providers=providers)\n```\n\n`child_is_valid` will be invoked once per child, and any that return something truthy will show as an ERROR.\n\n## Function Reference\n\n`@pylidator.validator` decorates any method that will be passed to `pylidator.validate`, and takes several optional parameters:\n\n```\n@pylidator.validator(of, requires=None, affects=None)\n\n`of` specifies what provider the validator should use. The `validate` call needs an item in `providers`\n that matches `of`.\n`requires` (optional) can add additional context items, such as the current time or other services that can supply\n data or settings to the validator. The requirement is fulfilled by passing `extra_context` to the `validate`\n call, containing any items that are used in a `requires`.\n`affects` (optional) is simply passed through to results. It can be used as guidance for UI/error reporting for\n helping to resolve any resultant errors.\n```\n\n```\npylidator.validate(\n obj, validators=None, providers=None, extra_context=None, field_name_mapper=None, \n validation_type=None)\n\n`obj` is the top-level object requiring validation.\n`validators` is a dict of {level: list of `@pylidator.validator` objects}\n`providers` is a dict of {of: func that takes obj and returns an iterable of some subobjects}\n`extra_context` is a dict of other data that can be injected into `@pylidator.validator` with `requires`.\n`field_name_mapper` is a string->string func that converts field names given in returned errors into verbose names.\n`validation_type` is added as documentation into the error object.\n`logging` If set to False, disables logging of validation results.\n`why` String added to logging to identify the logpoint.\n```\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/mathandpencil/pylidator", "keywords": "validation validate", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pylidator", "package_url": "https://pypi.org/project/pylidator/", "platform": "", "project_url": "https://pypi.org/project/pylidator/", "project_urls": { "Homepage": "https://github.com/mathandpencil/pylidator" }, "release_url": "https://pypi.org/project/pylidator/1.1.1/", "requires_dist": [ "future", "check-manifest ; extra == 'dev'", "coverage ; extra == 'test'" ], "requires_python": "", "summary": "A practical system for organizing validation rules.", "version": "1.1.1" }, "last_serial": 5821324, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "64357b65267239676f8f2afd64c54598", "sha256": "46c4763149a085abcd943d779540b92d769aeac21f540bb0f0955143367d3f85" }, "downloads": -1, "filename": "pylidator-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "64357b65267239676f8f2afd64c54598", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9116, "upload_time": "2019-06-06T02:56:00", "url": "https://files.pythonhosted.org/packages/bb/44/f80693fd7c22065e019dc9b4cc7bfc3476e23e8aa816e1fb94f9c784d3cd/pylidator-1.0.1-py2.py3-none-any.whl" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "b51ddf170ef8b03366bae8bbff9edf92", "sha256": "2cd6b799fbda3e02500c213e6d23d1e0434a28f4a941ab8e0d991919bce4f48f" }, "downloads": -1, "filename": "pylidator-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b51ddf170ef8b03366bae8bbff9edf92", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10037, "upload_time": "2019-06-06T03:08:52", "url": "https://files.pythonhosted.org/packages/99/0d/fed029b5fcc7d382561331596b0afa872cb33ecff9864b05e372ae2dcbe0/pylidator-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef3883dc9ca9fa093b34d68ed892e9d2", "sha256": "d7e0546a5f6b219997d86256b16dac4d1e35c8d558815b09c1284adea32eba8e" }, "downloads": -1, "filename": "pylidator-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ef3883dc9ca9fa093b34d68ed892e9d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8315, "upload_time": "2019-06-06T03:08:53", "url": "https://files.pythonhosted.org/packages/37/78/ea785dc399624b2944626dfe9ecd743f9ea1800773ba687f5905a769cd76/pylidator-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "60ecc809b806e4a567ffdbf0352cb610", "sha256": "fd55cb83fd46311dd833eecee28c92dcfc49c7b9874b820427a534d58c690c67" }, "downloads": -1, "filename": "pylidator-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "60ecc809b806e4a567ffdbf0352cb610", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10760, "upload_time": "2019-06-06T03:32:58", "url": "https://files.pythonhosted.org/packages/b9/b2/1ce63e3be88a9805ca60f25f5ed0c06b28f5221c6b029a21df01ee4e35ac/pylidator-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e581d692c164b5c02ec191d6c156d452", "sha256": "39839175ebf60d4facecee54306a5ccb8a94fd240c1f2972983d28019604816a" }, "downloads": -1, "filename": "pylidator-1.0.3.tar.gz", "has_sig": false, "md5_digest": "e581d692c164b5c02ec191d6c156d452", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9578, "upload_time": "2019-06-06T03:33:01", "url": "https://files.pythonhosted.org/packages/9a/24/f8f0ca621a2d2fb8fbb6dd08a2ba280c71bf12c5bb2c4a3f6c43398aac38/pylidator-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "a27d01ffbdd3e0e82fb02d93f67d86df", "sha256": "216a88b53475500caf80c603508634505f148d7a4e96e691e71edc5411c02cd6" }, "downloads": -1, "filename": "pylidator-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a27d01ffbdd3e0e82fb02d93f67d86df", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10768, "upload_time": "2019-07-16T14:35:08", "url": "https://files.pythonhosted.org/packages/de/73/23e70e89240477fcf475f2dd63b27c15c56315c4eba48835781c0ebd3345/pylidator-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "130734d27d41dd457b6024de151953ec", "sha256": "e2f1f06ddc053a6835a8cd755f2d8375fb83e3fe739d7fae30f9522aa8dc6909" }, "downloads": -1, "filename": "pylidator-1.0.4.tar.gz", "has_sig": false, "md5_digest": "130734d27d41dd457b6024de151953ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9588, "upload_time": "2019-07-16T14:35:11", "url": "https://files.pythonhosted.org/packages/fc/e3/b463555acada18563a5cec89c8f7740fe0298aa43378fc2c5ebf79a924b2/pylidator-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "3ce2c5c1710e1c29a994602c8cd21029", "sha256": "74b7cf6c7489067322c47ad39db6bf3bd1d16f31e8b1c7a51c54f461514d5103" }, "downloads": -1, "filename": "pylidator-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3ce2c5c1710e1c29a994602c8cd21029", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11016, "upload_time": "2019-08-30T19:36:42", "url": "https://files.pythonhosted.org/packages/5d/40/aecb489f710db9eb24abd663781574d746986e08ad6d7e08c8036100bf3f/pylidator-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "02cfa68f6b581d1e49ffb525f06888da", "sha256": "3333a379f5fe58495b962aa872330154690913182b5efc47ba17fd59c8e4640e" }, "downloads": -1, "filename": "pylidator-1.0.5.tar.gz", "has_sig": false, "md5_digest": "02cfa68f6b581d1e49ffb525f06888da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9610, "upload_time": "2019-08-30T19:36:46", "url": "https://files.pythonhosted.org/packages/84/2e/9d8ab311d6cc21fd5e1f3a08e94b2ec2ebabde8f083d851bb21ad1dfed34/pylidator-1.0.5.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "e70faa61c445d27a3a3705f19d1bb4b2", "sha256": "88411ac1d3aebc291f67213d852e6e56c7edd0b12c22a94948c72f3b0a207114" }, "downloads": -1, "filename": "pylidator-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e70faa61c445d27a3a3705f19d1bb4b2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15843, "upload_time": "2019-09-05T17:36:53", "url": "https://files.pythonhosted.org/packages/fd/0e/66c3e99623ccc10d132307848a70ccb5aeaf1d9dce23f0f9352b327698e8/pylidator-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da0e5a7c85a05fba1aaa5617429d0215", "sha256": "e9474cc762917b5c7d067e850fb691a057797c63f2d0c948824580cff196d663" }, "downloads": -1, "filename": "pylidator-1.1.0.tar.gz", "has_sig": false, "md5_digest": "da0e5a7c85a05fba1aaa5617429d0215", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10831, "upload_time": "2019-09-05T17:36:58", "url": "https://files.pythonhosted.org/packages/ac/6c/67e42d9b5553d7557bcf77122027a554fdee8d2a2de9829d21d465bfa74f/pylidator-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "609862df159014f1679d9141d65fe01e", "sha256": "7cda787e92ba94588bf01544bf81f867a3f9e1b7fadc01e06563c78c4a53360d" }, "downloads": -1, "filename": "pylidator-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "609862df159014f1679d9141d65fe01e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15954, "upload_time": "2019-09-12T16:10:45", "url": "https://files.pythonhosted.org/packages/e1/ae/b0c0c28fda370e0e47f19226e6fd905f07aab30a66656a302ccb9ffd50fa/pylidator-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e082491346d3c699fdbcb045d4bb74c", "sha256": "98f69c9b93449bf3a8917580863ae6b36a876e5709b78293a1d0b096fe67df75" }, "downloads": -1, "filename": "pylidator-1.1.1.tar.gz", "has_sig": false, "md5_digest": "0e082491346d3c699fdbcb045d4bb74c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2019-09-12T16:10:50", "url": "https://files.pythonhosted.org/packages/16/83/211877399eeb362775be9ed14e1cf5b7bd3d62da5c6ce97742d3e032ab41/pylidator-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "609862df159014f1679d9141d65fe01e", "sha256": "7cda787e92ba94588bf01544bf81f867a3f9e1b7fadc01e06563c78c4a53360d" }, "downloads": -1, "filename": "pylidator-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "609862df159014f1679d9141d65fe01e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15954, "upload_time": "2019-09-12T16:10:45", "url": "https://files.pythonhosted.org/packages/e1/ae/b0c0c28fda370e0e47f19226e6fd905f07aab30a66656a302ccb9ffd50fa/pylidator-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e082491346d3c699fdbcb045d4bb74c", "sha256": "98f69c9b93449bf3a8917580863ae6b36a876e5709b78293a1d0b096fe67df75" }, "downloads": -1, "filename": "pylidator-1.1.1.tar.gz", "has_sig": false, "md5_digest": "0e082491346d3c699fdbcb045d4bb74c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10946, "upload_time": "2019-09-12T16:10:50", "url": "https://files.pythonhosted.org/packages/16/83/211877399eeb362775be9ed14e1cf5b7bd3d62da5c6ce97742d3e032ab41/pylidator-1.1.1.tar.gz" } ] }