{ "info": { "author": "Louis Paternault", "author_email": "spalax+python@gresille.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: User Interfaces" ], "description": "argdispatch \ud83d\udc08 Drop-in replacement for `argparse` dispatching subcommand calls to functions, modules or binaries\n================================================================================================================\n\n|sources| |pypi| |build| |coverage| |documentation| |license|\n\nIf your parser has less than five subcommands, you can parse them with ``argparse``. If you have more, you still can, but you will get a huge, unreadable code. This module makes this easier by dispatching subcommand calls to functions, modules or binaries.\n\nExamples\n--------\n\nExample 1 : Manual definition of subcommands\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nFor instance, consider the following code for ``mycommand.py``:\n\n.. code-block:: python\n\n import sys\n from argdispatch import ArgumentParser\n\n def foo(args):\n \"\"\"A function associated to subcommand `foo`.\"\"\"\n print(\"Doing interesting stuff\")\n sys.exit(1)\n\n if __name__ == \"__main__\":\n parser = ArgumentParser()\n subparser = parser.add_subparsers()\n\n subparser.add_function(foo)\n subparser.add_module(\"bar\")\n subparser.add_executable(\"baz\")\n\n parser.parse_args()\n\nWith this simple code:\n\n* ``mycommand.py foo -v --arg=2`` is equivalent to the python code ``foo(['-v', '--arg=2'])``;\n* ``mycommand.py bar -v --arg=2`` is equivalent to ``python -m bar -v --arg=2``;\n* ``mycommand.py baz -v --arg=2`` is equivalent to ``baz -v --arg=2``.\n\nThen, each function, module or binary does whatever it wants with the arguments.\n\nExample 2 : Automatic definition of subcommands\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nWith programs like `git `_, if a ``git-foo`` binary exists, then calling ``git foo --some=arguments`` is equivalent to ``git-foo --some=arguments``. The following code, in ``myprogram.py`` copies this behaviour:\n\n.. code-block:: python\n\n import sys\n from argdispatch import ArgumentParser\n\n if __name__ == \"__main__\":\n parser = ArgumentParser()\n subparser = parser.add_subparsers()\n\n subparser.add_submodules(\"myprogram\")\n subparser.add_prefix_executables(\"myprogram-\")\n\n parser.parse_args()\n\nWith this program, given that binary ``myprogram-foo`` and python module ``myprogram.bar.__main__.py`` exist:\n\n* ``myprogram foo -v --arg=2`` is equivalent to ``myprogram-foo -v --arg=2``;\n* ``myprogram bar -v --arg=2`` is equivalent to ``python -m myprogram.bar -v --arg=2``.\n\nDocumentation\n\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe complete documentation is available on `readthedocs `_.\n\nTo compile it from source, download and run::\n\n cd doc && make html\n\nWhat's new?\n-----------\n\nSee `changelog `_.\n\nDownload and install\n--------------------\n\n* From sources:\n\n * Download: https://pypi.python.org/pypi/argdispatch\n * Install (in a `virtualenv`, if you do not want to mess with your distribution installation system)::\n\n python3 setup.py install\n\n* From pip::\n\n pip install argdispatch\n\n* Quick and dirty Debian (and Ubuntu?) package\n\n This requires `stdeb `_ to be installed::\n\n python3 setup.py --command-packages=stdeb.command bdist_deb\n sudo dpkg -i deb_dist/argdispatch-_all.deb\n\n\n.. |documentation| image:: http://readthedocs.org/projects/argdispatch/badge/?version=latest\n :target: http://argdispatch.readthedocs.io\n.. |pypi| image:: https://img.shields.io/pypi/v/argdispatch.svg\n :target: http://pypi.python.org/pypi/argdispatch\n.. |license| image:: https://img.shields.io/pypi/l/argdispatch.svg\n :target: http://www.gnu.org/licenses/gpl-3.0.html\n.. |sources| image:: https://img.shields.io/badge/sources-argdispatch-brightgreen.svg\n :target: http://git.framasoft.org/spalax/argdispatch\n.. |coverage| image:: https://git.framasoft.org/spalax/argdispatch/badges/master/coverage.svg\n :target: https://git.framasoft.org/spalax/argdispatch/builds\n.. |build| image:: https://git.framasoft.org/spalax/argdispatch/badges/master/build.svg\n :target: https://git.framasoft.org/spalax/argdispatch/builds\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://git.framasoft.org/spalax/argdispatch", "keywords": "argparse argument commandline dispatch", "license": "GPLv3 or any later version", "maintainer": "", "maintainer_email": "", "name": "argdispatch", "package_url": "https://pypi.org/project/argdispatch/", "platform": "", "project_url": "https://pypi.org/project/argdispatch/", "project_urls": { "Homepage": "http://git.framasoft.org/spalax/argdispatch" }, "release_url": "https://pypi.org/project/argdispatch/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "A drop-in replacement for `argparse` dispatching subcommand calls to functions, modules or binaries.", "version": "1.0.0" }, "last_serial": 3647863, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "bafb536d4b0d4695b012843d46c04614", "sha256": "70b718599bf0386a384dae5b66de70ab6b3c0caf533ca8d978da4b20847c2eff" }, "downloads": -1, "filename": "argdispatch-0.1.0-py3-none-any.whl", "has_sig": true, "md5_digest": "bafb536d4b0d4695b012843d46c04614", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10077, "upload_time": "2016-04-14T16:25:26", "url": "https://files.pythonhosted.org/packages/9b/99/ac9048599fe92c267a97a9147b90cc58b20d26a7dd49b47fa3b42b579432/argdispatch-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cac64f3e6ee39da3be531f30b90b60a4", "sha256": "a6a0e8bccbab365672f9945c4ebd62c837966b204bdc3eefb963a75e88051411" }, "downloads": -1, "filename": "argdispatch-0.1.0.tar.gz", "has_sig": true, "md5_digest": "cac64f3e6ee39da3be531f30b90b60a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33337, "upload_time": "2016-04-14T16:26:03", "url": "https://files.pythonhosted.org/packages/e9/84/0ec8d388a0e737d202d174227936015d7bed094031eed291c167cddd591f/argdispatch-0.1.0.tar.gz" } ], "0.1.0b1": [ { "comment_text": "", "digests": { "md5": "e271e7e593116a46cf2f47e040c8bc71", "sha256": "7f239a3890c725939671c9ae49eab3fa1b1f5417e2313b56d3ccc223ff918874" }, "downloads": -1, "filename": "argdispatch-0.1.0b1-py3-none-any.whl", "has_sig": true, "md5_digest": "e271e7e593116a46cf2f47e040c8bc71", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10096, "upload_time": "2016-04-12T15:53:18", "url": "https://files.pythonhosted.org/packages/2a/23/93d42e81b227fb489afe08002ae3fde8201323aecae5745ecd04d45d7cd5/argdispatch-0.1.0b1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ffebddbdc586a30170269eb05289003c", "sha256": "01148038280760907953fb5b9f714ca4f2666babc86f693403fe29ab8b77d2fb" }, "downloads": -1, "filename": "argdispatch-0.1.0b1.tar.gz", "has_sig": true, "md5_digest": "ffebddbdc586a30170269eb05289003c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33314, "upload_time": "2016-04-12T15:53:28", "url": "https://files.pythonhosted.org/packages/85/50/a7bf7bf8e2605e063df9cfe3bbd84007d5b39b944d08496aac8f5b82f3b9/argdispatch-0.1.0b1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "0c7f5419342ce35fcdd4d776c3901896", "sha256": "27d34e26f8e799550b1045040e454ab605b5c68bbed75ab9b95ca73db5d861a6" }, "downloads": -1, "filename": "argdispatch-0.1.1-py3-none-any.whl", "has_sig": true, "md5_digest": "0c7f5419342ce35fcdd4d776c3901896", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10231, "upload_time": "2016-05-21T20:43:54", "url": "https://files.pythonhosted.org/packages/56/e8/4e3c472a1727cb1e72baf7a288d7239971a0fbec9f66df9c8036f3bc2d5a/argdispatch-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4e72d380e9eb51ba0f34716a83509711", "sha256": "396b23e10e0912cd2ed24795f82d556d6e18c0b5a3c6cb3fc1c5a03d6c07b256" }, "downloads": -1, "filename": "argdispatch-0.1.1.tar.gz", "has_sig": true, "md5_digest": "4e72d380e9eb51ba0f34716a83509711", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34703, "upload_time": "2016-05-21T20:45:10", "url": "https://files.pythonhosted.org/packages/0a/f3/d3eafe5bed63e2796ae56d430da4e8f19c3d69ae8532e6b885512fd7b420/argdispatch-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c7458fed26cf766e6615cdcbe68fc653", "sha256": "93562ac53f817535e21e252cdd8343b87ac9d94af0d1f4b29679840a3f1666bb" }, "downloads": -1, "filename": "argdispatch-0.2.0-py3-none-any.whl", "has_sig": true, "md5_digest": "c7458fed26cf766e6615cdcbe68fc653", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10432, "upload_time": "2017-04-28T13:21:33", "url": "https://files.pythonhosted.org/packages/64/59/ed0ca0869685305f84aa153af366034ecef70e782b35dfd91f20847be246/argdispatch-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b581b6b50728858907358bb9def4c46", "sha256": "59e8609c8eefeae3e74cc79979211e53b77e6e6dfe2ab81ff76face5d6d6b877" }, "downloads": -1, "filename": "argdispatch-0.2.0.tar.gz", "has_sig": true, "md5_digest": "4b581b6b50728858907358bb9def4c46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35186, "upload_time": "2017-04-28T13:21:36", "url": "https://files.pythonhosted.org/packages/b9/d2/7333339d6752c00bb748f8cba2e5c8b175fa6def905332ad6cf52ad420ea/argdispatch-0.2.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "19576348956744fe151e46418503e0b8", "sha256": "874f10e5bb41e7840d89d108af728a03f9a054f2943a005f62f170364d13595e" }, "downloads": -1, "filename": "argdispatch-1.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "19576348956744fe151e46418503e0b8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10725, "upload_time": "2018-03-07T13:59:18", "url": "https://files.pythonhosted.org/packages/d8/98/d704d4333e4f788076530123fc542719a442cfb12811c7d0cd7af4a1eda4/argdispatch-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "38c5ea38734ef127b2bca57d5a181f7e", "sha256": "763378e45955384a0fa537fc1825727f2a5de752dd9d3a6fad0d1312e84798be" }, "downloads": -1, "filename": "argdispatch-1.0.0.tar.gz", "has_sig": true, "md5_digest": "38c5ea38734ef127b2bca57d5a181f7e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35325, "upload_time": "2018-03-07T13:59:19", "url": "https://files.pythonhosted.org/packages/03/72/ea1da69efe0b930a870930e6b8485fbcf9f3d89e8c908d96619c9ea38e3e/argdispatch-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "19576348956744fe151e46418503e0b8", "sha256": "874f10e5bb41e7840d89d108af728a03f9a054f2943a005f62f170364d13595e" }, "downloads": -1, "filename": "argdispatch-1.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "19576348956744fe151e46418503e0b8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10725, "upload_time": "2018-03-07T13:59:18", "url": "https://files.pythonhosted.org/packages/d8/98/d704d4333e4f788076530123fc542719a442cfb12811c7d0cd7af4a1eda4/argdispatch-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "38c5ea38734ef127b2bca57d5a181f7e", "sha256": "763378e45955384a0fa537fc1825727f2a5de752dd9d3a6fad0d1312e84798be" }, "downloads": -1, "filename": "argdispatch-1.0.0.tar.gz", "has_sig": true, "md5_digest": "38c5ea38734ef127b2bca57d5a181f7e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35325, "upload_time": "2018-03-07T13:59:19", "url": "https://files.pythonhosted.org/packages/03/72/ea1da69efe0b930a870930e6b8485fbcf9f3d89e8c908d96619c9ea38e3e/argdispatch-1.0.0.tar.gz" } ] }