{ "info": { "author": "Tim Henderson", "author_email": "tim.tadh@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "optutils\n========\n\nSmall, composable utilities for writing great command line tools. Writing\na great command line tool takes art as well as science. Unlike libraries and\nframeworks, commandline tools are used interactively by the programmer.\nTherefore, their input interface must be forgiving yet consistent, their output\nmust be computer parsable yet human readable, and their error messages must be\nterse yet informative.\n\n#### `Optutils` philosophy:\n\n1. Fail fast -- give the user immediate feedback on what they did wrong.\n2. Testable Errors -- provide consistent unique exit status codes to ensure\n future testability.\n3. Informative Errors -- point the way to the narrow path.\n4. Separate Feedback and Output -- feedback for humans should go on the standard\n error, output for programs to the standard out.\n5. Prioritize Clarity over Code -- the user experience should be paramount, not\n the programmer's experience. These utilities are not always designed to make\n the text of the program shorter, they are designed to make the user\n experience *better*.\n6. Every Child is Special -- every utility is just a little different and one\n size fits all solutions tend to fit no one. Utilities should therefore be\n specialized *yet* re-usable.\n\n# A Minimal Optutils Program with a Subcommand\n\n```python\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#Author: Tim Henderson\n#Email: tim.tadh@gmail.com, tadh@case.edu\n#For licensing see the LICENSE file in the top level directory.\n\n\nimport os, sys, json\n\nimport optutils\nfrom optutils import output, log, error_codes, add_code\n\n\n__version__ = 'git master'\n\nadd_code('version')\n\ndef version():\n '''Print version and exits'''\n log('version :', __version__)\n sys.exit(error_codes['version'])\n\n\n@optutils.main(\n 'usage: example ',\n '''\n Example:\n\n $ example command what\n\n Options\n -h, help print this message\n -v, version print the version\n ''',\n 'hv',\n ['help', 'version'],\n)\ndef main(argv, util, parser):\n \"\"\"\n The main entry point to the program\n \"\"\"\n\n @util.command(\n 'usage: command [args]',\n '''\n Example:\n\n Options\n -h, help print this message\n ''',\n 'h',\n ['help',],\n )\n def command(argv, util, parser, setting):\n\n opts, args = parser(argv)\n for opt, arg in opts:\n if opt in ('-h', '--help',):\n util.usage()\n\n print ' '.join(args)\n print 'running with', setting\n\n\n opts, args = parser(argv)\n for opt, arg in opts:\n if opt in ('-h', '--help',):\n util.usage()\n elif opt in ('-v', '--version',):\n version()\n\n setting = 'wizards'\n\n util.run_command(args, setting)\n\nif __name__ == '__main__':\n sys.exit(main(sys.argv[1:]))\n```\n\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/timtadh/optutils", "keywords": null, "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "optutils", "package_url": "https://pypi.org/project/optutils/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/optutils/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://www.github.com/timtadh/optutils" }, "release_url": "https://pypi.org/project/optutils/0.03/", "requires_dist": null, "requires_python": null, "summary": "Small, composable utilities for writing great command line tools.", "version": "0.03" }, "last_serial": 1674949, "releases": { ".01": [ { "comment_text": "", "digests": { "md5": "ed59cfcf5dc07cf84344893ba77cba2e", "sha256": "ab74206116c8f246a884e79131e7b0e3d01dbc7b70f0ab1cf81b904d3272cf19" }, "downloads": -1, "filename": "optutils-.01.tar.gz", "has_sig": false, "md5_digest": "ed59cfcf5dc07cf84344893ba77cba2e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5526, "upload_time": "2013-09-12T20:34:54", "url": "https://files.pythonhosted.org/packages/40/16/b36cbc3eba30b644d3f9d614d7101850a5b6592347d38fb68fbd068a8160/optutils-.01.tar.gz" } ], ".02": [ { "comment_text": "", "digests": { "md5": "3ca036610a0669d7ad514a0bcf2781c3", "sha256": "897ba203a32d6908f8dcfeb27eb82bb0b0279aa90bb85acff97a2e9ed82c292d" }, "downloads": -1, "filename": "optutils-.02.tar.gz", "has_sig": false, "md5_digest": "3ca036610a0669d7ad514a0bcf2781c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13765, "upload_time": "2014-04-08T19:19:48", "url": "https://files.pythonhosted.org/packages/8b/94/7efeeeeaebe8a272aa58fb3ce3a8664ecec00cfbfe1044557abc116a4d4f/optutils-.02.tar.gz" } ], ".02.1": [ { "comment_text": "", "digests": { "md5": "d2f0907d616dd5cc2cca72fa7633b529", "sha256": "ef97638d2971c3ee506d75b2639c67ac94fd0334211585f62bf9d7395b1f00ec" }, "downloads": -1, "filename": "optutils-.02.1.tar.gz", "has_sig": false, "md5_digest": "d2f0907d616dd5cc2cca72fa7633b529", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13777, "upload_time": "2014-04-08T20:31:11", "url": "https://files.pythonhosted.org/packages/1c/2d/4d13c3ecf147a6383053779013eb0d8f9256cae09f1ce3f8a0e096c32cbd/optutils-.02.1.tar.gz" } ], ".02.2": [ { "comment_text": "", "digests": { "md5": "c6c2189f74db5e017ea7165ad6b7e33f", "sha256": "a842a5c0d5abb18bffa5965e331d7acc1c0c982fdaa0e1d1be7a5e363f4a6239" }, "downloads": -1, "filename": "optutils-.02.2.tar.gz", "has_sig": false, "md5_digest": "c6c2189f74db5e017ea7165ad6b7e33f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13780, "upload_time": "2014-04-10T15:01:25", "url": "https://files.pythonhosted.org/packages/dc/fa/d3860b36589ae797ff67c444441b9f276a61a76be76d8b8608e3bc803c6f/optutils-.02.2.tar.gz" } ], ".02.3": [ { "comment_text": "", "digests": { "md5": "b0eddf1b3f54121847193c880ff08854", "sha256": "f1a4ffab33cae0b4d0144a99b487c9607bf2adb2e90309e1c195c654ddd99520" }, "downloads": -1, "filename": "optutils-.02.3.tar.gz", "has_sig": false, "md5_digest": "b0eddf1b3f54121847193c880ff08854", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13784, "upload_time": "2014-04-10T20:36:31", "url": "https://files.pythonhosted.org/packages/17/5a/b06f3114b7e62a222d644f3a37a268afa1dd330ce01a9d1d37314ad3aa40/optutils-.02.3.tar.gz" } ], ".02.4": [ { "comment_text": "", "digests": { "md5": "7a14e51b114ec9fa6f9478d1400d5c2d", "sha256": "b0cc8b05ac2bb39a2484a84219d65958cab3297f93fd853dd4dfcb8e1f17d696" }, "downloads": -1, "filename": "optutils-.02.4.tar.gz", "has_sig": false, "md5_digest": "7a14e51b114ec9fa6f9478d1400d5c2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13797, "upload_time": "2014-04-24T16:55:35", "url": "https://files.pythonhosted.org/packages/f2/1e/d11667f16c7a7ff139f907e79023c64f87a127f60040311da8acacadb510/optutils-.02.4.tar.gz" } ], ".02.5": [ { "comment_text": "", "digests": { "md5": "bc707a737f119d2ac0315f3b79fa3052", "sha256": "f52aa650b1363b9276fc89c7200173cebede39960c16fed544203196fc5ca9d4" }, "downloads": -1, "filename": "optutils-.02.5.tar.gz", "has_sig": false, "md5_digest": "bc707a737f119d2ac0315f3b79fa3052", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13792, "upload_time": "2014-04-24T17:01:17", "url": "https://files.pythonhosted.org/packages/78/f8/64d76142f513ab28c16d0a625632b1e08a653ebb051a5680f703d375b37f/optutils-.02.5.tar.gz" } ], ".02.6": [ { "comment_text": "", "digests": { "md5": "999cac204100d0515a76c93e1e7dbfd6", "sha256": "e8c13058fc18edd0d14a8bee9194980994b58fd9fe876d00862fb94cd8f52c5e" }, "downloads": -1, "filename": "optutils-.02.6.tar.gz", "has_sig": false, "md5_digest": "999cac204100d0515a76c93e1e7dbfd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13800, "upload_time": "2014-04-24T17:43:21", "url": "https://files.pythonhosted.org/packages/60/a9/7023ea0bc2dc846dda2966041c3a7a7ed05f30e612438f968992b3998185/optutils-.02.6.tar.gz" } ], "0.03": [ { "comment_text": "", "digests": { "md5": "d4efd8e6a07f52c979e50c3f3add69fe", "sha256": "321a7295a1f4be6dc412dfc409f81c68966ec02f6bbca5d537b46b394a291842" }, "downloads": -1, "filename": "optutils-0.03.tar.gz", "has_sig": false, "md5_digest": "d4efd8e6a07f52c979e50c3f3add69fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13926, "upload_time": "2015-08-12T18:20:05", "url": "https://files.pythonhosted.org/packages/a5/fa/7e07c55d2d83ee878e1fd5aaa2c130a1db31e9ca94c178ab05a1d108b409/optutils-0.03.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4efd8e6a07f52c979e50c3f3add69fe", "sha256": "321a7295a1f4be6dc412dfc409f81c68966ec02f6bbca5d537b46b394a291842" }, "downloads": -1, "filename": "optutils-0.03.tar.gz", "has_sig": false, "md5_digest": "d4efd8e6a07f52c979e50c3f3add69fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13926, "upload_time": "2015-08-12T18:20:05", "url": "https://files.pythonhosted.org/packages/a5/fa/7e07c55d2d83ee878e1fd5aaa2c130a1db31e9ca94c178ab05a1d108b409/optutils-0.03.tar.gz" } ] }