{ "info": { "author": "Steven Troxler", "author_email": "steven.troxler@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7" ], "description": "clickutil - making click even better\n====================================\n\nPython's `click` package is an awesome tool for building command-line\ninterfaces. But sometimes to use `click` the way I want to I need a\nlot of boilerplate code, so I wrote `clickutil` to make my command\nline packages more concise and less buggy.\n\n\nKeep access to your python functions by using `clickutil.call`\n--------------------------------------------------------------\n\nA normal click decorator looks something like this::\n\n @click.command('do-something')\n @click.option('--an-option', required=True, help='a click option')\n def do_something(an_option):\n click.echo(an_option)\n\n\nThis can be frustrating if you want to expose a public api that is accessible\nfrom both python and the command line, because the original `do_someting`\nfunction which took an argument is replaced by a function that takes no\narguments and reads `sys.argv` for inputs.\n\nThe `clickutil.call` decorator lets you instead decorate a placeholder function\nas calling some function you want as part of your public api, so that the\noriginal function may still be accessed from python::\n\n def do_something(an_option):\n click.echo(an_option)\n\n @click.command('do-something')\n @click.option('--an-option', required=True, help='a click option')\n @clickutil.call(do_something)\n def _do_something(): pass\n\n\nAdd debugging using clickutil.debug\n-----------------------------------\n\nA common workflow for python developers is to load code from `ipython` and run\nit from the shell. There are several benefits to doing this, one of which is\nthat you can use the `%debug` magic command if unhandled exceptions occur.\n\nThe `clickutils.debug` decorator lets you get a similar benefit when running\nclick commands, by dropping into a debugger on unhandled exceptions. By default\nit adds an option `--debug`. When that flag is used, on any exceptions the click\nendpoint will enter a debugger after delaying a few seconds (which gives the\nuser a chance to keyboard escape if they don't need to debug). The delay, and\nalso whether to debug by default, can both be configured.\n\nBy default, `clickutil` will first try `pudb` and then `pdb` for debugging, but\nthis is configurable via an argument.\n\nFor example, here we debug using `ipdb` after 10 seconds of waiting in the\nevent that `do_something` raises an exception. We do so by default, so to\nturn off this behavior you would need to use the `--no-debug` flag::\n\n import ipdb\n\n @click.command('do-something')\n @clickutil.debug(default=False, delay=10, use_debugger=ipdb)\n @clickutil.call(do_something)\n def _do_something(): pass\n\nMore concise options and flags\n------------------------------\n\nThe `click.option` function takes a lot of arguments to control different\nkinds of behaviors, and conflates a lot of different kinds of options\n(for example, boolean flags like `--debug/--no-debug` get grouped together\nwith options that take arguments). Partly because the behavior of a click\noption depends on many different arguments, some of the default behaviors -- such\nas not showing the default value of an option that has a default in the\n`--help` output -- don't make sense.\n\nTo make working with options easier, `clickutil` provides three more specific\nfunctions: `clickutil.boolean_flag` for setting flags such as `--debug`,\n`clickutil.required_option` for options that take an argument and must be\nprovided, and `clickutil.default_option` for options that take an argument\nand need not be provided. It also provides three special option types,\n`clickutil.EXISTING_FILE`, `clickutil.EXISTING_DIR`, and\n`clickutil.NEW_FILE_OR_DIR`, to handle the most common `click.Path` input\ntypes.\n\nDetecting default values from function signatures\n-------------------------------------------------\n\nBecause clickutil tries to keep the original python function available\nfor calling from python using `clickutil.call`, it becomes irritating to\nhave to set default values for `default_option`s and `boolean_flag`s twice,\nboth in the function and in the click decorators. In addition, the fact that\nthese two can differ becomes a potential source of bugs.\n\nBy inspecing the arguments of functions, `clickutil` is able to set defaults\nbased on the argument list in the definition of a function.\n\nThe `clickutil.boolean` decorator is similar to `clickutil.boolean_flag`,\nexcept it picks up its default value from the function signature. Similarly,\n`clickutil.option` is like `clickutil.required_option` or\n`clickutil.default_option`, depending on whether there's a default value in the\nfunction signature.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stroxler/clickutil", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "clickutil", "package_url": "https://pypi.org/project/clickutil/", "platform": "", "project_url": "https://pypi.org/project/clickutil/", "project_urls": { "Homepage": "https://github.com/stroxler/clickutil" }, "release_url": "https://pypi.org/project/clickutil/0.0.5/", "requires_dist": null, "requires_python": "", "summary": "Tools for working with container types, command data operations, and concise exception handling", "version": "0.0.5" }, "last_serial": 3201326, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "f20c7fb2b9b349e13a466701c4c789c3", "sha256": "89676268ff1a44bbbc2655706aca3cfbf45b58234e321d9ff3730bcd09970e2c" }, "downloads": -1, "filename": "clickutil-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f20c7fb2b9b349e13a466701c4c789c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6202, "upload_time": "2016-07-11T20:58:32", "url": "https://files.pythonhosted.org/packages/0f/07/46f7937fd5ed8dde50b2792d504c08bd9fe39b9339692339bdaaa17c0e9e/clickutil-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "d87c80ca7464b17de215cec462ceca27", "sha256": "b6ff2fb0d82e5a85c4c50c02e959b2eb362880c1924d57fd5d9c43bf5734d520" }, "downloads": -1, "filename": "clickutil-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d87c80ca7464b17de215cec462ceca27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7546, "upload_time": "2016-10-14T18:59:46", "url": "https://files.pythonhosted.org/packages/34/98/38017e5b03ede993e5ac576474d3e6002f95ec8af8e822f3a7ea3fb46664/clickutil-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "97abba7099844b25cc0b540680825d88", "sha256": "6c8772c645e00368f63ab3b68d83980218b40367eb6d9cd026077c7387fa8ae0" }, "downloads": -1, "filename": "clickutil-0.0.3.tar.gz", "has_sig": false, "md5_digest": "97abba7099844b25cc0b540680825d88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7724, "upload_time": "2016-11-07T17:56:14", "url": "https://files.pythonhosted.org/packages/f2/fb/8b93edd69f8463e7d9dae6ac520a7a5bacd228ccbbc0c5891c9761fb1e5a/clickutil-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1612bac74c258448a626be64125b22d2", "sha256": "d846ccb47e5560328576c90d9a23ee20ef5038bf6d4e7c261a2aed6122ad5b13" }, "downloads": -1, "filename": "clickutil-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1612bac74c258448a626be64125b22d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8146, "upload_time": "2016-12-03T02:34:49", "url": "https://files.pythonhosted.org/packages/59/2b/100daaff4a33efa3bce7a6150b321d2b67ca9982614dbe83a2fa66c5496b/clickutil-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "53c51a0d1e63563108f5fed9082eb255", "sha256": "5b633b86767688e38dd031681da18051e89de4ef26ebf57b995399b0fc7254a5" }, "downloads": -1, "filename": "clickutil-0.0.5.tar.gz", "has_sig": false, "md5_digest": "53c51a0d1e63563108f5fed9082eb255", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8145, "upload_time": "2017-09-25T15:56:01", "url": "https://files.pythonhosted.org/packages/d2/b7/44211b7feb6cda4d5d93278cba5ad8c1ae848fe09324184923288a847600/clickutil-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "53c51a0d1e63563108f5fed9082eb255", "sha256": "5b633b86767688e38dd031681da18051e89de4ef26ebf57b995399b0fc7254a5" }, "downloads": -1, "filename": "clickutil-0.0.5.tar.gz", "has_sig": false, "md5_digest": "53c51a0d1e63563108f5fed9082eb255", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8145, "upload_time": "2017-09-25T15:56:01", "url": "https://files.pythonhosted.org/packages/d2/b7/44211b7feb6cda4d5d93278cba5ad8c1ae848fe09324184923288a847600/clickutil-0.0.5.tar.gz" } ] }