{ "info": { "author": "Jean-Tiare Le Bigot", "author_email": "jtlebigot@socialludia.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing" ], "description": "TL;DR Use voluptuous instead\n============================\n\n.. important::\n We forked Voluptuous because the issues we opened were not addressed.\n Voluputous author have fixed those issues now so, we stopped working on\n onctuous and advise anyone to use Volutpuous instead.\n\n\nPresentation\n============\n\n**Onctuous** is a fluid and pleasing to use validation tool you will love to\nuse. Originally based on `Voluptuous `_\ncode by Alec Thomas , we first fixed long outstanding issues\nlike Python builtins collision and added support for default values.\n\nThe goal of **Onctuous** is to make it simple and smooth.\n - You *can* write your own validators\n - You *can* specify defaults. The best ? They are *not* required to pass validation themselves\n - You *can* write readable code. This is not based on json schema specification, on purpose\n\nYou can use Onctuous to validate ``list``, ``scalar`` (regular variables) or\n``dict``. For this purpose, you will need to define a so-called ``Schema`` and\ncall the Schema with the input to validate. In case of success, it will return\nthe validated input, possibly filtered or edited according to your rules\n\nInstallation\n============\n\n::\n\n $ pip install onctuous\n\n\nDeveloping\n==========\n\n::\n\n $ hg clone ssh://hg@bitbucket.org/Ludia/onctuous\n $ pip install nose nosexcover coverage mock\n $ python setup.py develop\n $ nosetests\n\nWhy use Onctuous over another validation library?\n=================================================\n\nIt's:\n\n- readable\n- easy\n\n**Validators are simple callables**\n No need to subclass anything, just use a function.\n\n**Errors are simple exceptions.**\n A validator can just ``raise Invalid(msg)`` and expect the user to get useful\n messages.\n\n**Schemas are basic Python data structures.**\n Should your data be a dictionary of integer keys to strings? ``{int: str}``\n does what you expect. List of integers, floats or strings? ``[int, float, str]``.\n\n**Designed from the ground up for validating more than just forms.**\n Nested data structures are treated in the same way as any other type. Need a\n list of dictionaries? ``[{}]``\n\n**Consistency.**\n Types in the schema are checked as types. Values are compared as values.\n Callables are called to validate. Simple.\n\n\nExample usage\n=============\n\nValidate a scalar\n-----------------\n\n::\n\n from onctuous import Schema\n\n validate_is_int = Schema(int)\n\n # Validate 42 (this will run fine)\n validated = validate_is_int(42)\n\n # Validate \"toto\" (this will raise ``InvalidList`` containing a list of errors)\n validated = validate_is_int(\"toto\")\n\n\nValidate a list\n---------------\n\nUsing the same idea, you can validate a list of ``int``\n\n::\n\n from onctuous import Schema\n\n validate_is_int_list = Schema([int])\n\n # This will run fine\n validated = validate_is_int_list([42, 2, 7])\n\n # This will raise ``InvalidList`` containing a list of errors\n validated = validate_is_int_list([2, 7, \"toto\"])\n\n\nBut we can also use on of the bundled validators and check the URL looks to\nbe valid for example and even supply a custom error message!\n\n::\n\n from onctuous import Schema, Url\n\n validate_is_urls = Schema([Url(msg=\"Ooops, this is *not* a valid URL\")])\n\n # This will run fine\n validated = validate_is_urls([\"www.example.com\", \"ftp://user:pass@ftp.example.com:42/toto?weird/path\"])\n\n # This will raise ``InvalidList`` containing a list of errors\n validated = validate_is_urls([2, 7, \"toto\"])\n\n\nValidate a dictionary\n---------------------\n\nAgain, this is the same concept with some more niceties. For example, here is a\nbasic user schema:\n\n::\n\n from onctuous import Schema, Url\n\n validate_user = Schema({\n 'firstname': unicode,\n 'lastname': unicode,\n 'age': int,\n 'website': Url(msg=\"Ooops, this is *not* a valid URL\"),\n })\n\n # use it...\n\nBut wait, I don't want megative ages, do I ?\n\n::\n\n from onctuous import Schema, Url, InRange, All\n\n validate_user = Schema({\n 'firstname': unicode,\n 'lastname': unicode,\n 'age': All(int, InRange(min=0, msg=\"Uh, ages can not be negative...\")),\n 'website': Url(msg=\"Ooops, this is *not* a valid URL\"),\n })\n\n # use it...\n\nHave you noticed how this uses ``All`` to specify that both ``int`` and ``range``\nconditions must ne met ?\n\nWhat if I want to make the \"Website\" field optional ? Let me introduce ``Markers``\n\n::\n\n from onctuous import Schema, Url, InRange, All, Optional\n\n validate_user = Schema({\n 'firstname': unicode,\n 'lastname': unicode,\n 'age': All(int, InRange(min=0, msg=\"Uh, ages can not be negative...\")),\n Optional('website'): Url(msg=\"Ooops, this is *not* a valid URL\"),\n })\n\n # use it...\n\nYou could also have used the 'Required' Marker with a default value. This is very\nusefull if you do not want to spend your whole time writing ``if key in data...``.\n\n::\n\n from onctuous import Schema, Url, InRange, All, Required\n\n validate_user = Schema({\n 'firstname': unicode,\n 'lastname': unicode,\n 'age': All(int, InRange(min=0, msg=\"Uh, ages can not be negative...\")),\n Required('website', \"#\"): Url(msg=\"Ooops, this is *not* a valid URL\"),\n })\n\n # use it...\n\n\nIt is worth noting that that the provided default value does *not* need to pass\nvalidations. You can use it as a \"Marker\" further in you application.\n\nNested and advanced validations\n-------------------------------\n\nYou can nest shemas. You actually did it in the previous example where scalars\nare nested into a dict or a list. But you can arbitrarily nest lists into dict\nand the other way around, as you need.\n\nFor example, let's say you are writing a blog post which obviously has an author\nand maybe some tags whose len are between 3 and 20 chars included.\n\n::\n\n from onctuous import Schema, All, Required, Length, InRange\n\n # Same schema as user above. I just removed the Schema instanciation but\n # could have kept it. It's just more natural\n user = {\n 'firstname': unicode,\n 'lastname': unicode,\n 'age': All(int, InRange(min=0, msg=\"Uh, ages can not be negative...\")),\n Required('website', \"#\"): Url(msg=\"Ooops, this is *not* a valid URL\"),\n }\n\n validate_post = Schema({\n 'title': unicode,\n 'body': unicode,\n 'author': user, # look how you can split a schema into re-usable chunks!\n Optional('tags'): [All(unicode, Length(min=3, max=20))],\n Required('website', \"#\"): Url(msg=\"Ooops, this is *not* a valid URL\"),\n })\n\n # use it...\n\nThat's all for nesting.\n\nYou could also use the ``Extra`` special key to allow extra fields to be present\nwhile still being valid.\n\nWhen instanciating the schema, there are also a global ``required`` and ``extra``\nparameters that can optionally be set. They both default to ``False``\n\nGoing further\n=============\n\nThere are tons of bundled validators, `see the full API documentation\n`_ for the full\nlist\n\nRequirements\n============\n\n - Python 2.7.x\n - nose, nosexcover, coverage, mock for the tests\n\nRelated Links\n=============\n\nonctuous\n--------\n\n- **Full documentation**: https://onctuous.readthedocs.org/en/latest\n- **Report bugs**: https://bitbucket.org/Ludia/onctuous/issues\n- **Download**: http://pypi.python.org/pypi/onctuous", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/Ludia/onctuous", "keywords": "validation", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "onctuous", "package_url": "https://pypi.org/project/onctuous/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/onctuous/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/Ludia/onctuous" }, "release_url": "https://pypi.org/project/onctuous/0.5.90/", "requires_dist": null, "requires_python": null, "summary": "Fluid and pleasing to use data validator for Python", "version": "0.5.90" }, "last_serial": 997311, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "d962b3a9cf16022181f99a0eda5f7904", "sha256": "25728ad7510d4ec7b0e3f8507ce6c43d35e0732a763419a35a76a2aec254a77b" }, "downloads": -1, "filename": "onctuous-0.5.0.tar.gz", "has_sig": false, "md5_digest": "d962b3a9cf16022181f99a0eda5f7904", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14854, "upload_time": "2012-10-23T19:23:32", "url": "https://files.pythonhosted.org/packages/65/12/e037ed0df3ddbb56423daf64690fde5294ee90a2fb9f971e7bca478bc6d2/onctuous-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "b1d3995f999655c5e78ea338cea7f2ae", "sha256": "464ada19ef4e03742e203e83a047c30e5db08810e1f9ecf1cab29d0603ee5ec5" }, "downloads": -1, "filename": "onctuous-0.5.1.tar.gz", "has_sig": false, "md5_digest": "b1d3995f999655c5e78ea338cea7f2ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14396, "upload_time": "2012-11-01T21:19:52", "url": "https://files.pythonhosted.org/packages/af/fe/46366166d737e2c590b30c15773e3fe9009de3b03db30a15999a7c953b23/onctuous-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "4c608ae76938355a54fec2eeabf19ee4", "sha256": "59a2fbb6d6bbc7de666fd4f29887b8749e399b5d3a13baa604afb9bd3a6dc6d2" }, "downloads": -1, "filename": "onctuous-0.5.2.tar.gz", "has_sig": false, "md5_digest": "4c608ae76938355a54fec2eeabf19ee4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22142, "upload_time": "2012-11-20T21:14:36", "url": "https://files.pythonhosted.org/packages/b3/95/f10db5cc460ad488b5bebd31554ad9e477f81add32ad70d4395ab5ce891d/onctuous-0.5.2.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "ec80d2b50be2b29efbd090502174a859", "sha256": "9cc86eea4d86eee51864839983bc6bf566a1b56a67d601350526077cee12b38d" }, "downloads": -1, "filename": "onctuous-0.5.5.tar.gz", "has_sig": false, "md5_digest": "ec80d2b50be2b29efbd090502174a859", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22374, "upload_time": "2012-11-22T23:30:38", "url": "https://files.pythonhosted.org/packages/d6/65/e059e9fab7cab3d0592c42b8e254f1dcc62d77a5ec9c342c5ef00ee6b8b2/onctuous-0.5.5.tar.gz" } ], "0.5.84": [ { "comment_text": "", "digests": { "md5": "1ad879545f8d568931c581b13183b04c", "sha256": "71b00557dfb8e1b69161cfa89d62a4c1783a24d7f8d37aa1d8b69ee934c25908" }, "downloads": -1, "filename": "onctuous-0.5.84.tar.gz", "has_sig": false, "md5_digest": "1ad879545f8d568931c581b13183b04c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24297, "upload_time": "2013-06-05T15:36:20", "url": "https://files.pythonhosted.org/packages/75/12/16d2776de8da85208f5b5f1c0f828e1e8593ff7628ee9d5140d25b76251c/onctuous-0.5.84.tar.gz" } ], "0.5.90": [] }, "urls": [] }