{ "info": { "author": "Nested Software", "author_email": "2969361+nestedsoftware@users.noreply.github.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Software Development" ], "description": "# Minimal Validator\n\n`minimal_validator` is a very simple validation framework for python. \n\n## Installation\n\nInstallation into a [virtualenv](https://docs.python.org/3/tutorial/venv.html) is recommended. Also see [pipenv](https://docs.pipenv.org/). \n\n* Install from [pipy](https://pypi.org/) as external dependency: `$ pip install minimal-validator`\n* Install source locally: `$ pip install -e .`\n* Run unit tests: `$ python setup.py test`\n\n## Overview\nMinimal validator is a very simple validation framework. The framework expects to run through a list of validation functions. Each validation function must have at least two parameters: `attribute` and `data`. The `attribute` is a string representing the attribute in the `data` object to be validated. Each validation function returns a `Result` object. Several validation functions for the same attribute can be chained together with the `combine_validators` function. The `combine_validation_results` function is used to perform all of the validations against a given `data` object. \n\nEach `Result` has a `keep_checking` boolean that defaults to `True`. For a given attribute, if `keep_checking` is `True`, the `validate_sequentially` function of `combine_validators` will continue gathering results. If it's `False`, `validate_sequentially` will not run any subsequent validations in the list. The idea is that some errors make it impossible to continue validating. For example, if an attribute is not set, then no further validation logic can be applied to it. On the other hand, for something like a password, a number of validations such as \"minimum length\" and \"presence of special characters\", etc. can be applied indepdendently. In that case the final result of the validation will include all such errors rather than stopping at the first error encountered. \n\n## Examples\nThe following is an example `validate_username_and_password` function (along with a few helper functions) taken from the unit tests:\n\n```python\ndef value_has_min_length_6(attribute, data):\n return value_has_min_length(attribute, data, 6) \n\ndef value_has_max_length_12(attribute, data):\n return value_has_max_length(attribute, data, 12) \n\ndef value_has_at_least_one_uppercase_char(attribute, data):\n return value_matches_at_least(attribute, data, \n list(string.ascii_uppercase), 1)\n\ndef value_has_at_least_one_special_symbol(attribute, data):\n return value_matches_at_least(attribute, data,\n list('!@#$%^&*'), 1)\n\n@pytest.fixture\ndef validate_username_and_password():\n def validate(data):\n username_validators = combine_validators('username', \n data, [attribute_exists, \n value_is_set, \n value_is_valid_email]) \n\n password_validators = combine_validators('password',\n data, [attribute_exists,\n value_is_set,\n value_has_min_length_6,\n value_has_max_length_12,\n value_has_at_least_one_uppercase_char,\n value_has_at_least_one_special_symbol])\n\n results = combine_validation_results(\n username_validators, \n password_validators)\n\n return [result.to_dict() for result in results] \n\n return validate\n```\n\nWhile the framework includes some validation functions, it will accept any function that takes `attribute` and `data` parameters and returns a valid `Result` object (or `None` if the validation passes and no validation messages are needed). \n\n\nIf you just need a single validation function for a given attribute, you can just wrap that function in a `lambda` instead of using `combine_validators`. \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/nestedsoftware/minimal_validator", "keywords": "validation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "minimal_validator", "package_url": "https://pypi.org/project/minimal_validator/", "platform": "", "project_url": "https://pypi.org/project/minimal_validator/", "project_urls": { "Homepage": "https://github.com/nestedsoftware/minimal_validator" }, "release_url": "https://pypi.org/project/minimal_validator/0.1.9/", "requires_dist": [ "email-validator" ], "requires_python": "", "summary": "Minimal validation framework", "version": "0.1.9" }, "last_serial": 4171330, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2073e496afc8bb1a2d2fd3d02a235a20", "sha256": "bfb5a5e33e30b104d64767f0629a4c4ccfc0ed1950ae3e0f256721983753006b" }, "downloads": -1, "filename": "minimal_validator-0.1.tar.gz", "has_sig": false, "md5_digest": "2073e496afc8bb1a2d2fd3d02a235a20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2236, "upload_time": "2018-06-28T22:47:07", "url": "https://files.pythonhosted.org/packages/71/0f/49b5cb2282e4e462322d52746ac9507e4c02f098fe3cbb2b180d2500d6eb/minimal_validator-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "480a5b44b4a99c0d399b53ea7d390b2e", "sha256": "ada41d610c2f1ec18730995293a5b1bc4f9c199823e68f8c5c3a536ecc548442" }, "downloads": -1, "filename": "minimal_validator-0.1.1.tar.gz", "has_sig": false, "md5_digest": "480a5b44b4a99c0d399b53ea7d390b2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2257, "upload_time": "2018-06-28T23:08:55", "url": "https://files.pythonhosted.org/packages/89/c1/1dc36bd82c4e0a453d896649e67c4fd061c6447debe7fb32c6ea40a76d5c/minimal_validator-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "96e42631523c0d55106bcc3e284aad01", "sha256": "6bb00a4f78fd5148a882b48eef840530b8ab4487cf0e76c046f886bb4bba65cb" }, "downloads": -1, "filename": "minimal_validator-0.1.2.tar.gz", "has_sig": false, "md5_digest": "96e42631523c0d55106bcc3e284aad01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3768, "upload_time": "2018-06-29T16:31:07", "url": "https://files.pythonhosted.org/packages/21/e5/953a8870c764dc5236247c8e924390843e6c283bcb504dfde1e43cf20d44/minimal_validator-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c87cf76366bba8c091c95f8f00f787f1", "sha256": "0a42ff9ac8e47a6c4654228922ab1b4f90778b2f13cb7f605947facb82a43368" }, "downloads": -1, "filename": "minimal_validator-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c87cf76366bba8c091c95f8f00f787f1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3886, "upload_time": "2018-06-29T16:48:13", "url": "https://files.pythonhosted.org/packages/f4/9f/d000d4575f8b44cf439d6b24e1a8148564095f587b3c6db97c130b0c2881/minimal_validator-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b7c626a2b3d247e9d350c6a5054424d", "sha256": "df6ead1c1027c6ec0ca32cafefd2f936fbd9d4cdf3d08686357d7286340f570a" }, "downloads": -1, "filename": "minimal_validator-0.1.3.tar.gz", "has_sig": false, "md5_digest": "3b7c626a2b3d247e9d350c6a5054424d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3813, "upload_time": "2018-06-29T16:48:16", "url": "https://files.pythonhosted.org/packages/55/ce/d479f2b7eee381f9cd0bb179a45ec397d462d404af3606932b463329a273/minimal_validator-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "d217ccea9e2a6ead44363182c7ba8520", "sha256": "5178bb08def709612cce044fecac9f00d1e08684ab65b59d52d9d1b06ded9fbd" }, "downloads": -1, "filename": "minimal_validator-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d217ccea9e2a6ead44363182c7ba8520", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3910, "upload_time": "2018-08-12T19:15:31", "url": "https://files.pythonhosted.org/packages/97/eb/5ecb5bbd9f0930bf3552e5fecca7d4b93e2dce1dc24fb81dffc8d954c918/minimal_validator-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8926beb746525e8ee1e08f1557fc3e47", "sha256": "7274cb261a99cba341be0085181050f7c0d5a4a565ba6d603610a755b00bdb89" }, "downloads": -1, "filename": "minimal_validator-0.1.4.tar.gz", "has_sig": false, "md5_digest": "8926beb746525e8ee1e08f1557fc3e47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3829, "upload_time": "2018-08-12T19:11:55", "url": "https://files.pythonhosted.org/packages/63/83/b9519bd86b111b1bcecfb88349f5ab7cf6a65b0f258478386b879e59f267/minimal_validator-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "2f4aed6d954620ccd4608c363877a6a3", "sha256": "8db9563a33580f766ed4758ef38c896734030914a151c8f730559c96efa78aa2" }, "downloads": -1, "filename": "minimal_validator-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "2f4aed6d954620ccd4608c363877a6a3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3909, "upload_time": "2018-08-12T19:17:41", "url": "https://files.pythonhosted.org/packages/fc/3b/ecde0b22085030e8b28fe7e0b045946c9fef8d4fc285e2960102268f1941/minimal_validator-0.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "357739fd7b691e7c8b67dce6a0f9fa6f", "sha256": "60fdc1e6fe1f0b5fbb879ac965a06c36fd956cad87ae0878b4a73d7ac829c964" }, "downloads": -1, "filename": "minimal_validator-0.1.5.tar.gz", "has_sig": false, "md5_digest": "357739fd7b691e7c8b67dce6a0f9fa6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3829, "upload_time": "2018-08-15T00:09:09", "url": "https://files.pythonhosted.org/packages/03/dc/75bf62d7547275903f0de034e91fffff6cc16a98bc2491dfa1894f5931e3/minimal_validator-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "efcde25b942f35b19d90ebe51e179815", "sha256": "37b5ebdf3708225c8c33fd4219b94128f69941a7ad40cb76c89e2b41b74f9c73" }, "downloads": -1, "filename": "minimal_validator-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "efcde25b942f35b19d90ebe51e179815", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3934, "upload_time": "2018-08-12T22:34:55", "url": "https://files.pythonhosted.org/packages/ea/5f/f4308db679118c94072ccd49ab53d3bae42e592f21456d7015b8539937b2/minimal_validator-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14258ce1b2452d70493632e55765d5d0", "sha256": "bc85b4ba35998666b9292b2cc8595639c37e6ee1448d057b2d9716c966f1efab" }, "downloads": -1, "filename": "minimal_validator-0.1.6.tar.gz", "has_sig": false, "md5_digest": "14258ce1b2452d70493632e55765d5d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3948, "upload_time": "2018-08-15T00:09:10", "url": "https://files.pythonhosted.org/packages/c9/bf/4621e33df55ae2a4786d5979f5f2a068b8280b1f2da0ab1ed66ac8b749ae/minimal_validator-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "b1e1dc289a2e5780b96143b1f0d6e5b3", "sha256": "27e1ab483659472fd4ec264b3984e9c4df05bc0625d2a52a76df45e609f20da3" }, "downloads": -1, "filename": "minimal_validator-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "b1e1dc289a2e5780b96143b1f0d6e5b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4028, "upload_time": "2018-08-15T00:09:04", "url": "https://files.pythonhosted.org/packages/1f/94/b44e9a1e721a6fba0ea5666dee3bd5334a66bcca7bab6e3499dc426fd803/minimal_validator-0.1.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "323006a556d60c4b572dee3b10913488", "sha256": "75f3e8d64bbd0371192029465ce40168388e8a6a277484c87ab3cd0d627f7b28" }, "downloads": -1, "filename": "minimal_validator-0.1.7.tar.gz", "has_sig": false, "md5_digest": "323006a556d60c4b572dee3b10913488", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3942, "upload_time": "2018-08-15T00:09:11", "url": "https://files.pythonhosted.org/packages/74/87/17cd38fd1d41ed308752b6b5dd5a0cfdf5845b2fe39f9ee2b04f8ba90884/minimal_validator-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "9530b6bf6b3eb6951966872eb470bbe2", "sha256": "299fc4cfc9b091dc7f93df3e548035ea95d54b88ab688d5d961d073fce442c24" }, "downloads": -1, "filename": "minimal_validator-0.1.8-py3-none-any.whl", "has_sig": false, "md5_digest": "9530b6bf6b3eb6951966872eb470bbe2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4036, "upload_time": "2018-08-15T00:09:06", "url": "https://files.pythonhosted.org/packages/fe/fd/229de927844229bd8101d87ef5a469fbd79442f9e937308e69cc52843073/minimal_validator-0.1.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7aa82e18079e9a73010f9678903de3d8", "sha256": "719f57f10d6621bf60dec55fd49a89842f9d6c62e264047493996139cbbb5890" }, "downloads": -1, "filename": "minimal_validator-0.1.8.tar.gz", "has_sig": false, "md5_digest": "7aa82e18079e9a73010f9678903de3d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3954, "upload_time": "2018-08-15T00:09:12", "url": "https://files.pythonhosted.org/packages/6d/11/798600e04d5ca8d9e7d5619445c8294920b4d1e32e912c9e4e7f8c3f7b35/minimal_validator-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "7ab72dd82dc083c5618000e3ba488b63", "sha256": "42aec20c8c5bf22aad678df5b12ce5ed6f833a2a6c1b944a27c9339172e903c0" }, "downloads": -1, "filename": "minimal_validator-0.1.9-py3-none-any.whl", "has_sig": false, "md5_digest": "7ab72dd82dc083c5618000e3ba488b63", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4232, "upload_time": "2018-08-15T00:09:07", "url": "https://files.pythonhosted.org/packages/48/a8/c9ce551dc244624dcaef3d791aac5c93311716475da855f618267979a6b8/minimal_validator-0.1.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5867755574b1e9b177b9cc6d195c2df1", "sha256": "02d615a5ca745e4560fa627491eee26459b97d434b0644cee9d493ee4f00c097" }, "downloads": -1, "filename": "minimal_validator-0.1.9.tar.gz", "has_sig": false, "md5_digest": "5867755574b1e9b177b9cc6d195c2df1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3989, "upload_time": "2018-08-15T00:09:13", "url": "https://files.pythonhosted.org/packages/92/15/da5f743ca214578fd87299466cd4040853f781b37bf2dd876c08b14b1ae9/minimal_validator-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ab72dd82dc083c5618000e3ba488b63", "sha256": "42aec20c8c5bf22aad678df5b12ce5ed6f833a2a6c1b944a27c9339172e903c0" }, "downloads": -1, "filename": "minimal_validator-0.1.9-py3-none-any.whl", "has_sig": false, "md5_digest": "7ab72dd82dc083c5618000e3ba488b63", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4232, "upload_time": "2018-08-15T00:09:07", "url": "https://files.pythonhosted.org/packages/48/a8/c9ce551dc244624dcaef3d791aac5c93311716475da855f618267979a6b8/minimal_validator-0.1.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5867755574b1e9b177b9cc6d195c2df1", "sha256": "02d615a5ca745e4560fa627491eee26459b97d434b0644cee9d493ee4f00c097" }, "downloads": -1, "filename": "minimal_validator-0.1.9.tar.gz", "has_sig": false, "md5_digest": "5867755574b1e9b177b9cc6d195c2df1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3989, "upload_time": "2018-08-15T00:09:13", "url": "https://files.pythonhosted.org/packages/92/15/da5f743ca214578fd87299466cd4040853f781b37bf2dd876c08b14b1ae9/minimal_validator-0.1.9.tar.gz" } ] }