Handy Python Queue utilies
Project description
Queutils
Queutils [Queue Utils] is a package of handy Python queue classes:
- AsyncQueue - An
asyncwrapper for non-asyncqueue.Queue - IterableQueue - An
AsyncIterablequeue that terminates when finished - EventCounterQueue - An
IterableQueuefor counting events inasyncthreads - FileQueue - Builds an
IterableQueue[pathlib.Path]of filenames from files/dirs given as input
AsyncQueue
AsyncQueue is a async wrapper for non-async queue.Queue. It can be used to create
an asyncio.Queue compatible interface to a (non-async) managed multiprocessing.Queue and thus enable async code in parent/child processes to communicate over multiprocessing.Queue as it were an asyncio.Queue. Uses sleep() for get()/put() if the queue is empty/full.
Features
asyncio.Queuecompatiblequeue.Queuesupportmultiprocessing.Queuesupport
IterableQueue
IterableQueue is an asyncio.Queue subclass that is AsyncIterable[T] i.e. it can be
iterated in async for loop. IterableQueue terminates automatically when the queue has been filled and emptied.
The IterableQueue requires "producers" (functions adding items to the queue) to register themselves with add_producer() call. It keeps count of registered producers. When a producer "finishes" adding items to the queue,
it needs to unregister itself with finish_producer() call. Once all the registered
producers are "finished", the queue enters into "filled" state and no new items can be added. Once a "filled" queue has been emptied, the queue becomes "done" and
all new get() calls to the queue will raise QueueDone exception.
Features
asyncio.Queueinterface,_nowait()methods are experimentalAsyncIterablesupport:async for item in queue:- Automatic termination of the consumers with
QueueDoneexception when the queue has been emptied - Producers must be registered with
add_producer()and they must notify the queue withfinish_producer()once they have finished adding items - Countable interface to count number of items task_done() through
countproperty
EventCounterQueue
EventCounterQueue can be used to count named events (default event is count) between async threads. async worker threads call queue.send(event="event_name", N=amount). The receving end can either receive() a single event or listen() all events and return collections.defaultdict[str, int] as a result.
Features
- Supports multiple producers and a single listener
- Default event is
count
FileQueue
FileQueue builds a queue (IterableQueue[pathlib.Path]) of the matching
files found based on search parameters given. It can search both list of files or directories or
mixed. Async method FileQueue.mk_queue() searches subdirectories of given directories.
Features
- Input can be given both as
strandpathlib.Path exclude: boolexclusive or inclusive filtering. Default isFalse.case_sensitive: boolcase sensitive filtering (use offnmatchorfnmatchcase). Default isTrue.follow_symlinks: boolwhether to follow symlinks. Default isFalse.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file queutils-0.11.0.tar.gz.
File metadata
- Download URL: queutils-0.11.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20cae7635be867cff83ec4617b6a36d82f1e717d89635e9168f7e04aa70d412a
|
|
| MD5 |
a8f2ba0b97756e1d7ec3d82f066795d7
|
|
| BLAKE2b-256 |
bb589867d2024a73a9139b413e2629032197874657016c640bf207ccf2d3a0a1
|
Provenance
The following attestation bundles were made for queutils-0.11.0.tar.gz:
Publisher:
python-publish.yml on Jylpah/queutils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
queutils-0.11.0.tar.gz -
Subject digest:
20cae7635be867cff83ec4617b6a36d82f1e717d89635e9168f7e04aa70d412a - Sigstore transparency entry: 583295138
- Sigstore integration time:
-
Permalink:
Jylpah/queutils@aff469982641fbbd12106ab553cd16ff1bb0fc06 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/Jylpah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aff469982641fbbd12106ab553cd16ff1bb0fc06 -
Trigger Event:
release
-
Statement type:
File details
Details for the file queutils-0.11.0-py3-none-any.whl.
File metadata
- Download URL: queutils-0.11.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa96fe7524b2f359a4eb72b95cd9335d79abb483d0fec4ecc84ce571f42de188
|
|
| MD5 |
c8415523a7b246f339f9c2907b684922
|
|
| BLAKE2b-256 |
edd4279cf99506cad628f8523d5f3a56764cdd94432cb14ad77de9c763efaea9
|
Provenance
The following attestation bundles were made for queutils-0.11.0-py3-none-any.whl:
Publisher:
python-publish.yml on Jylpah/queutils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
queutils-0.11.0-py3-none-any.whl -
Subject digest:
fa96fe7524b2f359a4eb72b95cd9335d79abb483d0fec4ecc84ce571f42de188 - Sigstore transparency entry: 583295143
- Sigstore integration time:
-
Permalink:
Jylpah/queutils@aff469982641fbbd12106ab553cd16ff1bb0fc06 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/Jylpah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@aff469982641fbbd12106ab553cd16ff1bb0fc06 -
Trigger Event:
release
-
Statement type: