{ "info": { "author": "Steddy Smit", "author_email": "jacob.smit@zepler.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: User Interfaces" ], "description": ".. image:: https://travis-ci.org/stedmeister/easyargs.svg?branch=master\n :target: https://travis-ci.org/stedmeister/easyargs\n\neasyargs\n========\n\nA project designed to make command line argument parsing easy.\n\nThere are many ways to create a command line parser in python: argparse, docopt,\nclick. These are all great options, but require quite a lot of configuration\nand sometimes you just need a function to be called. Enter easyargs. Define\nthe function that you want to be called, decorate it and let easyargs work out\nthe command line. This is probably best shown with an example that takes one\nrequired argument and two optional ones:\n\n.. code:: python\n\n from __future__ import print_function\n\n import easyargs\n\n\n @easyargs\n def main(name, count=1, greeting='Hello'):\n \"\"\"A simple greeting program\"\"\"\n for i in range(count):\n print('{greeting} {name}!'.format(greeting=greeting, name=name))\n\n\n if __name__ == '__main__':\n main()\n\nIn this example, main is inspected, the arg keywords are turned into\npositional arguments and the kwarg keywords will be turned\ninto optional arguments. This can be seen if we run the above script with the\nhelp flag:\n\n.. code::\n\n $ python simple.py -h\n usage: simple_test.py [-h] [--count COUNT] [--greeting GREETING] name\n\n A simple greeting program\n\n positional arguments:\n name\n\n optional arguments:\n -h, --help show this help message and exit\n --count COUNT\n --greeting GREETING\n\nA few things worth noting. Firstly, the description is taken from the docstring\nof the function. Secondly, there is no need to convert count to an integer.\nBecause the default argument is of type int, the value is coerced to an integer:\n\n.. code::\n\n $ python simple.py World\n Hello World\n\n $ python simple.py everybody --count 2 --greeting Hola\n Hola everybody!\n Hola everybody!\n\nHow to define the function\n--------------------------\n\nThe goal of easyargs is to avoid having complicated configuration parameters,\nand let the function specify things, however, the following list of rules might\nbe useful:\n\n- ``main(arg)``: arg is a required positional argument\n- ``main(_arg)``: arg is an optional positional argument\n- ``main(arg=int, _arg=int)``: Setting a default value as a basic type will keep\n the argument positional, but coerce it to that type\n only tested with int / float\n- ``main(arg=list)``: Setting a default argument as a list will consume multiple\n arguments from the command line. It doesn't make sense to\n supply this more than once.\n- ``main(arg=value)``: Creates an optional argument with a default value of value\n- ``main(arg=3)``: If the default value is of type int / float. Then if a value is\n set it will be coerced to the type.\n- ``main(arg=True)``: If the default value is of type bool, then arg becomes a flag\n option.\n- ``main(a=values)``: If the argument has a length of 1, then it will create a short\n argument.\n\n\nSub commands\n------------\n\nWhilst having a simple function parser is great, sometimes you need to have a\nsub parser. This can be created by wrapping a number of functions in a class.\nLet's demonstrate this with another example by duplicating part of the git\ncommand. At the same time we'll introduce the concept of using the docstring\nto include the help text for each function parameter.\n\n.. code:: python\n\n from __future__ import print_function\n\n import easyargs\n\n\n @easyargs\n class GitClone(object):\n \"\"\"A git clone\"\"\"\n\n def clone(self, src, _dest):\n \"\"\"\n Clone a repository\n :param src: The source repository to clone from\n :param _dest: The directory to check the source code to\n \"\"\"\n\n def commit(self, a=False, m=None, amend=False):\n \"\"\"\n Commit a change to the index\n :param a: Add all tracked files to the index\n :param m: Supply the commit message on the command line\n :param amend: Amend the previous commit\n \"\"\"\n print('Committing {m}'.format(m=m))\n\n\n if __name__ == '__main__':\n GitClone()\n\n\nLet's see what this looks like on the command line:\n\n.. code::\n\n $ python examples/git_clone.py -h\n usage: git_clone.py [-h] {clone,commit} ...\n\n A git clone\n\n positional arguments:\n {clone,commit} sub-command help\n clone Clone a repository\n commit Commit a change to the index\n\n optional arguments:\n -h, --help show this help message and exit\n\n $ python examples/git_clone.py clone\n usage: git_clone.py clone [-h] src [dest]\n git_clone.py clone: error: too few arguments\n\n $ python examples/git_clone.py clone -h\n usage: git_clone.py clone [-h] src [dest]\n\n positional arguments:\n src The source repository to clone from\n dest The directory to check the source code to\n\n optional arguments:\n -h, --help show this help message and exit\n\n $ python examples/git_clone.py commit -am \"Message\"\n Committing Message\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stedmeister/easyargs", "keywords": "argparsing commandline", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "easyargs", "package_url": "https://pypi.org/project/easyargs/", "platform": "", "project_url": "https://pypi.org/project/easyargs/", "project_urls": { "Homepage": "https://github.com/stedmeister/easyargs" }, "release_url": "https://pypi.org/project/easyargs/0.9.4/", "requires_dist": [ "six", "check-manifest; extra == 'dev'", "coverage; extra == 'test'" ], "requires_python": "", "summary": "Making argument parsing easy", "version": "0.9.4" }, "last_serial": 3001860, "releases": { "0.8.0": [ { "comment_text": "", "digests": { "md5": "98d4a7a9b0cccb86a10dbc96ab07dc36", "sha256": "39f8ee3114b9b62f7e33b430e20cb0c0d5a6bcccaf8a67499b62f5a0220ae4ea" }, "downloads": -1, "filename": "easyargs-0.8.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "98d4a7a9b0cccb86a10dbc96ab07dc36", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5217, "upload_time": "2016-10-11T12:51:45", "url": "https://files.pythonhosted.org/packages/54/45/977d00e7d3c8f1777780c3bd08c6f1487f7a160312a6f4322c843fa1070d/easyargs-0.8.0-py2.py3-none-any.whl" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "a1f68dbb59b457bbfa5ddf766fc51ef0", "sha256": "9f31216cf171b0035f35b9ebdb30c82027c0335161e0bda75591ad3d8425af4c" }, "downloads": -1, "filename": "easyargs-0.8.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a1f68dbb59b457bbfa5ddf766fc51ef0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5320, "upload_time": "2016-10-11T14:13:54", "url": "https://files.pythonhosted.org/packages/e0/b0/72c0a50ca7d2bae4f0b4da5b5ad16245c3efe7d005a2c11ff5d066d14872/easyargs-0.8.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6b15682a815dfa05dadc4f839e33903", "sha256": "ae2be9cf86450acd7941640ed0a124fb660c28eb9c99a73adef33e1b90bfb022" }, "downloads": -1, "filename": "easyargs-0.8.1.tar.gz", "has_sig": false, "md5_digest": "f6b15682a815dfa05dadc4f839e33903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5073, "upload_time": "2016-10-11T14:13:56", "url": "https://files.pythonhosted.org/packages/18/59/1755ab16860ce39bdfebd91e3b6d1ba16785f3f6cec0cade5534cf3ff107/easyargs-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "87d17dbcdc8f6e3e9b0e358e864cbe87", "sha256": "b2c83ff40fd47323b5c946466a8979afde9a1fb1bd6a1d6abea458ac43e233f8" }, "downloads": -1, "filename": "easyargs-0.8.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "87d17dbcdc8f6e3e9b0e358e864cbe87", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5355, "upload_time": "2016-10-11T18:41:39", "url": "https://files.pythonhosted.org/packages/10/32/65fffff92cb22f035c68c075f57e7aee6c8f8b3773142c6a2e4d172a3e33/easyargs-0.8.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "915fc5e0cbeeb813e848be78c0d8dee8", "sha256": "883e448baab9a976fc3a012860e94328d8ec0685e885d3076afc00f8d8f3e76f" }, "downloads": -1, "filename": "easyargs-0.8.2.tar.gz", "has_sig": false, "md5_digest": "915fc5e0cbeeb813e848be78c0d8dee8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5157, "upload_time": "2016-10-11T18:41:41", "url": "https://files.pythonhosted.org/packages/79/fc/f110f444a8bcbb5c4e9faaf1235a62abd3d06af4c1e04fe581a514901c14/easyargs-0.8.2.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "2f55df6e1a76b3c851de7fc007089b7c", "sha256": "414521d54c83045d8b65c0d2f8e4bde09e83653e51fe0551b26ea8bfbde5711b" }, "downloads": -1, "filename": "easyargs-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f55df6e1a76b3c851de7fc007089b7c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9254, "upload_time": "2016-10-21T22:20:54", "url": "https://files.pythonhosted.org/packages/78/30/6c95ec95d6dad2cf1a46ed42a94daa651c39ff9a372fd613d37b3696595a/easyargs-0.9.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69a2886862d47e71fb82c9d44cb99eaa", "sha256": "5c9843ea01650728ba81cf45d2fc0b679199f8f7d5af1a00835a077221679ed9" }, "downloads": -1, "filename": "easyargs-0.9.0.tar.gz", "has_sig": false, "md5_digest": "69a2886862d47e71fb82c9d44cb99eaa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8597, "upload_time": "2016-10-21T22:20:57", "url": "https://files.pythonhosted.org/packages/0d/07/6d760a80c75aea6fee214fa18eaebc3d574ae14eec976bea6a747cb0a7e8/easyargs-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "73c78bb5a78227f120c48afeaa683ad4", "sha256": "24edba24750c071b438905e4336415778b31f31efee5d791138242ff33284d87" }, "downloads": -1, "filename": "easyargs-0.9.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "73c78bb5a78227f120c48afeaa683ad4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9261, "upload_time": "2016-10-23T20:56:07", "url": "https://files.pythonhosted.org/packages/88/70/6d2abf7fb3137c683cc6e9cb78e7d2c62d7e9c8217b4e9edd4333053ec68/easyargs-0.9.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e43575b3dec76d9a4bd59a429112ee96", "sha256": "e58721e0f1707061412fbf50154d487cf202725c02f123f2d28ad471a24d3be3" }, "downloads": -1, "filename": "easyargs-0.9.1.tar.gz", "has_sig": false, "md5_digest": "e43575b3dec76d9a4bd59a429112ee96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8611, "upload_time": "2016-10-23T20:56:10", "url": "https://files.pythonhosted.org/packages/fd/25/93399c539d964ae51ac121ba6fc30e5903b5f173a01fe55d6b24b254427e/easyargs-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "b59009514757896e9f00ff23182c2241", "sha256": "ddcb1fdaf8bed51b7bdda146a07c2ed9561b113a3bee5499b607083fa9bb9ba2" }, "downloads": -1, "filename": "easyargs-0.9.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b59009514757896e9f00ff23182c2241", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9808, "upload_time": "2016-11-13T10:14:13", "url": "https://files.pythonhosted.org/packages/78/8d/adccef53cc2590ac56fbdc4e8607f65c29633e74e7084c23e07766cb8f84/easyargs-0.9.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5226e7d1788d4500546a4e8c902878c", "sha256": "d98191dd8b2f7d8463f7e15ad1231e8fb795dc015c02d4ddcdc74ccfd8b7fcf0" }, "downloads": -1, "filename": "easyargs-0.9.2.tar.gz", "has_sig": false, "md5_digest": "e5226e7d1788d4500546a4e8c902878c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9646, "upload_time": "2016-11-13T10:14:15", "url": "https://files.pythonhosted.org/packages/9c/c2/68418b93f79325091bca3314df95e8006eb96b88ef85a9efb4f5d39dc197/easyargs-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "95028ad658394e01b5ceb1189faea8bd", "sha256": "ba1e73ff1a272d33178ffca52f63ca5796326fb12d7b60739fe71b2638cfbf5e" }, "downloads": -1, "filename": "easyargs-0.9.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "95028ad658394e01b5ceb1189faea8bd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9809, "upload_time": "2017-01-21T10:19:38", "url": "https://files.pythonhosted.org/packages/d5/4a/6d8f8a82eaecd62a3b6ad3cd184ab5b25ad82df2d7b822ca642db6e291af/easyargs-0.9.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "713dfe978cc4f3e45e8703b7e4d69fd7", "sha256": "41b02094f7c51ecdea2ff8c381913dba397f6a36280cd70f076505d8a1bce473" }, "downloads": -1, "filename": "easyargs-0.9.3.tar.gz", "has_sig": false, "md5_digest": "713dfe978cc4f3e45e8703b7e4d69fd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9820, "upload_time": "2017-01-21T10:19:40", "url": "https://files.pythonhosted.org/packages/64/fa/31c7a7924b7477c666b0863f1d972d2359db1a5d1752389afe9d74a697b9/easyargs-0.9.3.tar.gz" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "a421eba5db0e8b596107058a67896cc2", "sha256": "791a223ec3fc716ebe463dc34f5a57db3d747a6477fb5a0c7e2e1b2d69df9d7c" }, "downloads": -1, "filename": "easyargs-0.9.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a421eba5db0e8b596107058a67896cc2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9855, "upload_time": "2017-07-05T20:16:04", "url": "https://files.pythonhosted.org/packages/b6/0e/ebd8e33c112912b8b5729b6e43f1a4197879b5e49ca2c3ba39e6709e0d09/easyargs-0.9.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2397bb4619a56e5d48983633f5d35b41", "sha256": "cc5638e2ca63183c9efb2b60d88c9ed1c1e338d41df45492dad078db4400aeb1" }, "downloads": -1, "filename": "easyargs-0.9.4.tar.gz", "has_sig": false, "md5_digest": "2397bb4619a56e5d48983633f5d35b41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10438, "upload_time": "2017-07-05T20:16:05", "url": "https://files.pythonhosted.org/packages/45/ce/ebbce6a97305e2bd5e2bcfdeb79409ed7d43d1a383b85db52c6bbacd9e4d/easyargs-0.9.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a421eba5db0e8b596107058a67896cc2", "sha256": "791a223ec3fc716ebe463dc34f5a57db3d747a6477fb5a0c7e2e1b2d69df9d7c" }, "downloads": -1, "filename": "easyargs-0.9.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a421eba5db0e8b596107058a67896cc2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9855, "upload_time": "2017-07-05T20:16:04", "url": "https://files.pythonhosted.org/packages/b6/0e/ebd8e33c112912b8b5729b6e43f1a4197879b5e49ca2c3ba39e6709e0d09/easyargs-0.9.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2397bb4619a56e5d48983633f5d35b41", "sha256": "cc5638e2ca63183c9efb2b60d88c9ed1c1e338d41df45492dad078db4400aeb1" }, "downloads": -1, "filename": "easyargs-0.9.4.tar.gz", "has_sig": false, "md5_digest": "2397bb4619a56e5d48983633f5d35b41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10438, "upload_time": "2017-07-05T20:16:05", "url": "https://files.pythonhosted.org/packages/45/ce/ebbce6a97305e2bd5e2bcfdeb79409ed7d43d1a383b85db52c6bbacd9e4d/easyargs-0.9.4.tar.gz" } ] }