queutils 0.8.3__tar.gz → 0.8.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {queutils-0.8.3 → queutils-0.8.5}/.github/workflows/python-package.yml +1 -1
  2. {queutils-0.8.3 → queutils-0.8.5}/PKG-INFO +1 -2
  3. {queutils-0.8.3 → queutils-0.8.5}/pyproject.toml +2 -2
  4. {queutils-0.8.3 → queutils-0.8.5}/src/queutils/asyncqueue.py +3 -5
  5. {queutils-0.8.3 → queutils-0.8.5}/src/queutils/iterablequeue.py +14 -13
  6. queutils-0.8.5/src/queutils/py.typed +0 -0
  7. {queutils-0.8.3 → queutils-0.8.5}/.github/workflows/dependency-review.yml +0 -0
  8. {queutils-0.8.3 → queutils-0.8.5}/.github/workflows/python-publish.yml +0 -0
  9. {queutils-0.8.3 → queutils-0.8.5}/.gitignore +0 -0
  10. {queutils-0.8.3 → queutils-0.8.5}/LICENSE +0 -0
  11. {queutils-0.8.3 → queutils-0.8.5}/README.md +0 -0
  12. {queutils-0.8.3 → queutils-0.8.5}/codecov.yml +0 -0
  13. {queutils-0.8.3 → queutils-0.8.5}/demos/asyncqueue_demo.py +0 -0
  14. {queutils-0.8.3 → queutils-0.8.5}/demos/filequeue_demo.py +0 -0
  15. {queutils-0.8.3 → queutils-0.8.5}/demos/iterablequeue_demo.py +0 -0
  16. {queutils-0.8.3 → queutils-0.8.5}/docs/asyncqueue.md +0 -0
  17. {queutils-0.8.3 → queutils-0.8.5}/docs/filequeue.md +0 -0
  18. {queutils-0.8.3 → queutils-0.8.5}/docs/iterablequeue.md +0 -0
  19. {queutils-0.8.3 → queutils-0.8.5}/src/queutils/__init__.py +0 -0
  20. {queutils-0.8.3 → queutils-0.8.5}/src/queutils/countable.py +0 -0
  21. {queutils-0.8.3 → queutils-0.8.5}/src/queutils/filequeue.py +0 -0
  22. {queutils-0.8.3 → queutils-0.8.5}/tests/test_asyncqueue.py +0 -0
  23. {queutils-0.8.3 → queutils-0.8.5}/tests/test_demos.py +0 -0
  24. {queutils-0.8.3 → queutils-0.8.5}/tests/test_filequeue.py +0 -0
  25. {queutils-0.8.3 → queutils-0.8.5}/tests/test_iterablequeue.py +0 -0
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- python-version: ["3.11", "3.12"]
17
+ python-version: ["3.11", "3.12", "3.13"]
18
18
  os: [ ubuntu-latest, windows-latest, macos-latest ]
19
19
  runs-on: ${{ matrix.os }}
20
20
 
@@ -1,11 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: queutils
3
- Version: 0.8.3
3
+ Version: 0.8.5
4
4
  Summary: Handy Python Queue utilies
5
5
  Project-URL: Homepage, https://github.com/Jylpah/queutils
6
6
  Project-URL: Bug Tracker, https://github.com/Jylpah/queutils/issues
7
7
  Author-email: Jylpah <jylpah@gmail.com>
8
- License-File: LICENSE
9
8
  Classifier: Development Status :: 4 - Beta
10
9
  Classifier: Framework :: AsyncIO
11
10
  Classifier: License :: OSI Approved :: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "queutils"
3
- version = "0.8.3"
3
+ version = "0.8.5"
4
4
  authors = [{ name = "Jylpah", email = "jylpah@gmail.com" }]
5
5
  description = "Handy Python Queue utilies"
6
6
  readme = "README.md"
@@ -49,7 +49,7 @@ exclude = ['tmp']
49
49
  mypy_path = ['src', 'demos']
50
50
 
51
51
  [tool.ruff]
52
- include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py"]
52
+ include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py", "demos/**/*.py"]
53
53
  indent-width = 4
54
54
  extend-include = ["*.ipynb"]
55
55
  extend-exclude = [".venv", ".vscode"]
@@ -1,7 +1,7 @@
1
1
  # -----------------------------------------------------------
2
2
  # Class AsyncQueue(asyncio.Queue, Generic[T])
3
3
  #
4
- # asyncio wrapper for non-async queue.Queue. Can be used to create
4
+ # asyncio wrapper for non-async queue.Queue. Can be used to create
5
5
  # an asyncio.Queue out of a (non-async) multiprocessing.Queue.
6
6
  #
7
7
  # -----------------------------------------------------------
@@ -10,7 +10,6 @@ __author__ = "Jylpah"
10
10
  __copyright__ = "Copyright 2024, Jylpah <Jylpah@gmail.com>"
11
11
  __credits__ = ["Jylpah"]
12
12
  __license__ = "MIT"
13
- # __version__ = "1.0"
14
13
  __maintainer__ = "Jylpah"
15
14
  __email__ = "Jylpah@gmail.com"
