{ "info": { "author": "Renaud Richardet", "author_email": "renaud@apache.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Testing" ], "description": "Intuitive and minimalistic type checking for Python objects\n===========================================================\n\nGetting Started\n~~~~~~~~~~~~~~~~~~~~~~\n\nThe first snippet below checks that an object is a list of tuples, each tuple with an int and a string.\nThe second snippet shows how to decorate a function\n\n.. code:: python\n\n activate_checktype() # by default, checktype is deactivated\n\n o = [(1, 'hello'), (2, 'world')\n checktype(o, '[(int, str)..]')\n\n\n @check('str, {str:int} -> [int..]')\n def myfunction(a1, a2):\n return [1,2,3]\n\n myfunction(\"say\", {\"hello\":1})\n\nIntroduction\n~~~~~~~~~~~~~~~~~~~~~~\n\nPython is strongly, dynamically typed. This is fine, but at times when objects get too complicated, it can be a good thing to check for types.\n\nChecktype allows simple checking of Python object formats. It has a very intuitive type system that mimics the way you define your own Python objects.\n\nIt can be particularily helpful when refactoring programs. Its performance has not been optimized and it is intended as a development-time type checking utility (disabled by default, and should probably be activated in tests only).\n\n\nRelated\n~~~~~~~~~~~~~~~~~~~~~~\n\n* https://www.python.org/dev/peps/pep-0484/\n* http://mypy-lang.org/examples.html\n* https://github.com/ceronman/typeannotations\n\n\nInstallation\n~~~~~~~~~~~~~~~~~~~~~~\n\nYou can install checktype with pip::\n\n pip install checktype\n\n\nUsage examples:\n~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from checktype import checktype, activate_checktype, check\n\n # 'activates' checktype. You need to explicitly call this,\n # else it will do nothing (by default, to save cpu time).\n # It is common to specify it in tests\n activate_checktype()\n\n # checktype only provides a single function, that takes two arguments.\n # the first one is the python object you want to test;\n # the second one is an 'object specification' (spec), that mimics the way\n # objects are represented in Python. This spec is a string representation of\n # a python object. For example, to check that 12 is an int or 'hello' is a str:\n checktype(12, 'int')\n checktype('hello', 'str')\n\n # A list of exactly 3 floats is specified as [float,float,float]\n checktype([1.0,2.0,3.0], '[float,float,float]')\n\n # To match a variable-length list of ints, use [int..]\n checktype([1,2,3], '[int..]')\n\n # To only check that it is a list (but not its content), use []\n checktype([1, \"deux\"], '[]')\n\n # And so on for tuples,\n checktype((1,2,3), '(int,int,int)')\n checktype((1,2,3), '(int..)')\n checktype((1, \"deux\"), '()')\n # dictionnaries,\n checktype({11:2, 12: 3}, '{int:int}')\n checktype({11:2, 12: 3}, '{}')\n # and sets.\n checktype({11, 2}, '{int}')\n\n # Use the ? wildcard if you don't want to check for a specific part\n checktype({11:2, 12: \"a\", 13:(3,4)}, '{int:?}')\n\n # Further examples\n checktype({11: (2,3), 12: (4,\"5\")}, '{ int: (int,?)}')\n checktype([(2, \"asdf\"),(-12, \"asfwe\"),(1,\"\")], \"[(int,str)..]\")\n checktype([(1, 'hello', 2.0)], \"[(int, str, float)]\")\n\n # Decorator examples\n @check(\"str.. -> int\")\n def fn_1(a1, a2):\n return 1\n\n fn_1(\"say\", \"hello\")\n\n\n @check(\"str, {str:int} -> [int..]\")\n def fn_3(a1, a2):\n return [1,2,3]\n\n fn_3(\"say\", {\"hello\":1})", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/renaud/checktype", "keywords": "type checking", "license": "Apache License (2.0)", "maintainer": null, "maintainer_email": null, "name": "checktype", "package_url": "https://pypi.org/project/checktype/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/checktype/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/renaud/checktype" }, "release_url": "https://pypi.org/project/checktype/1.1.4/", "requires_dist": null, "requires_python": null, "summary": "Intuitive and minimalistic type checking for Python objects", "version": "1.1.4" }, "last_serial": 1865625, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "b8d9ebc555ea2244d73d4a7df70fce4c", "sha256": "d5c389ff2a195f2a65b48c326fc58ed1eea3a3ca6d09a0baf308032db3df90f6" }, "downloads": -1, "filename": "checktype-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b8d9ebc555ea2244d73d4a7df70fce4c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3215, "upload_time": "2015-12-10T12:51:30", "url": "https://files.pythonhosted.org/packages/d0/7b/e9e03f2d15ab3083b0f3185d40b5321a6d8de9489a8c1db2568be1580270/checktype-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "35c63269256f25bb099d2da18dfe7bee", "sha256": "535b8846e74dc6932d5fffa997d1074d9df1970713c2d3e2f34eb140dbce8b2a" }, "downloads": -1, "filename": "checktype-1.1.0.tar.gz", "has_sig": false, "md5_digest": "35c63269256f25bb099d2da18dfe7bee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4356, "upload_time": "2015-12-10T22:13:11", "url": "https://files.pythonhosted.org/packages/19/05/55dfb09e4978a8f0084bc4a4253102c21d41184980c244fbadf5f9802862/checktype-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "5d26cd7df91bbaccfbd7566ece3d8841", "sha256": "0f42d813e956ad0d2ef7e32346bf094f64ea64bcd9a5518a57122a734e6930cc" }, "downloads": -1, "filename": "checktype-1.1.1.tar.gz", "has_sig": false, "md5_digest": "5d26cd7df91bbaccfbd7566ece3d8841", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4439, "upload_time": "2015-12-12T12:29:05", "url": "https://files.pythonhosted.org/packages/72/09/990473fd4ba23ede5eb628722ee1131e5a8a19f8caee634bacdf49db02af/checktype-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "22124987a5b8c6e5326251bfbfd399ad", "sha256": "dd2702a8fa826c10d27651e8938fe34a39b4ef6d03340b3381f3003e8e67e059" }, "downloads": -1, "filename": "checktype-1.1.2.tar.gz", "has_sig": false, "md5_digest": "22124987a5b8c6e5326251bfbfd399ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4432, "upload_time": "2015-12-12T15:54:36", "url": "https://files.pythonhosted.org/packages/fb/4f/a5034a553d364e9b1306f522e92960f69c974543a4ac4b6b0d21f7a8afd3/checktype-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "429fa450a07fd7d4255c318350705102", "sha256": "87e7e52b6ece5e706c4cbcc9a8ccacec6e0b1a368219223f87591b62c0fe7dcd" }, "downloads": -1, "filename": "checktype-1.1.3.tar.gz", "has_sig": false, "md5_digest": "429fa450a07fd7d4255c318350705102", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4501, "upload_time": "2015-12-16T13:25:13", "url": "https://files.pythonhosted.org/packages/a1/82/37402348b27d4c9b6fb3b7f87293a7b5ee0544ba8a0f596fd2bde48f4d38/checktype-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "9ec10fd0fac04ed05fde6f5403e70d20", "sha256": "ba30f3aa727ae93be8d39e5230251bf60824154b49ba4b15cb56852757666d91" }, "downloads": -1, "filename": "checktype-1.1.4.tar.gz", "has_sig": false, "md5_digest": "9ec10fd0fac04ed05fde6f5403e70d20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4565, "upload_time": "2015-12-16T20:17:14", "url": "https://files.pythonhosted.org/packages/dd/a3/6fee8e40ec5801f7a73b94d100bdffd7502cc06c85cc8f2f617422f7afce/checktype-1.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9ec10fd0fac04ed05fde6f5403e70d20", "sha256": "ba30f3aa727ae93be8d39e5230251bf60824154b49ba4b15cb56852757666d91" }, "downloads": -1, "filename": "checktype-1.1.4.tar.gz", "has_sig": false, "md5_digest": "9ec10fd0fac04ed05fde6f5403e70d20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4565, "upload_time": "2015-12-16T20:17:14", "url": "https://files.pythonhosted.org/packages/dd/a3/6fee8e40ec5801f7a73b94d100bdffd7502cc06c85cc8f2f617422f7afce/checktype-1.1.4.tar.gz" } ] }