Skip to main content

Extension for asynckivy programs

Project description

Queue

Extension for asynckivy programs.

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()
produced A
consumed A
produced B
consumed B
produced C
consumed C

The consumer() above can be written in more primitive way:

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asynckivy_ext_queue-0.2.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

asynckivy_ext_queue-0.2.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page