16
15
  __status__ = "Production"
@@ -35,18 +34,17 @@ error = logger.error
35
34
 
36
35
  class AsyncQueue(asyncio.Queue, Generic[T]):
37
36
  """
38
- Async wrapper for non-async queue.Queue. Can be used to create
37
+ Async wrapper for non-async queue.Queue. Can be used to create
39
38
  an asyncio.Queue out of a (non-async) multiprocessing.Queue.
40
39
  """
41
40
 
42
- def __init__(self, queue: Queue[T], asleep: float = 0.01):
41
+ def __init__(self, queue: Queue[T], asleep: float = 0.001):
43
42
  self._Q: Queue[T] = queue
44
43
  # self._maxsize: int = queue.maxsize
45
44
  self._done: int = 0
46
45
  self._items: int = 0
47
46
  self._sleep: float = asleep
48
47
 
49
-
50
48
  @property
51
49
  def maxsize(self) -> int:
52
50
  """not supported by queue.Queue"""
@@ -1,7 +1,7 @@
1
1
  # -----------------------------------------------------------
2
2
  # Class IterableQueue(asyncio.Queue[T], AsyncIterable[T], Countable)
3
3
  #
4
- # IterableQueue is asyncio.Queue subclass that can be iterated asynchronusly.
4
+ # IterableQueue is asyncio.Queue subclass that can be iterated asynchronusly.
5
5
  # IterableQueue terminates automatically when the queue has been
6
6
  # filled and emptied.
7
7
  #
@@ -23,7 +23,7 @@ from .countable import Countable
23
23
  import logging
24
24
 
25
25
  # Setup logging
26
- logger = logging.getLogger()
26
+ logger = logging.getLogger(__name__)
27
27
  error = logger.error
28
28
  message = logger.warning
29
29
  verbose = logger.info
@@ -31,24 +31,26 @@ debug = logger.debug
31
31
 
32
32
  T = TypeVar("T")
33
33
 
34
+
34
35
  class QueueDone(Exception):
35
36
  """
36
37
  Exception to mark an IterableQueue as filled and emptied i.e. done
37
38
  """
39
+
38
40
  pass
39
41
 
40
42
 
41
43
  class IterableQueue(Queue[T], AsyncIterable[T], Countable):
42
44
  """
43
- IterableQueue is asyncio.Queue subclass that can be iterated asynchronusly.
44
-
45
+ IterableQueue is asyncio.Queue subclass that can be iterated asynchronusly.
46
+
45
47
  IterableQueue terminates automatically when the queue has been
46
48
  filled and emptied. Supports:
47
49
  - asyncio.Queue() interface, _nowait() methods are experimental
48
50
  - AsyncIterable(): async for item in queue:
49
51
  - Automatic termination of the consumers when the queue has been emptied with QueueDone exception
50
52
  - Producers must be registered with add_producer() and they must notify the queue
51
- with finish() once they have finished adding items
53
+ with finish() once they have finished adding items
52
54
  - Countable interface to count number of items task_done() through 'count' property
53
55
  - Countable property can be disabled with count_items=False. This is useful when you
54
56
  want to sum the count of multiple IterableQueues
@@ -74,16 +76,16 @@ class IterableQueue(Queue[T], AsyncIterable[T], Countable):
74
76
 
75
77
  @property
76
78
  def is_filled(self) -> bool:
77
- """"
78
- True if all the producers finished filling the queue.
79
+ """ "
80
+ True if all the producers finished filling the queue.
79
81
  New items cannot be added to a filled queue nor can new producers can be added.
80
82
  """
81
83
  return self._filled.is_set()
82
-
84
+
83
85
  @property
84
86
  def is_done(self) -> bool:
85
87
  """
86
- Has the queue been filled, emptied and all the items have been marked with task_done()
88
+ Has the queue been filled, emptied and all the items have been marked with task_done()
87
89
  """
88
90
  return self.is_filled and self.empty() and not self.has_wip
89
91
 
@@ -91,7 +93,6 @@ class IterableQueue(Queue[T], AsyncIterable[T], Countable):
91
93
  def maxsize(self) -> int:
92
94
  return self._Q.maxsize
93
95
 
94
-
95
96
  def full(self) -> bool:
96
97
  """
97
98
  True if the queue is full
@@ -122,8 +123,8 @@ class IterableQueue(Queue[T], AsyncIterable[T], Countable):
122
123
  @property
123
124
  def wip(self) -> int:
124
125
  """
125
- Number of items in progress i.e. items that have been
126
- read from the queue, but not marked with task_done()
126
+ Number of items in progress i.e. items that have been
127
+ read from the queue, but not marked with task_done()
127
128
  """
128
129
  return self._wip
129
130
 
@@ -236,7 +237,7 @@ class IterableQueue(Queue[T], AsyncIterable[T], Countable):
236
237
  def get_nowait(self) -> T:
237
238
  """
238
239
  Experimental asyncio.Queue.get_nowait() implementation
239
- """
240
+ """
240
241
  item: T | None = self._Q.get_nowait()
241
242
  if item is None:
242
243
  self._empty.set()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes