{"id":16868571,"url":"https://github.com/ahopkins/asynccli","last_synced_at":"2025-10-05T11:53:52.663Z","repository":{"id":57412071,"uuid":"101536962","full_name":"ahopkins/asynccli","owner":"ahopkins","description":" A CLI framework based on asyncio","archived":false,"fork":false,"pushed_at":"2018-07-29T12:22:58.000Z","size":27,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T07:11:13.388Z","etag":null,"topics":["async-await","asyncio","cli","framework","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahopkins.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-27T07:31:57.000Z","updated_at":"2024-01-12T14:46:18.000Z","dependencies_parsed_at":"2022-09-07T23:30:54.397Z","dependency_job_id":null,"html_url":"https://github.com/ahopkins/asynccli","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahopkins%2Fasynccli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahopkins%2Fasynccli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahopkins%2Fasynccli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahopkins%2Fasynccli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahopkins","download_url":"https://codeload.github.com/ahopkins/asynccli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166884,"owners_count":21058479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","asyncio","cli","framework","python"],"created_at":"2024-10-13T14:58:48.314Z","updated_at":"2025-10-05T11:53:47.639Z","avatar_url":"https://github.com/ahopkins.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"asynccli\n========\n\n.. image:: https://img.shields.io/pypi/v/asynccli.svg\n    :target: https://pypi.python.org/pypi/asynccli\n    :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/status/asynccli.svg\n    :target: https://pypi.python.org/pypi/asynccli\n    :alt: Version status\n\n.. image:: https://img.shields.io/pypi/pyversions/asynccli.svg\n    :target: https://pypi.python.org/pypi/asynccli\n    :alt: Python 3.5 and 3.6\n\n.. image:: https://travis-ci.org/ahopkins/asynccli.svg?branch=master\n    :target: https://travis-ci.org/ahopkins/asynccli\n    :alt: Latest Travis CI build status\n\n.. image:: https://api.codacy.com/project/badge/Grade/b6f3abd70b6a4ead91c4b0bb820e1ddd\n    :target: https://www.codacy.com/app/ahopkins/asynccli?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=ahopkins/asynccli\u0026amp;utm_campaign=Badge_Grade\n    :alt: Codacy grade\n\n.. image:: https://api.codacy.com/project/badge/Coverage/b6f3abd70b6a4ead91c4b0bb820e1ddd\n    :target: https://www.codacy.com/app/ahopkins/asynccli?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=ahopkins/asynccli\u0026amp;utm_campaign=Badge_Coverage\n    :alt: Codacy coverage\n\nA CLI framework based on asyncio.\n\n.. note:: This is still in **active** development. Things will change. For now, the basic framework is operational. If you are interested in helping out, or would like to see any particular features added, let me know.\n\nUsage\n-----\n\nThe simplest usage is to just pass in an ``async`` function.\n\n.. code:: python\n\n    import asynccli\n\n\n    async def mycli():\n        print(\"Hello, world.\")\n\n\n    if __name__ == '__main__':\n        app = asynccli.App(mycli)\n        app.run()\n\n\nIt can also be instantiated as a class, as long it has a ``call`` method.\n\n.. code:: python\n\n    import asynccli\n\n\n    class DivisionCalculator(asynccli.CLI):\n        numerator = asynccli.Integer(help_text='This is the numerator.')\n        denominator = asynccli.Integer()\n\n        async def call(self):\n            print(self.first_num / self.second_num)\n\n\n    if __name__ == '__main__':\n        app = asynccli.App(DivisionCalculator)\n        app.run()\n\nIn the ``DivisionCalculator`` example above, you would call your script like this:\n\n.. code::\n\n    $ /path/to/script.py 2 3\n    0.6666666666666666\n\nWhat if you want to have a tiered CLI with a hierarchy of commands? First, create your command by subclassing ``CLI`` as above. Then, wrap the whole thing inside of the ``TieredCLI`` class, and pass that to the ``App``.\n\n.. code:: python\n\n    class Calculator(asynccli.TieredCLI):\n        d = DivisionCalculator\n\n    if __name__ == '__main__':\n        app = asynccli.App(Calculator)\n        app.run()\n\nNow, to invoke the script, you have an extra argument to call:\n\n.. code::\n\n    $ /path/to/script.py d 2 3\n    0.6666666666666666\n\nInstallation\n------------\n\n.. code::\n\n    pip install asynccli\n\nRequirements\n------------\n\nCurrently it requires Python 3.5 to make use of ``async``/``await``. It uses ``argparse`` under the hood, and therefore has **no dependencies** outside of the standard library.\n\nRoadmap\n-------\n\n- Additional ``Argument`` types\n- Integration of additional ``argparse`` features\n- Add ``uvloop``\n- Better support for help documentation\n\nTesting\n-------\n\nYou can invoke the test scripts a few different ways:\n\n.. code::\n\n    $ py.test\n    $ python setup.py test\n    $ python -m py.test\n\nAnd, in order to generate the test coverage:\n\n.. code::\n\n    $ coverage run -m py.test\n\nLicense\n-------\n\n`MIT \u003chttps://github.com/ahopkins/asynccli/blob/master/LICENSE\u003e`_\n\nAuthors\n-------\n\n``asynccli`` was written by `Adam Hopkins \u003cadmhpkns@gmail.com\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahopkins%2Fasynccli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahopkins%2Fasynccli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahopkins%2Fasynccli/lists"}