Skip to main content

tsdeque — Thread-Safe Deque with Task Tracking ⚙️


English

tsdeque is a thread-safe, double-ended queue implementation with built-in task tracking and threshold-based event notifications. Designed for multi-threaded environments, it ensures safe concurrent access and precise control over queue size and task completion status.

Features

  • Thread-safe double-ended queue (deque) operations
  • Support for max size limitation with blocking put operations
  • Task counting with task_done() and join() methods, similar to queue.Queue
  • Threshold events triggered on hitting min/max counts
  • Customizable blocking timeouts on put/get operations
  • Designed with performance and correctness in mind

Installation

pip install tsdeque

Usage example

from tsdeque import ThreadSafeDeque

deque = ThreadSafeDeque(maxsize=5)
deque.put("item")
item = deque.get()
deque.task_done()
deque.join()

Testing 🧪

Run tests with:

python -m pytest

Русский

tsdeque — потокобезопасная двухсторонняя очередь с учетом количества задач и триггерами событий на пороговых значениях. Подходит для многопоточного программирования, гарантирует корректный доступ и управление размером очереди и состоянием задач.

Возможности

  • Потокобезопасные операции с двухсторонней очередью (deque)
  • Поддержка ограничения по максимальному размеру с блокирующими операциями put
  • Подсчет задач с методами task_done() и join(), аналогично queue.Queue
  • События срабатывают при достижении минимальных и максимальных порогов
  • Настраиваемые таймауты блокирующих операций
  • Оптимизирован для производительности и надежности

Установка

pip install tsdeque

Пример использования

from tsdeque import ThreadSafeDeque

deque = ThreadSafeDeque(maxsize=5)
deque.put("item")
item = deque.get()
deque.task_done()
deque.join()

Тестирование 🧪

Запуск тестов:

python -m pytest

Metadata

Release files for tsdeque 1.0.1

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

Source distribution (sdist)

Source distribution for tsdeque 1.0.1
File Size Uploaded
tsdeque-1.0.1.tar.gz 11.6 kB Details

Built distribution (wheel)

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

Total release size: 21.7 kB

Release files / tsdeque-1.0.1.tar.gz

Download URL tsdeque-1.0.1.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e932d5f015e66679a783dc250c8cff862d6f8238cfa2def430e9586c5a64bc78
BLAKE2b-256 checksum
How to use checksums
0604661d026fb46490e2e5511493ebc10591f5b7bae658f5379996f41e381f31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / tsdeque-1.0.1-py3-none-any.whl

Download URL tsdeque-1.0.1-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4cdd8b87248bbea9d6db809d2b70a1500dc114a8123b4ce596903c11084b3b1
BLAKE2b-256 checksum
How to use checksums
903dbe09a284447758b338f874f213e1700731a2d09cb2f3f1e648d5ba8fcb17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

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