{ "info": { "author": "Federico Cerchiari", "author_email": "federicocerchiari@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# ClassCLI\nCommand Line Interfaces from class definitions.\n\n[![PyPI version](https://badge.fury.io/py/classcli.svg)](https://badge.fury.io/py/classcli) [![PyPI version](https://img.shields.io/badge/python-%3E%3D%203.5-blue.svg)](https://pypi.org/project/classcli/) [![Build Status](https://travis-ci.org/Hrabal/ClassCLI.svg?branch=master)](https://travis-ci.org/Hrabal/ClassCLI) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/ece6dfe1a5774a5992061515b36db0d4)](https://app.codacy.com/app/federicocerchiari/ClassCLI?utm_source=github.com&utm_medium=referral&utm_content=Hrabal/ClassCLI&utm_campaign=Badge_Grade_Dashboard) [![Maintainability](https://api.codeclimate.com/v1/badges/d281ff92c2d45c4f2e75/maintainability)](https://codeclimate.com/github/Hrabal/ClassCLI/maintainability) [![Coverage Status](https://coveralls.io/repos/github/Hrabal/ClassCLI/badge.svg?branch=master)](https://coveralls.io/github/Hrabal/ClassCLI?branch=master) [![Downloads](https://pepy.tech/badge/classcli)](https://pepy.tech/project/classcli) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/Hrabal/ClassCLI/master/LICENSE)\n\nVery similar to [Fire](https://github.com/google/python-fire), this is a Python module that let you build command line interfaces directly from collection of classes, saving you from writing boilerplate code.\n\nClassCLI is built on top of argparse, it create arguments of the cli by inspecting the classes in a given list or in a module. Each compatible class is transformed in a first-level argument, each function in a second-level argument, each function's argument in a third level argument.\n\nClassCLI uses docstrings to build the CLI's help, kwargs defaults to set CLI's pars defaults and type hints to infer CLI's pars types.\n\nClassCLI can be used to build CLI interfaces on top of existing APIs, or can be used to write scripts with a full-featured CLI writing commands and arguments as classes and functions.\n\nExample code:\n```python\nfrom classcli import CliBuilder\n\n\nclass NonCommandClass:\n pass\n\n\nclass MainCommand:\n \"\"\"Docstring are used for help.\"\"\"\n callable_cls = True\n command = 'foo'\n\n def _base(self):\n \"\"\"Docstring are used for help in methods too.\"\"\"\n print('This script is running as a foo.')\n\n def with_args(self,\n first_arg: int, # Type annotations are used to add a type check on the CLI arg\n second_arg):\n print('This script is running as a foo with %s %s.' % (first_arg, second_arg))\n\n\nclass SecondCommand:\n callable_cls = True\n command = 'bar'\n\n def _base(self):\n print('This script is running in a bar.')\n\n def order(self,\n order='Beer' # method kwargs are translated to optiona args in the form of \"--arg\"\n ):\n print('You ordered a %s' % order)\n\n\nif __name__ == '__main__':\n CliBuilder(locals()).run_cli()\n\n```\n\n\nThis projects's goals:\n * this project should let fast CLI prototyping\n * this project should stay lightweight", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/Hrabal/ClassCLI/archive/0.0.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Hrabal/ClassCLI", "keywords": "python3,cli,argparse,userio,io,commandline", "license": "APACHE 2.0", "maintainer": "", "maintainer_email": "", "name": "classcli", "package_url": "https://pypi.org/project/classcli/", "platform": "", "project_url": "https://pypi.org/project/classcli/", "project_urls": { "Download": "https://github.com/Hrabal/ClassCLI/archive/0.0.2.tar.gz", "Homepage": "https://github.com/Hrabal/ClassCLI" }, "release_url": "https://pypi.org/project/classcli/0.0.2/", "requires_dist": null, "requires_python": ">=3.3", "summary": "Command Line Interfaces from custom classes", "version": "0.0.2" }, "last_serial": 4602956, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "fe8c4fddaefc04a965a90ec4a656be00", "sha256": "1f3a4ada69146404b157b3c8e4c86071b071e9356fcd31b94be84fc323110a20" }, "downloads": -1, "filename": "classcli-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fe8c4fddaefc04a965a90ec4a656be00", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3", "size": 7146, "upload_time": "2018-11-08T18:26:21", "url": "https://files.pythonhosted.org/packages/46/bd/64189f857c07486c4ddb9a7ad94458c1f27763be057e9aae06d7974b9cf1/classcli-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b036efa475ae145eaa91edb7e868f699", "sha256": "6a57c2fb0762e2818b974f1e655a2cec842d5d75fe0b98e159ad500517c5ac8f" }, "downloads": -1, "filename": "classcli-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b036efa475ae145eaa91edb7e868f699", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3", "size": 2889, "upload_time": "2018-11-08T18:26:23", "url": "https://files.pythonhosted.org/packages/e9/7d/7ee836e12e328c39cdc569cdbd272196f93ccfd217a2d05673e42c133ee9/classcli-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "97da5fe128c8c8b2f055f000b6574001", "sha256": "e4c6a568ffc7e1036126a7220c37e29013b96b80d48fe08d9a36cec61f7f1798" }, "downloads": -1, "filename": "classcli-0.0.2.tar.gz", "has_sig": false, "md5_digest": "97da5fe128c8c8b2f055f000b6574001", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3", "size": 4573, "upload_time": "2018-12-15T15:48:51", "url": "https://files.pythonhosted.org/packages/4a/c1/fbe28ccc3958449dc5fa23319f9f1a5685b8ce083960e71034d7faa8d792/classcli-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "97da5fe128c8c8b2f055f000b6574001", "sha256": "e4c6a568ffc7e1036126a7220c37e29013b96b80d48fe08d9a36cec61f7f1798" }, "downloads": -1, "filename": "classcli-0.0.2.tar.gz", "has_sig": false, "md5_digest": "97da5fe128c8c8b2f055f000b6574001", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.3", "size": 4573, "upload_time": "2018-12-15T15:48:51", "url": "https://files.pythonhosted.org/packages/4a/c1/fbe28ccc3958449dc5fa23319f9f1a5685b8ce083960e71034d7faa8d792/classcli-0.0.2.tar.gz" } ] }