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

consumer() can be written in more primitive way:

from asynckivy_ext.queue import Closed, NothingLeft


async def consumer(q):
    try:
        while True:
            c = await q.get()
            print('consumed', c)
    except (Closed, NothingLeft):
        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.1
pip install "asynckivy-ext-queue>=0.1,<0.2"

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.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

asynckivy_ext_queue-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file asynckivy_ext_queue-0.1.0.tar.gz.

File metadata

  • Download URL: asynckivy_ext_queue-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.4.0-165-generic

File hashes

Hashes for asynckivy_ext_queue-0.1.0.tar.gz
Algorithm Hash digest
SHA256 244cfa79a9dc37272a4eaa0bd0f2ef37f8f7fb6cd5aa9111c45aa4cda1c29aaf
MD5 360a2b7d4439193d338d3754640e9411
BLAKE2b-256 ff431dfb5f5a05d66c5546e49f5507209bcc8586450db0274b9498761fa2d5c6

See more details on using hashes here.

File details

Details for the file asynckivy_ext_queue-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asynckivy_ext_queue-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.4.0-165-generic

File hashes

Hashes for asynckivy_ext_queue-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a95da9a248fdabe7529f6a09f9dd962e6eb6d1a995c2dd38e1c120bd1476fabb
MD5 e3077961623d52dfb1fd3ee472fe5a09
BLAKE2b-256 cee3c853da57d3942dc7ca1e6661833edbedeaa1807e1c12d0a42a15eb63d720

See more details on using hashes here.

Supported by

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