{ "info": { "author": "Benjamin Althues", "author_email": "benjamin@babab.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Shells", "Topic :: System :: Software Distribution", "Topic :: Terminals", "Topic :: Utilities" ], "description": "pycommand 0.4.0\n******************************************************************************\n\n**Library / toolkit for creating command line programs with minimal effort.**\n\nPycommand is essentially a fancy wrapper around getopt that consists of\none simple `CommandBase` class that you can inherit to create executable\ncommands for your (Python) programs with very simplistic and readable\ncode. It has support for subcommands and also nesting commands, so you\ncan create (multiple levels of) subcommands, with the ability to pass\nthe values of optional arguments of a command object to its subcommand\nobjects. Supported Python versions are 2.7 and 3.2 and later.\n\n- Documentation: https://babab.github.io/pycommand/\n- PyPI: https://pypi.python.org/pypi/pycommand/\n- Github: https://github.com/babab/pycommand\n\n\nFeatures\n========\n\n- Parsing of optional and positional arguments\n- Minimalistic approach with a clean API\n- Create scripts in a matter of minutes using the code generator\n- Auto compiled usage messages\n- Graceful semi-automatic handling of exit status codes\n- Subcommands can have subcommands that can have subcommands\n (each with their own optional arguments)\n- Pass values for --some-option from a parent command into child commands.\n\n\nDownload and install\n====================\n\nIf you have pip installed, you can just do:\n\n.. code-block:: console\n\n # pip install pycommand\n\n\nScript generator\n================\n\nTo quickly start writing a command from a template (much like the\nexamples below), use the script generator by running:\n\n.. code-block:: console\n\n $ python -m pycommand init\n\nThis will ask you for an executable name, class name and template type\nand it will save it to an executable python script, ready to be used as\na command line program.\n\nYou can have a very basic command line program that handles ``-v,\n--version`` and ``-h, --help`` arguments set up in less than a minute.\n\n\nExample\n=======\n\nFor full documentation and examples, visit http://pythonhosted.org/pycommand/\n\nHere is an undocumented code example of getting automated usage text\ngeneration and parsing of optional arguments. If we name the script\nfor which you can see the code below ``basic-example`` and execute it,\nthe following will be the output for running ``basic-example -h`` or\n``basic-example --help``:\n\n.. code-block:: console\n\n usage: basic-example [options]\n\n An example of a basic CLI program\n\n Options:\n -h, --help show this help information\n -f , --file= use specified file\n --version show version information\n\nAnd here is the code:\n\n.. code-block:: python\n\n #!/usr/bin/env python\n\n import pycommand\n import sys\n\n\n class BasicExampleCommand(pycommand.CommandBase):\n '''An example of a basic CLI program'''\n usagestr = 'usage: basic-example [options]'\n description = __doc__\n\n optionList = (\n ('help', ('h', False, 'show this help information')),\n ('file', ('f', '', 'use specified file')),\n ('version', ('', False, 'show version information')),\n )\n\n def run(self):\n if self.flags.help:\n print(self.usage)\n return 0\n elif self.flags.version:\n print('Python version ' + sys.version.split()[0])\n return 0\n elif self.flags.file:\n print('filename = ' + self.flags.file)\n return 0\n\n print('Program completed. Try adding \"--help\"')\n\n if __name__ == '__main__':\n # Shortcut for reading from sys.argv[1:] and sys.exit(status)\n pycommand.run_and_exit(BasicExampleCommand)\n\n # The shortcut is equivalent to the following:\n\n # cmd = BasicExampleCommand(sys.argv[1:])\n # if cmd.error:\n # print('error: {0}'.format(cmd.error))\n # sys.exit(1)\n # else:\n # sys.exit(cmd.run())\n\n\nWhy was it created?\n===================\n\nWhen parsing command line program arguments, I sometimes work with\n`argparse` (a replacement for `optparse`). I don't really like the API\nand the output it gives, which is the main reason I've always used\n`getopt` for parsing arguments whenever possible.\n\nThe `CommandBase` class was originally written for *DisPass*,\nwhich is a password manager/generator, as a means to easily define new\nsubcommands and have auto-generated usage messages. Because I want to\nhave this in other projects I've decided to put it in the cheeseshop in 2013.\nIt has since been refined for more generic usage and has proven to be\nstable and workable throughout the years.\n\n\nSoftware license\n================\n\nCopyright (c) 2013-2016, 2018 Benjamin Althues \n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nChange Log\n==========\n\npycommand adheres to `Semantic Versioning `_.\n\n0.4.0 - 2018-03-27\n------------------\n\nAdded\n#####\n- Full templates can now (also) be auto generated\n- CI testing for Python 3.5 and 3.6\n\nChanged\n#######\n\n.. note::\n\n The ``pycommand init`` script is removed and is included in the\n pycommand package itself.\n\n To auto generate scripts from templates, from now on use:\n\n python -m pycommand init\n\n\n- The code is split up into several modules and pycommand is now\n distributed as a package rather than a single module. The public\n API does not change however, all relevant members (CommandBase,\n run_and_exit) that are now placed in pycommand.pycommand are\n exposed through __init__ and therefore are still available as\n ``pycommand.CommandBase`` and ``pycommand.run_and_exit``.\n- Code generator is included in the package itself instead of\n using an installed script (``pycommand init``)\n- All templates are now embedded as well\n\nRemoved\n#######\n- Pycommand init script (installed into /usr/local/bin)\n- Templates directory\n- GNU info docs and manpage from distribution (they can still be generated)\n\n * pycommand.3 (prev. installed into /share/man/man3)\n * pycommand.info\n\n\n0.3.0 - 2015-06-04\n------------------\n\nAdded\n#####\n- Shortcut ``run_and_exit()`` for reading from ``sys.argv[1:]`` and exiting\n the interpreter via ``sys.exit(status)``\n- Package as wheel distribution to speed up installations\n- Add ``man pycommand`` ability, i.e. install mandoc in ``/usr/share/man3/``\n\nChanged\n#######\n- Add support for getting flags by attribute like ``self.flags.help``.\n The default approach for normal dicts like ``self.flags['help']``\n remains valid.\n\n\n0.2.0 - 2015-05-21\n------------------\n\nAdded\n#####\n- Full example of a command with subcommands\n- Create quick templates via pycommand script (``pycommand init``)\n- Unit tests and automatic testing via Travis-CI\n- Documentation ``man`` (.3) and ``info`` (.info) pages\n\nChanged\n#######\n- Specification of subcommands can be `defined in CommandBase.command`__\n as a shortcut.\n\n__ https://github.com/babab/pycommand/commit/a978a05ef92f70f0ce6b06d96a38c2caa8297ecc\n\n0.1.0 - 2013-08-08\n------------------\nAdded\n#####\n- Initial release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "http://pypi.python.org/pypi/pycommand/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://babab.github.io/pycommand/", "keywords": "", "license": "ISC", "maintainer": "", "maintainer_email": "", "name": "pycommand", "package_url": "https://pypi.org/project/pycommand/", "platform": "any", "project_url": "https://pypi.org/project/pycommand/", "project_urls": { "Download": "http://pypi.python.org/pypi/pycommand/", "Homepage": "https://babab.github.io/pycommand/" }, "release_url": "https://pypi.org/project/pycommand/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "Library / toolkit for creating command line programs with minimal effort.", "version": "0.4.0" }, "last_serial": 3711833, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1c41cdf89c4b63f9cd04c6b478b439b4", "sha256": "52e8cbc9c3c5cae0584b191b8ee34781d7fe17777706a91a5deccbaad393d034" }, "downloads": -1, "filename": "pycommand-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1c41cdf89c4b63f9cd04c6b478b439b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3836, "upload_time": "2013-08-08T20:56:58", "url": "https://files.pythonhosted.org/packages/2f/91/7bc47b35a29e013b45182ab311eecf8bafcff5913d8e959b0791ae812081/pycommand-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1d8aea3f12da41a9178c62682f749c35", "sha256": "443d79689d4ce48c74d30ad586cf8b6d961a93e39728fd297f81fa7608267cee" }, "downloads": -1, "filename": "pycommand-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1d8aea3f12da41a9178c62682f749c35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13251, "upload_time": "2015-05-20T23:55:48", "url": "https://files.pythonhosted.org/packages/0c/3e/4fc8147026fbe5048b241493d440dfc14b99dcdfa48b6e5db52a6aef7642/pycommand-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "9b3fe63dfb6ce80544edfaa7483244c9", "sha256": "bb9812eb2d1a65c194b5ce8ad2522eecaaa3ec3415b51b0af80580ec483dd147" }, "downloads": -1, "filename": "pycommand-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b3fe63dfb6ce80544edfaa7483244c9", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 24231, "upload_time": "2015-06-04T17:48:06", "url": "https://files.pythonhosted.org/packages/24/9f/70cfb27bea2f3930d7cd13bbf411c3611488d6bfdd7b01b5d8f4877b1f82/pycommand-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d8197b987c5096ae5646f0155f1aa1d", "sha256": "a5dfe969b4aa4585e1f6059f146ef441db2de329788d8ec2cb49018f68bfc239" }, "downloads": -1, "filename": "pycommand-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2d8197b987c5096ae5646f0155f1aa1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17014, "upload_time": "2015-06-04T17:47:57", "url": "https://files.pythonhosted.org/packages/e2/65/a46ffc8989c8210600aa013ce5892306559cc4c44fe745a3e29cab997709/pycommand-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "a20d984310d601c61b0c36c3823d9219", "sha256": "e068d5c4a15101a6091e7fd2eedbed6f1e27464dde61da8c6644d6ead2b1d844" }, "downloads": -1, "filename": "pycommand-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a20d984310d601c61b0c36c3823d9219", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 24194, "upload_time": "2018-03-27T21:19:07", "url": "https://files.pythonhosted.org/packages/e9/91/fbd189f4a1907dad37f28e4cae80bec74a034943c0f7d327289a28d4e616/pycommand-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09cf84ba32b31a72b60837b175ac5035", "sha256": "b06c2c47e9a112f632f304cbde5bd4b0480c37cdf2ab824e47e57089db0b0448" }, "downloads": -1, "filename": "pycommand-0.4.0.tar.gz", "has_sig": false, "md5_digest": "09cf84ba32b31a72b60837b175ac5035", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11996, "upload_time": "2018-03-27T21:19:08", "url": "https://files.pythonhosted.org/packages/9b/fa/d9fcf330e04c4ee7cdd44137376b9906042b983ff75af3801bfe9d7dc976/pycommand-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a20d984310d601c61b0c36c3823d9219", "sha256": "e068d5c4a15101a6091e7fd2eedbed6f1e27464dde61da8c6644d6ead2b1d844" }, "downloads": -1, "filename": "pycommand-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a20d984310d601c61b0c36c3823d9219", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 24194, "upload_time": "2018-03-27T21:19:07", "url": "https://files.pythonhosted.org/packages/e9/91/fbd189f4a1907dad37f28e4cae80bec74a034943c0f7d327289a28d4e616/pycommand-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09cf84ba32b31a72b60837b175ac5035", "sha256": "b06c2c47e9a112f632f304cbde5bd4b0480c37cdf2ab824e47e57089db0b0448" }, "downloads": -1, "filename": "pycommand-0.4.0.tar.gz", "has_sig": false, "md5_digest": "09cf84ba32b31a72b60837b175ac5035", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11996, "upload_time": "2018-03-27T21:19:08", "url": "https://files.pythonhosted.org/packages/9b/fa/d9fcf330e04c4ee7cdd44137376b9906042b983ff75af3801bfe9d7dc976/pycommand-0.4.0.tar.gz" } ] }