haiway 0.24.1__py3-none-any.whl → 0.24.3__py3-none-any.whl
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.
- haiway/__init__.py +2 -0
- haiway/helpers/__init__.py +6 -1
- haiway/helpers/concurrent.py +12 -12
- {haiway-0.24.1.dist-info → haiway-0.24.3.dist-info}/METADATA +1 -1
- {haiway-0.24.1.dist-info → haiway-0.24.3.dist-info}/RECORD +7 -7
- {haiway-0.24.1.dist-info → haiway-0.24.3.dist-info}/WHEEL +0 -0
- {haiway-0.24.1.dist-info → haiway-0.24.3.dist-info}/licenses/LICENSE +0 -0
haiway/__init__.py
CHANGED
@@ -21,6 +21,7 @@ from haiway.helpers import (
|
|
21
21
|
execute_concurrently,
|
22
22
|
process_concurrently,
|
23
23
|
retry,
|
24
|
+
stream_concurrently,
|
24
25
|
throttle,
|
25
26
|
timeout,
|
26
27
|
traced,
|
@@ -105,6 +106,7 @@ __all__ = (
|
|
105
106
|
"process_concurrently",
|
106
107
|
"retry",
|
107
108
|
"setup_logging",
|
109
|
+
"stream_concurrently",
|
108
110
|
"throttle",
|
109
111
|
"timeout",
|
110
112
|
"traced",
|
haiway/helpers/__init__.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
from haiway.helpers.asynchrony import asynchronous
|
2
2
|
from haiway.helpers.caching import CacheMakeKey, CacheRead, CacheWrite, cache
|
3
|
-
from haiway.helpers.concurrent import
|
3
|
+
from haiway.helpers.concurrent import (
|
4
|
+
execute_concurrently,
|
5
|
+
process_concurrently,
|
6
|
+
stream_concurrently,
|
7
|
+
)
|
4
8
|
from haiway.helpers.files import File, FileAccess
|
5
9
|
from haiway.helpers.observability import LoggerObservability
|
6
10
|
from haiway.helpers.retries import retry
|
@@ -20,6 +24,7 @@ __all__ = (
|
|
20
24
|
"execute_concurrently",
|
21
25
|
"process_concurrently",
|
22
26
|
"retry",
|
27
|
+
"stream_concurrently",
|
23
28
|
"throttle",
|
24
29
|
"timeout",
|
25
30
|
"traced",
|
haiway/helpers/concurrent.py
CHANGED
@@ -130,9 +130,9 @@ async def process_concurrently[Element]( # noqa: C901, PLR0912
|
|
130
130
|
|
131
131
|
@overload
|
132
132
|
async def execute_concurrently[Element, Result](
|
133
|
-
source: Collection[Element],
|
134
|
-
/,
|
135
133
|
handler: Callable[[Element], Coroutine[Any, Any, Result]],
|
134
|
+
/,
|
135
|
+
elements: Collection[Element],
|
136
136
|
*,
|
137
137
|
concurrent_tasks: int = 2,
|
138
138
|
) -> Sequence[Result]: ...
|
@@ -140,9 +140,9 @@ async def execute_concurrently[Element, Result](
|
|
140
140
|
|
141
141
|
@overload
|
142
142
|
async def execute_concurrently[Element, Result](
|
143
|
-
source: Collection[Element],
|
144
|
-
/,
|
145
143
|
handler: Callable[[Element], Coroutine[Any, Any, Result]],
|
144
|
+
/,
|
145
|
+
elements: Collection[Element],
|
146
146
|
*,
|
147
147
|
concurrent_tasks: int = 2,
|
148
148
|
return_exceptions: Literal[True],
|
@@ -150,9 +150,9 @@ async def execute_concurrently[Element, Result](
|
|
150
150
|
|
151
151
|
|
152
152
|
async def execute_concurrently[Element, Result]( # noqa: C901
|
153
|
-
source: Collection[Element],
|
154
|
-
/,
|
155
153
|
handler: Callable[[Element], Coroutine[Any, Any, Result]],
|
154
|
+
/,
|
155
|
+
elements: Collection[Element],
|
156
156
|
*,
|
157
157
|
concurrent_tasks: int = 2,
|
158
158
|
return_exceptions: bool = False,
|
@@ -173,11 +173,11 @@ async def execute_concurrently[Element, Result]( # noqa: C901
|
|
173
173
|
|
174
174
|
Parameters
|
175
175
|
----------
|
176
|
-
source : Collection[Element]
|
177
|
-
A collection of elements to process. The collection size determines
|
178
|
-
the result sequence length.
|
179
176
|
handler : Callable[[Element], Coroutine[Any, Any, Result]]
|
180
177
|
A coroutine function that processes each element and returns a result.
|
178
|
+
elements : Collection[Element]
|
179
|
+
A collection of elements to process. The collection size determines
|
180
|
+
the result sequence length.
|
181
181
|
concurrent_tasks : int, default=2
|
182
182
|
Maximum number of concurrent tasks. Must be greater than 0. Higher
|
183
183
|
values allow more parallelism but consume more resources.
|
@@ -206,16 +206,16 @@ async def execute_concurrently[Element, Result]( # noqa: C901
|
|
206
206
|
...
|
207
207
|
>>> urls = ["http://api.example.com/1", "http://api.example.com/2"]
|
208
208
|
>>> results = await execute_concurrently(
|
209
|
-
... urls,
|
210
209
|
... fetch_data,
|
210
|
+
... urls,
|
211
211
|
... concurrent_tasks=10
|
212
212
|
... )
|
213
213
|
>>> # results[0] corresponds to urls[0], results[1] to urls[1], etc.
|
214
214
|
|
215
215
|
>>> # With exception handling
|
216
216
|
>>> results = await execute_concurrently(
|
217
|
-
... urls,
|
218
217
|
... fetch_data,
|
218
|
+
... urls,
|
219
219
|
... concurrent_tasks=10,
|
220
220
|
... return_exceptions=True
|
221
221
|
... )
|
@@ -230,7 +230,7 @@ async def execute_concurrently[Element, Result]( # noqa: C901
|
|
230
230
|
running: set[Task[Result]] = set()
|
231
231
|
results: MutableSequence[Task[Result]] = []
|
232
232
|
try:
|
233
|
-
for element in
|
233
|
+
for element in elements:
|
234
234
|
task: Task[Result] = ctx.spawn(handler, element)
|
235
235
|
results.append(task)
|
236
236
|
running.add(task)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: haiway
|
3
|
-
Version: 0.24.
|
3
|
+
Version: 0.24.3
|
4
4
|
Summary: Framework for dependency injection and state management within structured concurrency model.
|
5
5
|
Project-URL: Homepage, https://miquido.com
|
6
6
|
Project-URL: Repository, https://github.com/miquido/haiway.git
|
@@ -1,4 +1,4 @@
|
|
1
|
-
haiway/__init__.py,sha256=
|
1
|
+
haiway/__init__.py,sha256=5-zrkIqG6vMupL_Oh_KPqGXaEqAVj1FSed4BK_x0Nv0,2053
|
2
2
|
haiway/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
haiway/context/__init__.py,sha256=1N_SvdPkTfIZDZybm3y0rY2dGrDLWTm0ryzUz2XD4f8,1174
|
4
4
|
haiway/context/access.py,sha256=lsK6RnSjaGRgdOprtLCz4vyw5KqMtbGs0uFXnJWc_j4,24446
|
@@ -8,10 +8,10 @@ haiway/context/observability.py,sha256=JGiBScElJMgYDxi1PoIx7K98PpCXTVV3WY-x8abLx
|
|
8
8
|
haiway/context/state.py,sha256=lzkVVdTMYn-Bfon2aCPMx6vRScrbOqY2f_DuS5aMx0s,11982
|
9
9
|
haiway/context/tasks.py,sha256=pScFgeiyrXSJRDFZiYbBLi3k_DHkSlhB8rgAnYtgyrU,4925
|
10
10
|
haiway/context/types.py,sha256=LoW8238TTdbUgmxyHDi0LVc8M8ZwTHLWKkAPttTsTeg,746
|
11
|
-
haiway/helpers/__init__.py,sha256=
|
11
|
+
haiway/helpers/__init__.py,sha256=J1WQdI2jD_zDP4azn9Me6hVvaBtz8kh9kTN-jDgDA5U,836
|
12
12
|
haiway/helpers/asynchrony.py,sha256=Ddj8UdXhVczAbAC-rLpyhWa4RJ_W2Eolo45Veorq7_4,5362
|
13
13
|
haiway/helpers/caching.py,sha256=BqgcUGQSAmXsuLi5V8EwlZzuGyutHOn1V4k7BHsGKeg,14347
|
14
|
-
haiway/helpers/concurrent.py,sha256=
|
14
|
+
haiway/helpers/concurrent.py,sha256=fU6je62XvbySylZKDgzC_AGKPC7Kimmd5SmkVpySBUo,13115
|
15
15
|
haiway/helpers/files.py,sha256=L6vXd8gdgWx5jPL8azloU8IGoFq2xnxjMc4ufz-gdl4,11650
|
16
16
|
haiway/helpers/observability.py,sha256=jCJzOPJ5E3RKJsbbGRR1O-mZydaHNIGkIpppOH7nFBA,11012
|
17
17
|
haiway/helpers/retries.py,sha256=OH__I9e-PUFxcSwuQLIzJ9F1MwXgbz1Ur4jEjJiOmjQ,8974
|
@@ -39,7 +39,7 @@ haiway/utils/mimic.py,sha256=xaZiUKp096QFfdSw7cNIKEWt2UIS7vf880KF54gny38,1831
|
|
39
39
|
haiway/utils/noop.py,sha256=U8ocfoCgt-pY0owJDPtrRrj53cabeIXH9qCKWMQnoRk,1336
|
40
40
|
haiway/utils/queue.py,sha256=6v2u3pA6A44IuCCTOjmCt3yLyOcm7PCRnrIGo25j-1o,6402
|
41
41
|
haiway/utils/stream.py,sha256=lXaeveTY0-AYG5xVzcQYaiC6SUD5fUtHoMXiQcrQAAM,5723
|
42
|
-
haiway-0.24.
|
43
|
-
haiway-0.24.
|
44
|
-
haiway-0.24.
|
45
|
-
haiway-0.24.
|
42
|
+
haiway-0.24.3.dist-info/METADATA,sha256=jQMih-4aqEmQRFaHKmcbuldMG8yf74t5SYYMKXIVHcc,4919
|
43
|
+
haiway-0.24.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
44
|
+
haiway-0.24.3.dist-info/licenses/LICENSE,sha256=3phcpHVNBP8jsi77gOO0E7rgKeDeu99Pi7DSnK9YHoQ,1069
|
45
|
+
haiway-0.24.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|