{ "info": { "author": "Ahmed Soliman", "author_email": "asoli@fb.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# python-nubia\n\n[![Build Status](https://travis-ci.com/facebookincubator/python-nubia.svg?token=aPxsLj8RpMSsSYqaqL5e&branch=master)](https://travis-ci.com/facebookincubator/python-nubia)\n[![Coverage](https://codecov.io/gh/facebookincubator/python-nubia/branch/master/graph/badge.svg)](https://codecov.io/github/facebookincubator/python-nubia)\n\nNubia is a lightweight framework for building command-line applications with Python. It was originally designed for the \u201clogdevice interactive shell (aka. `ldshell`)\u201d at Facebook. Since then it was factored out to be a reusable component and several internal Facebook projects now rely on it as a quick and easy way to get an intuitive shell/cli application without too much boilerplate.\n\nNubia is built on top of [python-prompt-toolkit](https://github.com/jonathanslenders/python-prompt-toolkit) which is a fantastic toolkit for building interactive command-line applications.\n\n_Disclaimer: Nubia is beta for non-ldshell use-cases. Some of the design decisions might sound odd but they fit the ldshell usecase perfectly. We are continuously making changes to make it more consistent and generic outside of the ldshell use-case. Until a fully stable release is published, use it on your own risk._\n\nSee the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.\n\nIf you are curious on the origins of the name, checkout [Nubia on Wikipedia](https://en.wikipedia.org/wiki/Nubia) with its unique and colourful architecture.\n\n## Key Features\n\n* Interactive mode that offers fish-style auto-completion\n* CLI mode that gets generated from your functions and classes.\n* Optional bash/zsh completions via an external utility \u2018nubia-complete\u2019 (experimental)\n* A customisable status-bar in interactive mode.\n* An optional IPython-based interactive shell\n* Arguments with underscores are automatically hyphenated\n* Python3 type annotations are used for input type validation\n\n### Interactive mode\nThe interactive mode in Nubia is what makes it unique. It is very easy to build a unique shell for your program with zero overhead. The interactive shell in its simplistic form offers automatic completions for commands, sub-commands, arguments, and values. It also offers a great deal of control for developers to take control over auto-completions, even for commands that do not fall under the typical format. An example is the \u201cselect\u201d command in ldshell which is expressed as a SQL-query. We expect that most use cases of Nubia will not need such control and the AutoCommand will be enough without further customisation.\n\nIf you start a nubia-based program without a command, it automatically starts an interactive shell. The interactive mode looks like this:\n\n![Interactive Demo](docs/interactive.gif?raw=true \"Interactive demo\")\n\n### Non-interactive mode\nThe CLI mode works exactly like any traditional unix-based command line utility.\n![Non-interactive Demo](docs/non_interactive.png?raw=true \"Non-interactive demo\")\n\n## Examples\nIt starts with a function like this:\n```py\nimport socket\nimport typing\n\nfrom termcolor import cprint\nfrom nubia import argument, command, context\n\n@command\n@argument(\"hosts\", description=\"Hostnames to resolve\", aliases=[\"i\"])\n@argument(\"bad_name\", name=\"nice\", description=\"testing\")\ndef lookup(hosts: typing.List[str], bad_name: int):\n \"\"\"\n This will lookup the hostnames and print the corresponding IP addresses\n \"\"\"\n ctx = context.get_context()\n print(f\"hosts: {hosts}\")\n cprint(f\"Verbose? {ctx.verbose}\")\n\n for host in hosts:\n cprint(f\"{host} is {socket.gethostbyname(host)}\")\n\n # optional, by default it's 0\n return 0\n```\n\n## Requirements\n\nNubia-based applications require python 3.6+ and works with both Mac OS X or Linux. While in theory it should work on Windows, it has never been tried.\n\n## Installing Nubia\n\nIf you are installing nubia for your next project, you should be able to easily use pip for that:\n```bash\npip3 install python-nubia\n```\n\n## Building Nubia from source\n\nYou can either setup.py to build a tarball, or use pipenv to setup a virtualenv with all the dependencies installed.\n\n## Running example in virtualenv:\n\nIt's often best to create a virtualenv to contain the dependencies required for python-nubia project.\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n```\n\nIf you would like to run the example, then you need to add the root of the source tree into your PYTHONPATH.\n```bash\nvirtualenv .venv\nsource .venv/bin/activate\n\nexport PYTHONPATH=\"$(pwd)\"\npython3 example/nubia_example.py\n```\n\nTo run the unit tests:\n\nFrom within the virtualenv you can use nosetests:\n```bash\nnosetests\n```\n\nOr if you don't want to create a virtualenv, just use:\n```bash\npython3 setup.py nosetests\n```\n\n## Getting Started\n\nSee the [getting started](GETTING_STARTED.md) guide to learn how to build a simple application with Nubia.\n\n## License\npython-nubia is BSD licensed, as found in the LICENSE file.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/facebookincubator/python-nubia", "keywords": "cli shell interactive framework", "license": "", "maintainer": "", "maintainer_email": "", "name": "python-nubia", "package_url": "https://pypi.org/project/python-nubia/", "platform": "", "project_url": "https://pypi.org/project/python-nubia/", "project_urls": { "Homepage": "https://github.com/facebookincubator/python-nubia" }, "release_url": "https://pypi.org/project/python-nubia/0.2b1/", "requires_dist": null, "requires_python": ">=3.6", "summary": "A framework for building beautiful shells", "version": "0.2b1" }, "last_serial": 5346219, "releases": { "0.1b2": [ { "comment_text": "", "digests": { "md5": "42d6520526dd69c65b461f2a00d102ec", "sha256": "39acde22176d79cc06de7051e6a4f63dcdea9400979d42b89c097b7f2968b683" }, "downloads": -1, "filename": "python_nubia-0.1b2-py3-none-any.whl", "has_sig": false, "md5_digest": "42d6520526dd69c65b461f2a00d102ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 63064, "upload_time": "2018-08-30T16:06:34", "url": "https://files.pythonhosted.org/packages/9e/38/7d804c0e2ae06a460a4be06f76935a0ab9e90b67774c1a00d83b94d250c1/python_nubia-0.1b2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a4962fb883a59cec47a006e3e77c1d03", "sha256": "9f0d7254376778f6e7e7e992728a066f7b5acbc0d15dc5d04e31ebb65a310cbc" }, "downloads": -1, "filename": "python-nubia-0.1b2.tar.gz", "has_sig": false, "md5_digest": "a4962fb883a59cec47a006e3e77c1d03", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 46813, "upload_time": "2018-08-30T16:06:35", "url": "https://files.pythonhosted.org/packages/9c/c6/0fa0d2d33b00a82224233062c1f63fbb132b293baf682534364a15ab6fdb/python-nubia-0.1b2.tar.gz" } ], "0.1b4": [ { "comment_text": "", "digests": { "md5": "d331e20bb4bac1e8232c81a41077f7b5", "sha256": "b264bb52a3b22c8e329332bb33f9cdde10fff3da8a71b1d78cf4cc1227b1572c" }, "downloads": -1, "filename": "python_nubia-0.1b4-py3-none-any.whl", "has_sig": false, "md5_digest": "d331e20bb4bac1e8232c81a41077f7b5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 64575, "upload_time": "2019-01-08T11:50:55", "url": "https://files.pythonhosted.org/packages/25/02/4b5b6f4b8c05386f59e9fc0f60971c1d482c601dae807cee10d1045919b2/python_nubia-0.1b4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "33942ba417e69068beaea0e2868202ce", "sha256": "2dde4242a8d7c33472568348782c584172982ef51e732d03305b7bc450a828b4" }, "downloads": -1, "filename": "python-nubia-0.1b4.tar.gz", "has_sig": false, "md5_digest": "33942ba417e69068beaea0e2868202ce", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 45199, "upload_time": "2019-01-08T11:50:57", "url": "https://files.pythonhosted.org/packages/c0/77/7f0ea2f1a3078abec0facfffcdb5eaa81eaf2d25c95bd36c4017658d3e82/python-nubia-0.1b4.tar.gz" } ], "0.1b5": [ { "comment_text": "", "digests": { "md5": "8d82335fdf09b7de4e04985653a79af5", "sha256": "a9dc3aa2a15c0eb0b21762ce13f9a020c9bc703b45f7c34cd161597f2ef2948b" }, "downloads": -1, "filename": "python-nubia-0.1b5.tar.gz", "has_sig": false, "md5_digest": "8d82335fdf09b7de4e04985653a79af5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 45934, "upload_time": "2019-04-29T11:40:06", "url": "https://files.pythonhosted.org/packages/f9/22/9f012c6aa84ee53e32460e846a658b145579adc28401ce7762fb3e38a127/python-nubia-0.1b5.tar.gz" } ], "0.1b6": [ { "comment_text": "", "digests": { "md5": "9cf958701dd5e4f6396d41ad5379733c", "sha256": "6800063850825c2889c7c9ef045581908c5b0adbc8cdc4b6a97087b81f640aeb" }, "downloads": -1, "filename": "python-nubia-0.1b6.tar.gz", "has_sig": false, "md5_digest": "9cf958701dd5e4f6396d41ad5379733c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 45999, "upload_time": "2019-04-29T16:32:21", "url": "https://files.pythonhosted.org/packages/ce/d7/cc4ad9fbda9041c56501e5ebe6b40ec62fbdf9387f0b5c72107f59f681e6/python-nubia-0.1b6.tar.gz" } ], "0.2b1": [ { "comment_text": "", "digests": { "md5": "9b90e55a8c760868ac6b51a006ea82e7", "sha256": "146662a2f950704db6ad782d418c8d9bf6ad65f4ce42aef23e0129d710c8ab30" }, "downloads": -1, "filename": "python-nubia-0.2b1.tar.gz", "has_sig": false, "md5_digest": "9b90e55a8c760868ac6b51a006ea82e7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 51831, "upload_time": "2019-06-01T11:14:52", "url": "https://files.pythonhosted.org/packages/47/f9/139357a16cd835b3b38fbf6e53bab80867c68bb8b582cd6c3abe51e7ab1d/python-nubia-0.2b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b90e55a8c760868ac6b51a006ea82e7", "sha256": "146662a2f950704db6ad782d418c8d9bf6ad65f4ce42aef23e0129d710c8ab30" }, "downloads": -1, "filename": "python-nubia-0.2b1.tar.gz", "has_sig": false, "md5_digest": "9b90e55a8c760868ac6b51a006ea82e7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 51831, "upload_time": "2019-06-01T11:14:52", "url": "https://files.pythonhosted.org/packages/47/f9/139357a16cd835b3b38fbf6e53bab80867c68bb8b582cd6c3abe51e7ab1d/python-nubia-0.2b1.tar.gz" } ] }