pydantic-graph 1.26.0__py3-none-any.whl → 1.41.0__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.
- pydantic_graph/beta/graph.py +10 -7
- pydantic_graph/beta/graph_builder.py +2 -0
- pydantic_graph/graph.py +1 -1
- {pydantic_graph-1.26.0.dist-info → pydantic_graph-1.41.0.dist-info}/METADATA +1 -1
- {pydantic_graph-1.26.0.dist-info → pydantic_graph-1.41.0.dist-info}/RECORD +7 -7
- {pydantic_graph-1.26.0.dist-info → pydantic_graph-1.41.0.dist-info}/WHEEL +0 -0
- {pydantic_graph-1.26.0.dist-info → pydantic_graph-1.41.0.dist-info}/licenses/LICENSE +0 -0
pydantic_graph/beta/graph.py
CHANGED
|
@@ -13,7 +13,7 @@ from contextlib import AbstractContextManager, AsyncExitStack, ExitStack, asyncc
|
|
|
13
13
|
from dataclasses import dataclass, field
|
|
14
14
|
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeGuard, cast, get_args, get_origin, overload
|
|
15
15
|
|
|
16
|
-
from anyio import CancelScope, create_memory_object_stream, create_task_group
|
|
16
|
+
from anyio import BrokenResourceError, CancelScope, create_memory_object_stream, create_task_group
|
|
17
17
|
from anyio.abc import TaskGroup
|
|
18
18
|
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
|
|
19
19
|
from typing_extensions import TypeVar, assert_never
|
|
@@ -748,12 +748,15 @@ class _GraphIterator(Generic[StateT, DepsT, OutputT]):
|
|
|
748
748
|
with CancelScope() as scope:
|
|
749
749
|
self.cancel_scopes[t_.task_id] = scope
|
|
750
750
|
result = await self._run_task(t_)
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
751
|
+
try:
|
|
752
|
+
if isinstance(result, _GraphTaskAsyncIterable):
|
|
753
|
+
async for new_tasks in result.iterable:
|
|
754
|
+
await self.iter_stream_sender.send(_GraphTaskResult(t_, new_tasks, False))
|
|
755
|
+
await self.iter_stream_sender.send(_GraphTaskResult(t_, []))
|
|
756
|
+
else:
|
|
757
|
+
await self.iter_stream_sender.send(_GraphTaskResult(t_, result))
|
|
758
|
+
except BrokenResourceError:
|
|
759
|
+
pass # pragma: no cover # This can happen in difficult-to-reproduce circumstances when cancelling an asyncio task
|
|
757
760
|
|
|
758
761
|
async def _run_task(
|
|
759
762
|
self,
|
|
@@ -284,6 +284,8 @@ class GraphBuilder(Generic[StateT, DepsT, GraphInputT, GraphOutputT]):
|
|
|
284
284
|
async def wrapper(ctx: StepContext[StateT, DepsT, InputT]):
|
|
285
285
|
return call(ctx)
|
|
286
286
|
|
|
287
|
+
node_id = node_id or get_callable_name(call)
|
|
288
|
+
|
|
287
289
|
return self.step(call=wrapper, node_id=node_id, label=label)
|
|
288
290
|
|
|
289
291
|
@overload
|
pydantic_graph/graph.py
CHANGED
|
@@ -167,7 +167,7 @@ class Graph(Generic[StateT, DepsT, RunEndT]):
|
|
|
167
167
|
) -> GraphRunResult[StateT, RunEndT]:
|
|
168
168
|
"""Synchronously run the graph.
|
|
169
169
|
|
|
170
|
-
This is a convenience method that wraps [`self.run`][pydantic_graph.Graph.run] with `loop.run_until_complete(...)`.
|
|
170
|
+
This is a convenience method that wraps [`self.run`][pydantic_graph.graph.Graph.run] with `loop.run_until_complete(...)`.
|
|
171
171
|
You therefore can't use this method inside async code or if there's an active event loop.
|
|
172
172
|
|
|
173
173
|
Args:
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
pydantic_graph/__init__.py,sha256=qkrSmWLpnNhD7mLBWV70iS46vy2vFiU2zUModG31wPQ,593
|
|
2
2
|
pydantic_graph/_utils.py,sha256=f0B1VIRxfAslj5UIfBVRzXhIJkDXyF8P3B9V22Q7o7U,6782
|
|
3
3
|
pydantic_graph/exceptions.py,sha256=aeaBf2H18dV7YCNZKZmiXiI6Fyys2qQdunZwd7TSCPk,1648
|
|
4
|
-
pydantic_graph/graph.py,sha256=
|
|
4
|
+
pydantic_graph/graph.py,sha256=i1m0klQG7iR5mDo3XlgA0BhLCskDVYIbwVXHU1zCNHI,33948
|
|
5
5
|
pydantic_graph/mermaid.py,sha256=u8xM8eEAOWV0TkqEAPJJ9jL2XEZnJ_H7yNGhulg7SL4,10045
|
|
6
6
|
pydantic_graph/nodes.py,sha256=CkY3lrC6jqZtzwhSRjFzmM69TdFFFrr58XSDU4THKHA,7450
|
|
7
7
|
pydantic_graph/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
pydantic_graph/beta/__init__.py,sha256=VVmbEFaCSXYHwXqS4pANg4B3cn_c86tT62tW_EXcuyw,751
|
|
9
9
|
pydantic_graph/beta/decision.py,sha256=x-Ta549b-j5hyBPUWFdwRQDRaJqnBHF1pfBP9L8I3vI,11239
|
|
10
|
-
pydantic_graph/beta/graph.py,sha256
|
|
11
|
-
pydantic_graph/beta/graph_builder.py,sha256=
|
|
10
|
+
pydantic_graph/beta/graph.py,sha256=_es8lxne3cntZBTlMqRdULl3AjPAoHuWa7whOT3CWLA,43044
|
|
11
|
+
pydantic_graph/beta/graph_builder.py,sha256=BV_eQDloVMddWjvL_EGP0JmjbQZMJcc0YqGQ6SwuS-k,43383
|
|
12
12
|
pydantic_graph/beta/id_types.py,sha256=FZ3rYSubF6g_Ocv0faL3yJsy1lNN9AGZl9f_izvORUg,2814
|
|
13
13
|
pydantic_graph/beta/join.py,sha256=rzCumDX_YgaU_a5bisfbjbbOuI3IwSZsCZs9TC0T9E4,8002
|
|
14
14
|
pydantic_graph/beta/mermaid.py,sha256=vpB9laZeTaS-P6BJplyN7DLFz0ppRVafGjBfqRiTh-s,7128
|
|
@@ -22,7 +22,7 @@ pydantic_graph/persistence/__init__.py,sha256=NLBGvUWhem23EdMHHxtX0XgTS2vyixmuWt
|
|
|
22
22
|
pydantic_graph/persistence/_utils.py,sha256=6ySxCc1lFz7bbLUwDLkoZWNqi8VNLBVU4xxJbKI23fQ,2264
|
|
23
23
|
pydantic_graph/persistence/file.py,sha256=XZy295cGc86HfUl_KuB-e7cECZW3bubiEdyJMVQ1OD0,6906
|
|
24
24
|
pydantic_graph/persistence/in_mem.py,sha256=MmahaVpdzmDB30Dm3ZfSCZBqgmx6vH4HXdBaWwVF0K0,6799
|
|
25
|
-
pydantic_graph-1.
|
|
26
|
-
pydantic_graph-1.
|
|
27
|
-
pydantic_graph-1.
|
|
28
|
-
pydantic_graph-1.
|
|
25
|
+
pydantic_graph-1.41.0.dist-info/METADATA,sha256=VDRVVqtLSB0Zp8La6wEpxq01UbePCK8uwKrxBUT9NTs,3895
|
|
26
|
+
pydantic_graph-1.41.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
27
|
+
pydantic_graph-1.41.0.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
|
|
28
|
+
pydantic_graph-1.41.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|