# Queue
Extension for `asynckivy` programs.
```python
from kivy.app import App
import asynckivy as ak
from asynckivy_ext.queue import Queue
async def producer(q):
for c in "ABC":
await q.put(c)
print('produced', c)
q.half_close()
async def consumer(q):
async for c in q:
print('consumed', c)
q = Queue(capacity=1)
ak.start(producer(q))
ak.start(consumer(q))
App().run()
```
```text
produced A
consumed A
produced B
consumed B
produced C
consumed C
```
The ``consumer()`` above can be written in more primitive way:
```python
from asynckivy_ext.queue import Closed
async def consumer(q):
try:
while True:
c = await q.get()
print('consumed', c)
except Closed:
pass
```
## Installation
It's recommended to pin the minor version, because if it changed, it means some *important* breaking changes occurred.
```text
poetry add asynckivy-ext-queue@~0.2
pip install "asynckivy-ext-queue>=0.2,<0.3"
```
## Tested on
- CPython 3.9 + Kivy 2.2.1
- CPython 3.10 + Kivy 2.2.1
- CPython 3.11 + Kivy 2.2.1
Raw data
{
"_id": null,
"home_page": "https://github.com/asyncgui/asynckivy-ext-queue",
"name": "asynckivy-ext-queue",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Natt\u014dsai Mit\u014d",
"author_email": "flow4re2c@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ae/a5/c8d248ebec67b174bcacfe40fa32cdc796b28932876f7c0d3468b4fa0d92/asynckivy_ext_queue-0.2.0.tar.gz",
"platform": null,
"description": "# Queue\n\nExtension for `asynckivy` programs.\n\n```python\nfrom kivy.app import App\nimport asynckivy as ak\nfrom asynckivy_ext.queue import Queue\n\n\nasync def producer(q):\n for c in \"ABC\":\n await q.put(c)\n print('produced', c)\n q.half_close()\n\n\nasync def consumer(q):\n async for c in q:\n print('consumed', c)\n\n\nq = Queue(capacity=1)\nak.start(producer(q))\nak.start(consumer(q))\nApp().run()\n```\n\n```text\nproduced A\nconsumed A\nproduced B\nconsumed B\nproduced C\nconsumed C\n```\n\nThe ``consumer()`` above can be written in more primitive way:\n\n```python\nfrom asynckivy_ext.queue import Closed\n\n\nasync def consumer(q):\n try:\n while True:\n c = await q.get()\n print('consumed', c)\n except Closed:\n pass\n```\n\n## Installation\n\nIt's recommended to pin the minor version, because if it changed, it means some *important* breaking changes occurred.\n\n```text\npoetry add asynckivy-ext-queue@~0.2\npip install \"asynckivy-ext-queue>=0.2,<0.3\"\n```\n\n## Tested on\n\n- CPython 3.9 + Kivy 2.2.1\n- CPython 3.10 + Kivy 2.2.1\n- CPython 3.11 + Kivy 2.2.1\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Extension for asynckivy programs",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/asyncgui/asynckivy-ext-queue",
"Repository": "https://github.com/asyncgui/asynckivy-ext-queue"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "574346ea868185f430ad12ef9470e6202859d3df7005a03a66847e007bedcbbc",
"md5": "8a45320ec2373315c67f327d9df9fc8c",
"sha256": "cf890d58fb23bb06d4a0bc365abd869f0f8a66968fb69469804ce408ebfc7fe0"
},
"downloads": -1,
"filename": "asynckivy_ext_queue-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a45320ec2373315c67f327d9df9fc8c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 4739,
"upload_time": "2023-12-05T11:30:49",
"upload_time_iso_8601": "2023-12-05T11:30:49.289526Z",
"url": "https://files.pythonhosted.org/packages/57/43/46ea868185f430ad12ef9470e6202859d3df7005a03a66847e007bedcbbc/asynckivy_ext_queue-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aea5c8d248ebec67b174bcacfe40fa32cdc796b28932876f7c0d3468b4fa0d92",
"md5": "f94c6bb4c50312537cdea1e48af44436",
"sha256": "40683f74b5e1187d808381a89afb059ca2e3b5a00def104dae0b6fad73be35cd"
},
"downloads": -1,
"filename": "asynckivy_ext_queue-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "f94c6bb4c50312537cdea1e48af44436",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 4385,
"upload_time": "2023-12-05T11:30:50",
"upload_time_iso_8601": "2023-12-05T11:30:50.395417Z",
"url": "https://files.pythonhosted.org/packages/ae/a5/c8d248ebec67b174bcacfe40fa32cdc796b28932876f7c0d3468b4fa0d92/asynckivy_ext_queue-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-05 11:30:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asyncgui",
"github_project": "asynckivy-ext-queue",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "asynckivy-ext-queue"
}