asyncclick
==========
What's AsyncClick?
------------------
AsyncClick is a fork of Click that works well with trio or asyncio.
Click is a Python package for creating beautiful command line interfaces
in a composable way with as little code as necessary. It's the "Command
Line Interface Creation Kit". It's highly configurable but comes with
sensible defaults out of the box.
It aims to make the process of writing command line tools quick and fun
while also preventing any frustration caused by the inability to
implement an intended CLI API.
AsyncClick in four points:
- Arbitrary nesting of commands
- Automatic help page generation
- Supports lazy loading of subcommands at runtime
- Seamlessly use async-enabled command and subcommand handlers
Installing
----------
Install and update using `pip`_:
.. code-block:: text
$ pip install asyncclick
AsyncClick supports Python 3.7 and newer, and PyPy3.
.. _pip: https://pip.pypa.io/en/stable/getting-started/
A Simple Example
----------------
.. code-block:: python
import anyio
import asyncclick as click
# You can use all of click's features as per its documentation.
# Async commands are supported seamlessly; they just work.
@click.command()
@click.option("--count", default=1, help="Number of greetings.")
@click.option("--name", prompt="Your name", help="The person to greet.")
async def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
if x: await anyio.sleep(0.1)
click.echo(f"Hello, {name}!")
if __name__ == '__main__':
hello(_anyio_backend="trio") # or asyncio
# You can use your own event loop:
# import anyio
# async def main():
# await hello.main()
# if __name__ == '__main__':
# anyio.run(main)
# This is useful for testing.
.. note::
AsyncClick automagically starts an anyio event loop and runs your
code asynchronously. You don't need to use `anyio.run`.
.. code-block:: text
$ python hello.py --count=3
Your name: Click
Hello, Click!
Hello, Click!
Hello, Click!
Donate
------
The Pallets organization develops and supports Click and other popular
packages. In order to grow the community of contributors and users, and
allow the maintainers to devote more time to the projects, `please
donate today`_.
.. _please donate today: https://palletsprojects.com/donate
The AsyncClick fork is maintained by Matthias Urlichs <matthias@urlichs.de>.
It's not a lot of work, so if you'd like to motivate me, donate to the
charity of your choice and tell me that you've done so. ;-)
Links
-----
``AsyncClick`` is sufficiently minimal to not have its own web page.
- Code: https://github.com/python-trio/asyncclick
These links point to the original, non-async-enabled, version of ``Click``.
- Website: https://palletsprojects.com/p/click/
- Documentation: https://click.palletsprojects.com/
- Changes: https://click.palletsprojects.com/changes/
- PyPI Releases: https://pypi.org/project/click/
- Source Code: https://github.com/pallets/click
- Issue Tracker: https://github.com/pallets/click/issues
- Chat: https://discord.gg/pallets
Raw data
{
"_id": null,
"home_page": "https://palletsprojects.com/p/click/",
"name": "asyncclick",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Matthias Urlichs",
"author_email": "<matthias@urlichs.de>",
"download_url": "https://files.pythonhosted.org/packages/5e/bf/59d836c3433d7aa07f76c2b95c4eb763195ea8a5d7f9ad3311ed30c2af61/asyncclick-8.1.7.2.tar.gz",
"platform": null,
"description": "asyncclick\n==========\n\nWhat's AsyncClick?\n------------------\n\nAsyncClick is a fork of Click that works well with trio or asyncio.\n\nClick is a Python package for creating beautiful command line interfaces\nin a composable way with as little code as necessary. It's the \"Command\nLine Interface Creation Kit\". It's highly configurable but comes with\nsensible defaults out of the box.\n\nIt aims to make the process of writing command line tools quick and fun\nwhile also preventing any frustration caused by the inability to\nimplement an intended CLI API.\n\nAsyncClick in four points:\n\n- Arbitrary nesting of commands\n- Automatic help page generation\n- Supports lazy loading of subcommands at runtime\n- Seamlessly use async-enabled command and subcommand handlers\n\nInstalling\n----------\n\nInstall and update using `pip`_:\n\n.. code-block:: text\n\n $ pip install asyncclick\n\nAsyncClick supports Python 3.7 and newer, and PyPy3.\n\n.. _pip: https://pip.pypa.io/en/stable/getting-started/\n\nA Simple Example\n----------------\n\n.. code-block:: python\n\n import anyio\n import asyncclick as click\n # You can use all of click's features as per its documentation.\n # Async commands are supported seamlessly; they just work.\n \n @click.command()\n @click.option(\"--count\", default=1, help=\"Number of greetings.\")\n @click.option(\"--name\", prompt=\"Your name\", help=\"The person to greet.\")\n async def hello(count, name):\n \"\"\"Simple program that greets NAME for a total of COUNT times.\"\"\"\n for x in range(count):\n if x: await anyio.sleep(0.1)\n click.echo(f\"Hello, {name}!\")\n\n if __name__ == '__main__':\n hello(_anyio_backend=\"trio\") # or asyncio\n\n # You can use your own event loop:\n # import anyio\n # async def main():\n # await hello.main()\n # if __name__ == '__main__':\n # anyio.run(main)\n # This is useful for testing.\n\n.. note::\n AsyncClick automagically starts an anyio event loop and runs your\n code asynchronously. You don't need to use `anyio.run`.\n\n.. code-block:: text\n\n $ python hello.py --count=3\n Your name: Click\n Hello, Click!\n Hello, Click!\n Hello, Click!\n\n\nDonate\n------\n\nThe Pallets organization develops and supports Click and other popular\npackages. In order to grow the community of contributors and users, and\nallow the maintainers to devote more time to the projects, `please\ndonate today`_.\n\n.. _please donate today: https://palletsprojects.com/donate\n\nThe AsyncClick fork is maintained by Matthias Urlichs <matthias@urlichs.de>.\nIt's not a lot of work, so if you'd like to motivate me, donate to the\ncharity of your choice and tell me that you've done so. ;-)\n\nLinks\n-----\n\n``AsyncClick`` is sufficiently minimal to not have its own web page.\n\n- Code: https://github.com/python-trio/asyncclick\n\nThese links point to the original, non-async-enabled, version of ``Click``.\n\n- Website: https://palletsprojects.com/p/click/\n- Documentation: https://click.palletsprojects.com/\n- Changes: https://click.palletsprojects.com/changes/\n- PyPI Releases: https://pypi.org/project/click/\n- Source Code: https://github.com/pallets/click\n- Issue Tracker: https://github.com/pallets/click/issues\n- Chat: https://discord.gg/pallets\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Composable command line interface toolkit, async version",
"version": "8.1.7.2",
"project_urls": {
"Homepage": "https://palletsprojects.com/p/click/",
"Issue Tracker": "https://github.com/python-trio/asyncclick/issues/",
"Source Code": "https://github.com/python-trio/asyncclick"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e6e9acdbb25733e1de411663b59abe521bec738e72fe4e85843f6ff8b212832",
"md5": "49632e6ec71c943f612faaf7722be1ed",
"sha256": "1ab940b04b22cb89b5b400725132b069d01b0c3472a9702c7a2c9d5d007ded02"
},
"downloads": -1,
"filename": "asyncclick-8.1.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "49632e6ec71c943f612faaf7722be1ed",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 99191,
"upload_time": "2024-03-10T09:27:26",
"upload_time_iso_8601": "2024-03-10T09:27:26.948221Z",
"url": "https://files.pythonhosted.org/packages/1e/6e/9acdbb25733e1de411663b59abe521bec738e72fe4e85843f6ff8b212832/asyncclick-8.1.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ebf59d836c3433d7aa07f76c2b95c4eb763195ea8a5d7f9ad3311ed30c2af61",
"md5": "542e83089a55129ca2fe7ccdbc65ba77",
"sha256": "219ea0f29ccdc1bb4ff43bcab7ce0769ac6d48a04f997b43ec6bee99a222daa0"
},
"downloads": -1,
"filename": "asyncclick-8.1.7.2.tar.gz",
"has_sig": false,
"md5_digest": "542e83089a55129ca2fe7ccdbc65ba77",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 349073,
"upload_time": "2024-03-10T09:27:28",
"upload_time_iso_8601": "2024-03-10T09:27:28.737016Z",
"url": "https://files.pythonhosted.org/packages/5e/bf/59d836c3433d7aa07f76c2b95c4eb763195ea8a5d7f9ad3311ed30c2af61/asyncclick-8.1.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-10 09:27:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "python-trio",
"github_project": "asyncclick",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "asyncclick"
}