{ "info": { "author": "Ben Mather", "author_email": "bwhmather@bwhmather.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Python Validation\n=================\n\n|build-status| |coverage|\n\n.. |build-status| image:: https://travis-ci.org/bwhmather/python-validation.svg?branch=develop\n :target: https://travis-ci.org/bwhmather/python-validation\n :alt: Build Status\n.. |coverage| image:: https://coveralls.io/repos/github/bwhmather/python-validation/badge.svg?branch=develop\n :target: https://coveralls.io/github/bwhmather/python-validation?branch=develop\n :alt: Coverage\n\n.. begin-docs\n\nA simple Python library containing functions that check Python values.\nIt is intended to make it easy to verify commonly expected pre-conditions on\narguments to functions.\n\nOriginally developed and open-sourced at `Joivy Ltd `_.\n\n\nInstallation\n------------\n.. begin-installation\n\nThe ``validation`` library is available on `PyPI `_.\n\nIt can be installed manually using pip.\n\n.. code:: bash\n\n $ pip install validation\n\nAs this library is a useful tool for cleaning up established codebases, it will\ncontinue to support Python 2.7 for the foreseeable future.\nThe string validation functions are particularly handy for sorting out unicode\nissues in preparation for making the jump to Python 3.\n\n.. end-installation\n\n\nUsage\n-----\n.. begin-usage\n\nThe validation functions provided by this library are intended to be used at\nthe head of public functions to check their arguments.\n\n.. code:: python\n\n from validation import (\n validate_int, validate_float,\n validate_structure,\n validate_text,\n )\n\n\n def function(int_arg, dict_arg, unicode_arg=None):\n \"\"\"\n A normal function that expects to be called in a particular way.\n\n :param int int_arg:\n A non-optional integer. Must be between one and ten.\n :param dict dict_arg:\n A dictionary containing an integer ID, and a floating point amount.\n :param str unicode_arg:\n An optional string.\n \"\"\"\n validate_int(int_arg, min_value=0, max_value=10)\n validate_structure(dict_arg, schema={\n 'id': validate_int(min_value=0)\n 'amount': validate_float(),\n })\n validate_text(unicode_argument, required=False)\n\n # Do something.\n ...\n\n\nExceptions raised by the validation functions are allowed to propagate through.\nEverything is inline, with no separate schema object or function.\n\n.. end-usage\n\n\nDesign\n------\n.. begin-design\n\nWhat `validation` does\n~~~~~~~~~~~~~~~~~~~~~~\nThis library contains a number of functions that will check their first\nargument if one is provided, or return a closure that can be used later.\n\nFunctions check values against a semantic type, not a concrete type.\n``validate_structure`` and ``validate_mapping`` both expect dictionaries, but\ndiffer in whether they treat the keys as names or keys.\n``validate_text`` exists, but we also provide special validators\nfor email addresses and domain names.\n\nFunctions are fairly strict by default.\n``validate_float``, for example, will reject ``NaN`` unless explicitly allowed.\nOn Python 2 ``validate_text`` will enforce the use of unicode.\n\nIntended to be mixed with normal Python code to perform more complex\nvalidation.\nAs an example, the library provides no tools to assert that to values are\nmutually exclusive as this requirement is much more clearly expressed with a\nsimple ``if`` block.\n\nBasic support for validating simple data-structures is implemented.\n\n\nWhat `validation` does not do\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe ``validation`` library is not a schema definition language.\nValidation functions and closures are not designed to be introspectable, and\nare expected to be used inline.\n\nIt is not intended for validating serialized, or partially serialized data.\nWhile there is some support for validating structured dictionaries, it does not\nextend to handling any of the many ways to represent a sum types in json.\nMore complicated data-structures should generally be represented as classes,\nand validation pushed to the constructors.\n\nExceptions raised by the validation library are not intended to be caught.\nWe assume that validation failures indicate that the caller is being used\nincorrectly and that the error and will be interpreted by a programmer and not\nthe machine.\n\nWe use built-in exception classes rather than defining custom ones so that\nlibraries that use our functions can allow them to fall through their public\ninterface.\n\nFinally, the ``validation`` library does not perform any kind of sanitization.\nIts purpose is to catch mistakes, not paper over them.\nValues passed in to the library will never be modified.\n\n.. end-design\n\n\nLinks\n-----\n\n- Source code: https://github.com/bwhmather/python-validation\n- Issue tracker: https://github.com/bwhmather/python-validation/issues\n- Continuous integration: https://travis-ci.org/bwhmather/python-validation\n- PyPI: https://pypi.python.org/pypi/validation\n\n\nLicense\n-------\n\nThe project is made available under the terms of the Apache 2.0 license. See `LICENSE <./LICENSE>`_ for details.\n\n\n\n.. end-docs", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bwhmather/python-validation", "keywords": "", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "validation", "package_url": "https://pypi.org/project/validation/", "platform": "", "project_url": "https://pypi.org/project/validation/", "project_urls": { "Homepage": "https://github.com/bwhmather/python-validation" }, "release_url": "https://pypi.org/project/validation/0.5.0/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "A library for runtime type checking and validation of python values", "version": "0.5.0" }, "last_serial": 4657300, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7c1eec674715ea27999b98f87272ab3f", "sha256": "9c2002d3dda9ca0983aea87ffee743d782cb8d6291da41ff3cc666919e7713e5" }, "downloads": -1, "filename": "validation-0.1.0.zip", "has_sig": false, "md5_digest": "7c1eec674715ea27999b98f87272ab3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15435, "upload_time": "2017-08-22T12:45:12", "url": "https://files.pythonhosted.org/packages/e0/05/24a57bce52363324d9d6acbf2e7bc33a458b5a1d0f7681276785aebf74b3/validation-0.1.0.zip" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4d4ccf82f69e68542e1edc66c7da4e64", "sha256": "0728413997aa3326bca4b3fd35e901cfde78a99e0bbb8f24bbfbbb732f6888b6" }, "downloads": -1, "filename": "validation-0.1.1.zip", "has_sig": false, "md5_digest": "4d4ccf82f69e68542e1edc66c7da4e64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16609, "upload_time": "2017-08-22T14:38:23", "url": "https://files.pythonhosted.org/packages/67/e8/aa2f320e5371f129ecea93f7f3b4295ee0cd8dea889ffbe0ffc0eb347bea/validation-0.1.1.zip" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d3cf0ca0804433352520f84dfdc37d7f", "sha256": "b1ca9966981f01ba69a88dca51be67048ef52d16b5e4847e2a4756a4baf8ee7e" }, "downloads": -1, "filename": "validation-0.2.0.zip", "has_sig": false, "md5_digest": "d3cf0ca0804433352520f84dfdc37d7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22686, "upload_time": "2017-10-15T22:44:05", "url": "https://files.pythonhosted.org/packages/75/a0/15b1ab76c20a577cd50d809e7868723d0d505667dff3cc0dc80196c2f479/validation-0.2.0.zip" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1590b4d4d8dc22f1bd121a8991c17097", "sha256": "b6026deac3b6db886eb20e6e39aa9f879f830bb031701c18bb59bc1732f685b9" }, "downloads": -1, "filename": "validation-0.3.0.zip", "has_sig": false, "md5_digest": "1590b4d4d8dc22f1bd121a8991c17097", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28876, "upload_time": "2017-11-15T22:13:27", "url": "https://files.pythonhosted.org/packages/3f/8a/99c68e1bea3bde8a893a682c991eb587bd2c03c38879ea64d5c1f8addb90/validation-0.3.0.zip" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "e51a4944336894668ea80bf54f99b74a", "sha256": "a0b5d09559d29627974457c064c94fcbe4cec402c33bb7d67280fbb2de1743df" }, "downloads": -1, "filename": "validation-0.4.0.zip", "has_sig": false, "md5_digest": "e51a4944336894668ea80bf54f99b74a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31202, "upload_time": "2017-12-01T21:48:41", "url": "https://files.pythonhosted.org/packages/58/15/883fbfa453ebf8ecaead93c544707ca7e4d6fbded6264cb6507965816672/validation-0.4.0.zip" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "5a59e6b3629ebebf98ee675a5df0fd61", "sha256": "dbe1af65b0bb0dc448e3bf66fb37cb20bc4b25fb28bad140bd39f82057911c94" }, "downloads": -1, "filename": "validation-0.4.1.zip", "has_sig": false, "md5_digest": "5a59e6b3629ebebf98ee675a5df0fd61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32624, "upload_time": "2018-01-01T15:03:33", "url": "https://files.pythonhosted.org/packages/16/d3/c2d6a50076111fc44047e773c39ef0a7d0592a063e4ff881c84ea878c3a5/validation-0.4.1.zip" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "299f6879aa6e8c827f885872b8a0cf16", "sha256": "8d2e27d914a6c42e94d79faa9eb5d7430c8b01551e1dabde4ed2d74c42b9b036" }, "downloads": -1, "filename": "validation-0.4.2.zip", "has_sig": false, "md5_digest": "299f6879aa6e8c827f885872b8a0cf16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33218, "upload_time": "2019-01-03T18:28:14", "url": "https://files.pythonhosted.org/packages/80/d1/0a1cf147a9584f96956ca9b2edf26be01e1e9882beb93d562f19771558b2/validation-0.4.2.zip" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "fab36d2fa026eb72bd96b380652bb777", "sha256": "5d5837cd73b3f7b8f6cb2c99336ea9aeef92002cc3267c2b935250ea547be552" }, "downloads": -1, "filename": "validation-0.5.0.zip", "has_sig": false, "md5_digest": "fab36d2fa026eb72bd96b380652bb777", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 33093, "upload_time": "2019-01-03T18:31:00", "url": "https://files.pythonhosted.org/packages/db/9c/ac1654bcd0548fa0a3885841752ce73336ade0cbb95adc069763e9858474/validation-0.5.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fab36d2fa026eb72bd96b380652bb777", "sha256": "5d5837cd73b3f7b8f6cb2c99336ea9aeef92002cc3267c2b935250ea547be552" }, "downloads": -1, "filename": "validation-0.5.0.zip", "has_sig": false, "md5_digest": "fab36d2fa026eb72bd96b380652bb777", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 33093, "upload_time": "2019-01-03T18:31:00", "url": "https://files.pythonhosted.org/packages/db/9c/ac1654bcd0548fa0a3885841752ce73336ade0cbb95adc069763e9858474/validation-0.5.0.zip" } ] }