Skip to main content

kewkew

PyPI version License

A tiny queue library leveraging asyncio for background tasks or scripting

Install

You can install kewkew via pip.

python -m pip install kewkew

You can also download the kewkew/kew.py source from this repo. There are no external dependencies to worry about.

Usage

The Kew class is meant to be a parent class. At a minimum, the child class needs to implement an async worker method which must do two things:

  • Take a single argument that accepts data from the queue
  • Returns a boolean if the data was processed successfully and can be removed from the queue

Here is a minimum viable implementation.

from kewkew import Kew

class MyKew(Kew):
    async def worker(self, data) -> bool:
        print(data)
        return True

We then have two main ways of using the queue. Kew provides both sync and async methods to add items to the queue and tell the queue to finish processing (for a graceful shutdown).

This first example uses the sync calls so everything can be run in an interactive environment.

from mykew import MyKew

kew = MyKew()
for i in range(100):
    kew.add_sync(i)
kew.finish_sync()

This second example uses the async calls within a coroutine.

import asyncio as aio

async def main():
    kew = MyKew()
    for i in range(100):
        await kew.add(i)
    await kew.finish()

aio.run(main)

You can see this and an async database processing example in the examples folder.

Debug

Python Queues have a tendency to swallow runtime exceptions. You can debug your worker more easily by calling it directly.

import asyncio as aio
from mykew import MyKew

kew = MyKew()
aio.run(kew.worker(1))

Metadata

Release files for kewkew 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kewkew 0.1.2
File Size Uploaded
kewkew-0.1.2.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kewkew 0.1.2
File Interpreter ABI Platform
kewkew-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / kewkew-0.1.2.tar.gz

Download URL kewkew-0.1.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bd7cc55cc85134a887785a1ddd86f57234d747d7f7a45e4e0a93304f313b6f04
BLAKE2b-256 checksum
How to use checksums
16279381efd018a7184bf02ef4bbdbc36c12104aeda9674a3ec325ed6fb7cb93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2025.

Transparency log

Release files / kewkew-0.1.2-py3-none-any.whl

Download URL kewkew-0.1.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de3770b6b96b9c17d68195007f180e771939d2ee8a20d584d67f53dd1140fb50
BLAKE2b-256 checksum
How to use checksums
a7481286d09b53f217cfce67848b5c417011f90f41ecae2852b37cb261046983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page