graphon 0.1.2__tar.gz → 0.2.0__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 (286) hide show
  1. graphon-0.2.0/PKG-INFO +178 -0
  2. graphon-0.2.0/README.md +149 -0
  3. graphon-0.2.0/pyproject.toml +90 -0
  4. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/base_node_data.py +27 -20
  5. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/graph_config.py +1 -6
  6. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/pause_reason.py +4 -3
  7. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/workflow_execution.py +3 -7
  8. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/workflow_node_execution.py +19 -14
  9. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/enums.py +4 -7
  10. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/errors.py +1 -1
  11. graphon-0.2.0/src/graphon/file/constants.py +46 -0
  12. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/enums.py +10 -18
  13. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/file_factory.py +1 -3
  14. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/file_manager.py +65 -48
  15. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/helpers.py +18 -5
  16. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/models.py +27 -21
  17. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/protocols.py +15 -12
  18. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/runtime.py +40 -6
  19. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/tool_file_parser.py +2 -2
  20. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph/graph.py +117 -63
  21. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph/graph_template.py +7 -5
  22. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph/validation.py +6 -5
  23. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/_engine_utils.py +4 -0
  24. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_channels/in_memory_channel.py +8 -10
  25. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_channels/protocol.py +6 -8
  26. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_channels/redis_channel.py +27 -24
  27. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_processing/__init__.py +1 -2
  28. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_processing/command_handlers.py +20 -14
  29. graphon-0.2.0/src/graphon/graph_engine/command_processing/command_processor.py +108 -0
  30. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/config.py +1 -3
  31. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/domain/__init__.py +1 -2
  32. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/domain/graph_execution.py +22 -19
  33. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/domain/node_execution.py +2 -5
  34. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/entities/commands.py +11 -7
  35. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/error_handler.py +34 -31
  36. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/event_management/__init__.py +1 -2
  37. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/event_management/event_handlers.py +67 -69
  38. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/event_management/event_manager.py +17 -21
  39. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/graph_engine.py +74 -74
  40. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/graph_state_manager.py +43 -41
  41. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/graph_traversal/__init__.py +1 -2
  42. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/graph_traversal/edge_processor.py +41 -34
  43. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/graph_traversal/skip_propagator.py +14 -13
  44. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/layers/__init__.py +1 -2
  45. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/layers/base.py +19 -19
  46. graphon-0.2.0/src/graphon/graph_engine/layers/debug_logging.py +300 -0
  47. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/layers/execution_limits.py +41 -36
  48. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/manager.py +7 -10
  49. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/orchestration/__init__.py +1 -2
  50. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/orchestration/dispatcher.py +8 -9
  51. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/orchestration/execution_coordinator.py +13 -18
  52. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/ready_queue/__init__.py +1 -2
  53. graphon-0.2.0/src/graphon/graph_engine/ready_queue/factory.py +46 -0
  54. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/ready_queue/in_memory.py +23 -24
  55. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/ready_queue/protocol.py +18 -24
  56. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/response_coordinator/__init__.py +1 -2
  57. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/response_coordinator/coordinator.py +163 -120
  58. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/response_coordinator/path.py +3 -6
  59. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/response_coordinator/session.py +10 -19
  60. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/worker.py +38 -22
  61. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/worker_management/__init__.py +1 -2
  62. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/worker_management/worker_pool.py +28 -21
  63. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/agent.py +1 -2
  64. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/graph.py +2 -1
  65. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/iteration.py +1 -2
  66. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/loop.py +1 -2
  67. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/node.py +17 -12
  68. graphon-0.2.0/src/graphon/http/__init__.py +17 -0
  69. graphon-0.2.0/src/graphon/http/client.py +104 -0
  70. graphon-0.2.0/src/graphon/http/protocols.py +53 -0
  71. graphon-0.2.0/src/graphon/http/response.py +105 -0
  72. graphon-0.2.0/src/graphon/http/runtime.py +17 -0
  73. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/callbacks/base_callback.py +18 -17
  74. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/callbacks/logging_callback.py +24 -20
  75. graphon-0.2.0/src/graphon/model_runtime/entities/common_entities.py +18 -0
  76. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/defaults.py +5 -5
  77. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/llm_entities.py +26 -41
  78. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/message_entities.py +115 -124
  79. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/model_entities.py +86 -83
  80. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/provider_entities.py +16 -39
  81. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/rerank_entities.py +2 -6
  82. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/text_embedding_entities.py +3 -9
  83. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/errors/invoke.py +2 -2
  84. graphon-0.2.0/src/graphon/model_runtime/errors/validate.py +2 -0
  85. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/ai_model.py +96 -126
  86. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/large_language_model.py +88 -115
  87. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/moderation_model.py +4 -13
  88. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/rerank_model.py +6 -27
  89. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/speech2text_model.py +4 -13
  90. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/text_embedding_model.py +24 -46
  91. graphon-0.2.0/src/graphon/model_runtime/model_providers/base/tokenizers/gpt2_tokenizer.py +70 -0
  92. graphon-0.2.0/src/graphon/model_runtime/model_providers/base/tts_model.py +47 -0
  93. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/model_providers/model_provider_factory.py +66 -82
  94. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/runtime.py +9 -2
  95. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/schema_validators/common_validator.py +25 -31
  96. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/schema_validators/model_credential_schema_validator.py +10 -12
  97. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/schema_validators/provider_credential_schema_validator.py +5 -9
  98. graphon-0.2.0/src/graphon/model_runtime/slim/__init__.py +15 -0
  99. graphon-0.2.0/src/graphon/model_runtime/slim/config.py +86 -0
  100. graphon-0.2.0/src/graphon/model_runtime/slim/package_loader.py +527 -0
  101. graphon-0.2.0/src/graphon/model_runtime/slim/prepared_llm.py +199 -0
  102. graphon-0.2.0/src/graphon/model_runtime/slim/runtime.py +965 -0
  103. graphon-0.2.0/src/graphon/model_runtime/utils/encoders.py +358 -0
  104. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/base.py +3 -5
  105. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/iteration.py +1 -2
  106. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/loop.py +1 -2
  107. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/node.py +5 -3
  108. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/answer/answer_node.py +16 -5
  109. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/answer/entities.py +7 -15
  110. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/entities.py +6 -13
  111. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/node.py +321 -199
  112. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/template.py +9 -8
  113. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/usage_tracking_mixin.py +2 -1
  114. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/variable_template_parser.py +21 -19
  115. graphon-0.2.0/src/graphon/nodes/code/code_node.py +709 -0
  116. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/code/entities.py +7 -4
  117. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/document_extractor/node.py +457 -368
  118. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/end/end_node.py +12 -5
  119. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/end/entities.py +4 -7
  120. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/http_request/config.py +4 -6
  121. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/http_request/entities.py +81 -107
  122. graphon-0.2.0/src/graphon/nodes/http_request/executor.py +606 -0
  123. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/http_request/node.py +111 -90
  124. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/human_input/entities.py +23 -21
  125. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/human_input/human_input_node.py +56 -33
  126. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/if_else/entities.py +14 -6
  127. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/if_else/if_else_node.py +29 -36
  128. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/iteration/entities.py +6 -18
  129. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/iteration/iteration_node.py +273 -176
  130. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/iteration/iteration_start_node.py +6 -6
  131. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/list_operator/node.py +218 -154
  132. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/entities.py +3 -3
  133. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/exc.py +3 -3
  134. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/file_saver.py +30 -11
  135. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/llm_utils.py +190 -154
  136. graphon-0.2.0/src/graphon/nodes/llm/node.py +1937 -0
  137. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/protocols.py +3 -1
  138. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/runtime_protocols.py +45 -1
  139. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/loop/entities.py +9 -23
  140. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/loop/loop_end_node.py +6 -6
  141. graphon-0.2.0/src/graphon/nodes/loop/loop_node.py +640 -0
  142. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/loop/loop_start_node.py +6 -6
  143. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/parameter_extractor/entities.py +48 -48
  144. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/parameter_extractor/exc.py +1 -1
  145. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/parameter_extractor/parameter_extractor_node.py +419 -279
  146. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/parameter_extractor/prompts.py +5 -5
  147. graphon-0.2.0/src/graphon/nodes/protocols.py +36 -0
  148. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/question_classifier/question_classifier_node.py +213 -156
  149. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/runtime.py +2 -8
  150. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/start/entities.py +1 -3
  151. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/start/start_node.py +13 -9
  152. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/template_transform/entities.py +1 -3
  153. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/template_transform/template_transform_node.py +21 -13
  154. graphon-0.2.0/src/graphon/nodes/tool/entities.py +149 -0
  155. graphon-0.2.0/src/graphon/nodes/tool/tool_node.py +683 -0
  156. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/tool_runtime_entities.py +20 -0
  157. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_aggregator/entities.py +3 -9
  158. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_aggregator/variable_aggregator_node.py +6 -1
  159. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/common/helpers.py +18 -14
  160. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v1/node.py +34 -20
  161. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v2/exc.py +8 -8
  162. graphon-0.2.0/src/graphon/nodes/variable_assigner/v2/helpers.py +159 -0
  163. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v2/node.py +159 -125
  164. graphon-0.2.0/src/graphon/protocols/__init__.py +53 -0
  165. graphon-0.2.0/src/graphon/runtime/graph_runtime_state.py +979 -0
  166. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/runtime/graph_runtime_state_protocol.py +4 -5
  167. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/runtime/read_only_wrappers.py +2 -3
  168. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/runtime/variable_pool.py +111 -73
  169. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/utils/condition/entities.py +1 -1
  170. graphon-0.2.0/src/graphon/utils/condition/processor.py +590 -0
  171. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/utils/json_in_md_parser.py +14 -6
  172. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variable_loader.py +10 -9
  173. graphon-0.2.0/src/graphon/variables/factory.py +274 -0
  174. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/input_entities.py +6 -6
  175. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/segment_group.py +4 -4
  176. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/segments.py +15 -39
  177. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/types.py +157 -116
  178. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/utils.py +19 -14
  179. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/variables.py +14 -10
  180. graphon-0.2.0/src/graphon/workflow_type_encoder.py +50 -0
  181. graphon-0.1.2/PKG-INFO +0 -256
  182. graphon-0.1.2/README.md +0 -227
  183. graphon-0.1.2/pyproject.toml +0 -160
  184. graphon-0.1.2/src/graphon/file/constants.py +0 -46
  185. graphon-0.1.2/src/graphon/graph_engine/command_processing/command_processor.py +0 -87
  186. graphon-0.1.2/src/graphon/graph_engine/layers/debug_logging.py +0 -282
  187. graphon-0.1.2/src/graphon/graph_engine/ready_queue/factory.py +0 -37
  188. graphon-0.1.2/src/graphon/model_runtime/entities/common_entities.py +0 -16
  189. graphon-0.1.2/src/graphon/model_runtime/errors/validate.py +0 -4
  190. graphon-0.1.2/src/graphon/model_runtime/model_providers/__base/tokenizers/gpt2_tokenizer.py +0 -60
  191. graphon-0.1.2/src/graphon/model_runtime/model_providers/__base/tts_model.py +0 -60
  192. graphon-0.1.2/src/graphon/model_runtime/utils/encoders.py +0 -226
  193. graphon-0.1.2/src/graphon/nodes/code/code_node.py +0 -570
  194. graphon-0.1.2/src/graphon/nodes/http_request/executor.py +0 -550
  195. graphon-0.1.2/src/graphon/nodes/llm/node.py +0 -1529
  196. graphon-0.1.2/src/graphon/nodes/loop/loop_node.py +0 -527
  197. graphon-0.1.2/src/graphon/nodes/protocols.py +0 -60
  198. graphon-0.1.2/src/graphon/nodes/tool/entities.py +0 -106
  199. graphon-0.1.2/src/graphon/nodes/tool/tool_node.py +0 -482
  200. graphon-0.1.2/src/graphon/nodes/variable_assigner/v2/helpers.py +0 -136
  201. graphon-0.1.2/src/graphon/runtime/graph_runtime_state.py +0 -736
  202. graphon-0.1.2/src/graphon/utils/condition/processor.py +0 -499
  203. graphon-0.1.2/src/graphon/variables/factory.py +0 -215
  204. graphon-0.1.2/src/graphon/workflow_type_encoder.py +0 -48
  205. {graphon-0.1.2 → graphon-0.2.0}/LICENSE +0 -0
  206. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/__init__.py +0 -0
  207. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/__init__.py +0 -0
  208. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/exc.py +0 -0
  209. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/graph_init_params.py +0 -0
  210. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/entities/workflow_start_reason.py +0 -0
  211. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/file/__init__.py +0 -0
  212. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph/__init__.py +0 -0
  213. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph/edge.py +0 -0
  214. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/__init__.py +0 -0
  215. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_channels/README.md +0 -0
  216. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/command_channels/__init__.py +0 -0
  217. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/entities/__init__.py +0 -0
  218. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_engine/layers/README.md +0 -0
  219. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/__init__.py +0 -0
  220. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/base.py +0 -0
  221. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/graph_events/human_input.py +0 -0
  222. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/README.md +0 -0
  223. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/README_CN.md +0 -0
  224. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/__init__.py +0 -0
  225. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/callbacks/__init__.py +0 -0
  226. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/entities/__init__.py +0 -0
  227. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/errors/__init__.py +0 -0
  228. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/memory/__init__.py +0 -0
  229. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/memory/prompt_message_memory.py +0 -0
  230. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base → graphon-0.2.0/src/graphon/model_runtime/model_providers}/__init__.py +0 -0
  231. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/model_providers/_position.yaml +0 -0
  232. {graphon-0.1.2/src/graphon/model_runtime/model_providers/__base/tokenizers → graphon-0.2.0/src/graphon/model_runtime/model_providers/base}/__init__.py +0 -0
  233. {graphon-0.1.2/src/graphon/model_runtime/model_providers → graphon-0.2.0/src/graphon/model_runtime/model_providers/base/tokenizers}/__init__.py +0 -0
  234. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/schema_validators/__init__.py +0 -0
  235. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/model_runtime/utils/__init__.py +0 -0
  236. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/__init__.py +0 -0
  237. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/node_events/agent.py +0 -0
  238. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/__init__.py +0 -0
  239. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/answer/__init__.py +0 -0
  240. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/base/__init__.py +0 -0
  241. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/code/__init__.py +0 -0
  242. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/code/exc.py +0 -0
  243. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/code/limits.py +0 -0
  244. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/document_extractor/__init__.py +0 -0
  245. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/document_extractor/entities.py +0 -0
  246. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/document_extractor/exc.py +0 -0
  247. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/end/__init__.py +0 -0
  248. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/http_request/__init__.py +0 -0
  249. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/http_request/exc.py +0 -0
  250. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/human_input/__init__.py +0 -0
  251. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/human_input/enums.py +0 -0
  252. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/if_else/__init__.py +0 -0
  253. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/iteration/__init__.py +0 -0
  254. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/iteration/exc.py +0 -0
  255. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/list_operator/__init__.py +0 -0
  256. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/list_operator/entities.py +0 -0
  257. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/list_operator/exc.py +0 -0
  258. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/llm/__init__.py +0 -0
  259. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/loop/__init__.py +0 -0
  260. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/parameter_extractor/__init__.py +0 -0
  261. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/question_classifier/__init__.py +0 -0
  262. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/question_classifier/entities.py +0 -0
  263. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/question_classifier/exc.py +0 -0
  264. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/question_classifier/template_prompts.py +0 -0
  265. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/start/__init__.py +0 -0
  266. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/template_transform/__init__.py +0 -0
  267. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/tool/__init__.py +0 -0
  268. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/tool/exc.py +0 -0
  269. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_aggregator/__init__.py +0 -0
  270. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/__init__.py +0 -0
  271. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/common/__init__.py +0 -0
  272. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/common/exc.py +0 -0
  273. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v1/__init__.py +0 -0
  274. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v1/node_data.py +0 -0
  275. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v2/__init__.py +0 -0
  276. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v2/entities.py +0 -0
  277. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/nodes/variable_assigner/v2/enums.py +0 -0
  278. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/prompt_entities.py +0 -0
  279. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/py.typed +0 -0
  280. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/runtime/__init__.py +0 -0
  281. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/template_rendering.py +0 -0
  282. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/utils/__init__.py +0 -0
  283. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/utils/condition/__init__.py +0 -0
  284. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/__init__.py +0 -0
  285. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/consts.py +0 -0
  286. {graphon-0.1.2 → graphon-0.2.0}/src/graphon/variables/exc.py +0 -0
graphon-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.4
2
+ Name: graphon
3
+ Version: 0.2.0
4
+ Summary: Graph execution engine for agentic AI workflows.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Dist: charset-normalizer>=2.1
8
+ Requires-Dist: httpx>=0.28
9
+ Requires-Dist: json-repair>=0.55
10
+ Requires-Dist: jsonschema>=4
11
+ Requires-Dist: orjson>=3
12
+ Requires-Dist: pandas[excel]>=2.1
13
+ Requires-Dist: pydantic>=2.7
14
+ Requires-Dist: pydantic-extra-types>=2
15
+ Requires-Dist: pypdfium2>=5
16
+ Requires-Dist: python-docx>=1.2
17
+ Requires-Dist: pyyaml>=6
18
+ Requires-Dist: tiktoken>=0.12
19
+ Requires-Dist: transformers>=4
20
+ Requires-Dist: typing-extensions>=4.10.0
21
+ Requires-Dist: unstructured[docx,epub,md,ppt,pptx]>=0.21
22
+ Requires-Dist: pypandoc>=1.13
23
+ Requires-Dist: webvtt-py>=0.5
24
+ Requires-Python: >=3.12, <3.14
25
+ Project-URL: source, https://github.com/langgenius/graphon
26
+ Project-URL: homepage, https://github.com/langgenius/graphon
27
+ Project-URL: issues, https://github.com/langgenius/graphon/issues
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Graphon
31
+
32
+ Graphon is a Python graph execution engine for agentic AI workflows.
33
+
34
+ The repository is still evolving, but it already contains a working execution
35
+ engine, built-in workflow nodes, model runtime abstractions, integration
36
+ protocols, and a runnable end-to-end example.
37
+
38
+ ## Highlights
39
+
40
+ - Queue-based `GraphEngine` orchestration with event-driven execution
41
+ - Graph parsing, validation, and fluent graph building
42
+ - Shared runtime state, variable pool, and workflow execution domain models
43
+ - Built-in node implementations for common workflow patterns
44
+ - Pluggable model runtime interfaces, including a local `SlimRuntime`
45
+ - HTTP, file, tool, and human-input integration protocols
46
+ - Extensible engine layers and external command channels
47
+
48
+ Repository modules currently cover node types such as `start`, `end`, `answer`,
49
+ `llm`, `if-else`, `code`, `template-transform`, `question-classifier`,
50
+ `http-request`, `tool`, `variable-aggregator`, `variable-assigner`, `loop`,
51
+ `iteration`, `parameter-extractor`, `document-extractor`, `list-operator`, and
52
+ `human-input`.
53
+
54
+ ## Quick Start
55
+
56
+ Graphon is currently easiest to evaluate from a source checkout.
57
+
58
+ ### Requirements
59
+
60
+ - Python 3.12 or 3.13
61
+ - [`uv`](https://docs.astral.sh/uv/)
62
+ - `make`
63
+
64
+ Python 3.14 is currently unsupported because `unstructured`, which backs part
65
+ of the document extraction stack, currently declares `Requires-Python: <3.14`.
66
+
67
+ ### Set up the repository
68
+
69
+ ```bash
70
+ make dev
71
+ source .venv/bin/activate
72
+ make test
73
+ ```
74
+
75
+ `make dev` installs the project, syncs development dependencies, and sets up
76
+ [`prek`](https://prek.j178.dev/) Git hooks.
77
+
78
+ ## Run the Example Workflow
79
+
80
+ The repository includes a minimal runnable example at
81
+ [`examples/graphon_openai_slim`](examples/graphon_openai_slim).
82
+
83
+ It builds and executes this workflow:
84
+
85
+ ```text
86
+ start -> llm -> output
87
+ ```
88
+
89
+ To run it:
90
+
91
+ ```bash
92
+ make dev
93
+ source .venv/bin/activate
94
+ cd examples/graphon_openai_slim
95
+ cp .env.example .env
96
+ python3 workflow.py "Explain Graphon in one short sentence."
97
+ ```
98
+
99
+ Before running the example, fill in the required values in `.env`.
100
+
101
+ The example currently expects:
102
+
103
+ - an `OPENAI_API_KEY`
104
+ - a `SLIM_PLUGIN_ID`
105
+ - a local `dify-plugin-daemon-slim` setup or equivalent Slim runtime
106
+
107
+ For the exact environment variables and runtime notes, see
108
+ [examples/graphon_openai_slim/README.md](examples/graphon_openai_slim/README.md).
109
+
110
+ ## How Graphon Fits Together
111
+
112
+ At a high level, Graphon usage looks like this:
113
+
114
+ 1. Build or load a graph and instantiate nodes into a `Graph`.
115
+ 2. Prepare `GraphRuntimeState` and seed the `VariablePool`.
116
+ 3. Configure model, file, HTTP, tool, or human-input adapters as needed.
117
+ 4. Run `GraphEngine` and consume emitted graph events.
118
+ 5. Read final outputs from runtime state.
119
+
120
+ The bundled example follows exactly that path. The execution loop is centered
121
+ around `GraphEngine.run()`:
122
+
123
+ ```python
124
+ engine = GraphEngine(
125
+ workflow_id="example-start-llm-output",
126
+ graph=graph,
127
+ graph_runtime_state=graph_runtime_state,
128
+ command_channel=InMemoryChannel(),
129
+ )
130
+
131
+ for event in engine.run():
132
+ ...
133
+ ```
134
+
135
+ See
136
+ [examples/graphon_openai_slim/workflow.py](examples/graphon_openai_slim/workflow.py)
137
+ for the full example, including `SlimRuntime`, `SlimPreparedLLM`, graph
138
+ construction, input seeding, and streamed output handling.
139
+
140
+ ## Project Layout
141
+
142
+ - `src/graphon/graph`: graph structures, parsing, validation, and builders
143
+ - `src/graphon/graph_engine`: orchestration, workers, command channels, and
144
+ layers
145
+ - `src/graphon/runtime`: runtime state, read-only wrappers, and variable pool
146
+ - `src/graphon/nodes`: built-in workflow node implementations
147
+ - `src/graphon/model_runtime`: provider/model abstractions and Slim runtime
148
+ - `src/graphon/graph_events`: event models emitted during execution
149
+ - `src/graphon/http`: HTTP client abstractions and default implementation
150
+ - `src/graphon/file`: workflow file models and file runtime helpers
151
+ - `src/graphon/protocols`: public protocol re-exports for integrations
152
+ - `examples/`: runnable examples
153
+ - `tests/`: unit and integration-style coverage
154
+
155
+ ## Internal Docs
156
+
157
+ - [CONTRIBUTING.md](CONTRIBUTING.md): contributor workflow, CI, commit/PR rules
158
+ - [examples/graphon_openai_slim/README.md](examples/graphon_openai_slim/README.md):
159
+ runnable example setup
160
+ - [src/graphon/model_runtime/README.md](src/graphon/model_runtime/README.md):
161
+ model runtime overview
162
+ - [src/graphon/graph_engine/layers/README.md](src/graphon/graph_engine/layers/README.md):
163
+ engine layer extension points
164
+ - [src/graphon/graph_engine/command_channels/README.md](src/graphon/graph_engine/command_channels/README.md):
165
+ local and distributed command channels
166
+
167
+ ## Development
168
+
169
+ Contributor setup, tooling details, CLA notes, and commit/PR conventions live
170
+ in [CONTRIBUTING.md](CONTRIBUTING.md).
171
+
172
+ CI currently validates commit messages, pull request titles, formatting, lint,
173
+ and tests on Python 3.12 and 3.13. Python 3.14 is currently excluded because
174
+ `unstructured` does not yet support it.
175
+
176
+ ## License
177
+
178
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,149 @@
1
+ # Graphon
2
+
3
+ Graphon is a Python graph execution engine for agentic AI workflows.
4
+
5
+ The repository is still evolving, but it already contains a working execution
6
+ engine, built-in workflow nodes, model runtime abstractions, integration
7
+ protocols, and a runnable end-to-end example.
8
+
9
+ ## Highlights
10
+
11
+ - Queue-based `GraphEngine` orchestration with event-driven execution
12
+ - Graph parsing, validation, and fluent graph building
13
+ - Shared runtime state, variable pool, and workflow execution domain models
14
+ - Built-in node implementations for common workflow patterns
15
+ - Pluggable model runtime interfaces, including a local `SlimRuntime`
16
+ - HTTP, file, tool, and human-input integration protocols
17
+ - Extensible engine layers and external command channels
18
+
19
+ Repository modules currently cover node types such as `start`, `end`, `answer`,
20
+ `llm`, `if-else`, `code`, `template-transform`, `question-classifier`,
21
+ `http-request`, `tool`, `variable-aggregator`, `variable-assigner`, `loop`,
22
+ `iteration`, `parameter-extractor`, `document-extractor`, `list-operator`, and
23
+ `human-input`.
24
+
25
+ ## Quick Start
26
+
27
+ Graphon is currently easiest to evaluate from a source checkout.
28
+
29
+ ### Requirements
30
+
31
+ - Python 3.12 or 3.13
32
+ - [`uv`](https://docs.astral.sh/uv/)
33
+ - `make`
34
+
35
+ Python 3.14 is currently unsupported because `unstructured`, which backs part
36
+ of the document extraction stack, currently declares `Requires-Python: <3.14`.
37
+
38
+ ### Set up the repository
39
+
40
+ ```bash
41
+ make dev
42
+ source .venv/bin/activate
43
+ make test
44
+ ```
45
+
46
+ `make dev` installs the project, syncs development dependencies, and sets up
47
+ [`prek`](https://prek.j178.dev/) Git hooks.
48
+
49
+ ## Run the Example Workflow
50
+
51
+ The repository includes a minimal runnable example at
52
+ [`examples/graphon_openai_slim`](examples/graphon_openai_slim).
53
+
54
+ It builds and executes this workflow:
55
+
56
+ ```text
57
+ start -> llm -> output
58
+ ```
59
+
60
+ To run it:
61
+
62
+ ```bash
63
+ make dev
64
+ source .venv/bin/activate
65
+ cd examples/graphon_openai_slim
66
+ cp .env.example .env
67
+ python3 workflow.py "Explain Graphon in one short sentence."
68
+ ```
69
+
70
+ Before running the example, fill in the required values in `.env`.
71
+
72
+ The example currently expects:
73
+
74
+ - an `OPENAI_API_KEY`
75
+ - a `SLIM_PLUGIN_ID`
76
+ - a local `dify-plugin-daemon-slim` setup or equivalent Slim runtime
77
+
78
+ For the exact environment variables and runtime notes, see
79
+ [examples/graphon_openai_slim/README.md](examples/graphon_openai_slim/README.md).
80
+
81
+ ## How Graphon Fits Together
82
+
83
+ At a high level, Graphon usage looks like this:
84
+
85
+ 1. Build or load a graph and instantiate nodes into a `Graph`.
86
+ 2. Prepare `GraphRuntimeState` and seed the `VariablePool`.
87
+ 3. Configure model, file, HTTP, tool, or human-input adapters as needed.
88
+ 4. Run `GraphEngine` and consume emitted graph events.
89
+ 5. Read final outputs from runtime state.
90
+
91
+ The bundled example follows exactly that path. The execution loop is centered
92
+ around `GraphEngine.run()`:
93
+
94
+ ```python
95
+ engine = GraphEngine(
96
+ workflow_id="example-start-llm-output",
97
+ graph=graph,
98
+ graph_runtime_state=graph_runtime_state,
99
+ command_channel=InMemoryChannel(),
100
+ )
101
+
102
+ for event in engine.run():
103
+ ...
104
+ ```
105
+
106
+ See
107
+ [examples/graphon_openai_slim/workflow.py](examples/graphon_openai_slim/workflow.py)
108
+ for the full example, including `SlimRuntime`, `SlimPreparedLLM`, graph
109
+ construction, input seeding, and streamed output handling.
110
+
111
+ ## Project Layout
112
+
113
+ - `src/graphon/graph`: graph structures, parsing, validation, and builders
114
+ - `src/graphon/graph_engine`: orchestration, workers, command channels, and
115
+ layers
116
+ - `src/graphon/runtime`: runtime state, read-only wrappers, and variable pool
117
+ - `src/graphon/nodes`: built-in workflow node implementations
118
+ - `src/graphon/model_runtime`: provider/model abstractions and Slim runtime
119
+ - `src/graphon/graph_events`: event models emitted during execution
120
+ - `src/graphon/http`: HTTP client abstractions and default implementation
121
+ - `src/graphon/file`: workflow file models and file runtime helpers
122
+ - `src/graphon/protocols`: public protocol re-exports for integrations
123
+ - `examples/`: runnable examples
124
+ - `tests/`: unit and integration-style coverage
125
+
126
+ ## Internal Docs
127
+
128
+ - [CONTRIBUTING.md](CONTRIBUTING.md): contributor workflow, CI, commit/PR rules
129
+ - [examples/graphon_openai_slim/README.md](examples/graphon_openai_slim/README.md):
130
+ runnable example setup
131
+ - [src/graphon/model_runtime/README.md](src/graphon/model_runtime/README.md):
132
+ model runtime overview
133
+ - [src/graphon/graph_engine/layers/README.md](src/graphon/graph_engine/layers/README.md):
134
+ engine layer extension points
135
+ - [src/graphon/graph_engine/command_channels/README.md](src/graphon/graph_engine/command_channels/README.md):
136
+ local and distributed command channels
137
+
138
+ ## Development
139
+
140
+ Contributor setup, tooling details, CLA notes, and commit/PR conventions live
141
+ in [CONTRIBUTING.md](CONTRIBUTING.md).
142
+
143
+ CI currently validates commit messages, pull request titles, formatting, lint,
144
+ and tests on Python 3.12 and 3.13. Python 3.14 is currently excluded because
145
+ `unstructured` does not yet support it.
146
+
147
+ ## License
148
+
149
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,90 @@
1
+ [project]
2
+ name = 'graphon'
3
+ version = "0.2.0"
4
+ description = 'Graph execution engine for agentic AI workflows.'
5
+ readme = 'README.md'
6
+ license = 'Apache-2.0'
7
+ license-files = ['LICENSE']
8
+ # Keep Python support aligned with `unstructured`, which currently declares
9
+ # `Requires-Python: <3.14,>=3.11`.
10
+ requires-python = '>=3.12,<3.14'
11
+ dependencies = [
12
+ 'charset-normalizer>=2.1',
13
+ 'httpx>=0.28',
14
+ 'json-repair>=0.55',
15
+ 'jsonschema>=4',
16
+ 'orjson>=3',
17
+ 'pandas[excel]>=2.1',
18
+ 'pydantic>=2.7',
19
+ 'pydantic-extra-types>=2',
20
+ 'pypdfium2>=5',
21
+ 'python-docx>=1.2',
22
+ 'pyyaml>=6',
23
+ 'tiktoken>=0.12',
24
+ 'transformers>=4',
25
+ 'typing-extensions>=4.10.0',
26
+ 'unstructured[docx,epub,md,ppt,pptx]>=0.21',
27
+ 'pypandoc>=1.13',
28
+ 'webvtt-py>=0.5',
29
+ ]
30
+
31
+ [project.urls]
32
+ source = 'https://github.com/langgenius/graphon'
33
+ homepage = 'https://github.com/langgenius/graphon'
34
+ issues = 'https://github.com/langgenius/graphon/issues'
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ 'pytest',
39
+ 'pytest-cov',
40
+ 'pytest-mock',
41
+ 'pytest-xdist',
42
+ 'ruff',
43
+ 'prek',
44
+ 'ty',
45
+ ]
46
+
47
+ [build-system]
48
+ requires = ['uv_build~=0.11']
49
+ build-backend = 'uv_build'
50
+
51
+ [tool.uv]
52
+ default-groups = ['dev']
53
+
54
+ [tool.ruff]
55
+ fix = true
56
+ preview = true
57
+ required-version = '>=0.15'
58
+
59
+ [tool.ruff.lint]
60
+ select = ['ALL']
61
+ ignore = [
62
+ 'COM812', # Conflicts with `ruff format`.
63
+ 'ERA001', # False positives are common.
64
+ 'TC', # Runtime use of typing constructs is common now.
65
+ 'CPY', # Covered by the standalone LICENSE file.
66
+ 'PLR0913', # Explicit is better than implicit.
67
+ 'PLR0917', # Complex is better than complicated.
68
+ 'PLR6301', # Violates the usual practice.
69
+ 'D', # Too verbose.
70
+ 'FBT', # Too strict.
71
+ 'TID252', # Too absolute.
72
+ 'ANN401', # We hope to enforce this, but typing is still evolving.
73
+ ]
74
+
75
+ [tool.ruff.lint.pydoclint]
76
+ ignore-one-line-docstrings = true
77
+
78
+ [tool.ruff.lint.per-file-ignores]
79
+ 'tests/**/*.py' = [
80
+ 'S101', # Assert statements used for pytest.
81
+ 'PLR2004', # Magic value used in test cases.
82
+ ]
83
+
84
+ [tool.ty.environment]
85
+ python-platform = "linux"
86
+
87
+ [tool.pytest]
88
+ minversion = '9.0'
89
+ addopts = ['-n', 'auto']
90
+ testpaths = ['tests']
@@ -4,15 +4,14 @@ import json
4
4
  from abc import ABC
5
5
  from builtins import type as type_
6
6
  from enum import StrEnum
7
- from typing import Any, Union
7
+ from typing import Any
8
8
 
9
9
  from pydantic import BaseModel, ConfigDict, Field, model_validator
10
10
 
11
11
  from graphon.entities.exc import DefaultValueTypeError
12
12
  from graphon.enums import ErrorStrategy, NodeType
13
13
 
14
- # Project supports Python 3.11+, where `typing.Union[...]` is valid in `isinstance`.
15
- _NumberType = Union[int, float]
14
+ _NumberType = int | float
16
15
 
17
16
 
18
17
  class RetryConfig(BaseModel):
@@ -43,12 +42,13 @@ class DefaultValue(BaseModel):
43
42
  key: str
44
43
 
45
44
  @staticmethod
46
- def _parse_json(value: str):
45
+ def _parse_json(value: str) -> Any:
47
46
  """Unified JSON parsing handler"""
48
47
  try:
49
48
  return json.loads(value)
50
- except json.JSONDecodeError:
51
- raise DefaultValueTypeError(f"Invalid JSON format for value: {value}")
49
+ except json.JSONDecodeError as error:
50
+ msg = f"Invalid JSON format for value: {value}"
51
+ raise DefaultValueTypeError(msg) from error
52
52
 
53
53
  @staticmethod
54
54
  def _validate_array(value: Any, element_type: type_ | tuple[type_, ...]) -> bool:
@@ -62,8 +62,9 @@ class DefaultValue(BaseModel):
62
62
  """Unified number conversion handler"""
63
63
  try:
64
64
  return float(value)
65
- except ValueError:
66
- raise DefaultValueTypeError(f"Cannot convert to number: {value}")
65
+ except ValueError as error:
66
+ msg = f"Cannot convert to number: {value}"
67
+ raise DefaultValueTypeError(msg) from error
67
68
 
68
69
  @model_validator(mode="after")
69
70
  def validate_value_type(self) -> DefaultValue:
@@ -103,7 +104,8 @@ class DefaultValue(BaseModel):
103
104
  if self.type == DefaultValueType.ARRAY_FILES:
104
105
  # Handle files type
105
106
  return self
106
- raise DefaultValueTypeError(f"Unsupported type: {self.type}")
107
+ msg = f"Unsupported type: {self.type}"
108
+ raise DefaultValueTypeError(msg)
107
109
 
108
110
  # Handle string input cases
109
111
  if isinstance(self.value, str) and self.type != DefaultValueType.STRING:
@@ -111,18 +113,19 @@ class DefaultValue(BaseModel):
111
113
 
112
114
  # Validate base type
113
115
  if not isinstance(self.value, validator["type"]):
114
- raise DefaultValueTypeError(
115
- f"Value must be {validator['type'].__name__} type for {self.value}"
116
- )
116
+ msg = f"Value must be {validator['type'].__name__} type for {self.value}"
117
+ raise DefaultValueTypeError(msg)
117
118
 
118
119
  # Validate array element types
119
- if validator["type"] == list and not self._validate_array(
120
- self.value, validator["element_type"]
120
+ if validator["type"] is list and not self._validate_array(
121
+ self.value,
122
+ validator["element_type"],
121
123
  ):
122
- raise DefaultValueTypeError(
124
+ msg = (
123
125
  f"All elements must be {validator['element_type'].__name__} "
124
126
  f"for {self.value}"
125
127
  )
128
+ raise DefaultValueTypeError(msg)
126
129
 
127
130
  return self
128
131
 
@@ -154,9 +157,15 @@ class BaseNodeData(ABC, BaseModel):
154
157
  return {}
155
158
 
156
159
  def __getitem__(self, key: str) -> Any:
157
- """
158
- Dict-style access without calling model_dump() on every lookup.
160
+ """Dict-style access without calling model_dump() on every lookup.
159
161
  Prefer using model fields and Pydantic's extra storage.
162
+
163
+ Returns:
164
+ The declared field value or compatibility extra stored under `key`.
165
+
166
+ Raises:
167
+ KeyError: If `key` is neither a declared field nor a stored extra.
168
+
160
169
  """
161
170
  # First, check declared model fields
162
171
  if key in self.__class__.model_fields:
@@ -172,9 +181,7 @@ class BaseNodeData(ABC, BaseModel):
172
181
  raise KeyError(key)
173
182
 
174
183
  def get(self, key: str, default: Any = None) -> Any:
175
- """
176
- Dict-style .get() without calling model_dump() on every lookup.
177
- """
184
+ """Dict-style .get() without calling model_dump() on every lookup."""
178
185
  if key in self.__class__.model_fields:
179
186
  return getattr(self, key)
180
187
 
@@ -1,16 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
3
+ from typing import TypedDict
4
4
 
5
5
  from pydantic import TypeAdapter, with_config
6
6
 
7
7
  from graphon.entities.base_node_data import BaseNodeData
8
8
 
9
- if sys.version_info >= (3, 12):
10
- from typing import TypedDict
11
- else:
12
- from typing_extensions import TypedDict
13
-
14
9
 
15
10
  @with_config(extra="allow")
16
11
  class NodeConfigDict(TypedDict):
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Mapping
2
2
  from enum import StrEnum, auto
3
- from typing import Annotated, Any, Literal, TypeAlias
3
+ from typing import Annotated, Any, Literal
4
4
 
5
5
  from pydantic import BaseModel, Field
6
6
 
@@ -45,6 +45,7 @@ class SchedulingPause(BaseModel):
45
45
  message: str
46
46
 
47
47
 
48
- PauseReason: TypeAlias = Annotated[
49
- HumanInputRequired | SchedulingPause, Field(discriminator="TYPE")
48
+ type PauseReason = Annotated[
49
+ HumanInputRequired | SchedulingPause,
50
+ Field(discriminator="TYPE"),
50
51
  ]
@@ -1,5 +1,4 @@
1
- """
2
- Domain entities for workflow execution.
1
+ """Domain entities for workflow execution.
3
2
 
4
3
  Models describe graph runtime state and avoid infrastructure-specific details.
5
4
  """
@@ -16,9 +15,7 @@ from graphon.enums import WorkflowExecutionStatus, WorkflowType
16
15
 
17
16
 
18
17
  class WorkflowExecution(BaseModel):
19
- """
20
- Domain model for a workflow execution within the graph runtime.
21
- """
18
+ """Domain model for a workflow execution within the graph runtime."""
22
19
 
23
20
  id_: str = Field(...)
24
21
  workflow_id: str = Field(...)
@@ -40,8 +37,7 @@ class WorkflowExecution(BaseModel):
40
37
 
41
38
  @property
42
39
  def elapsed_time(self) -> float:
43
- """
44
- Calculate elapsed time in seconds.
40
+ """Calculate elapsed time in seconds.
45
41
  If workflow is not finished, use current time.
46
42
  """
47
43
  end_time = self.finished_at or datetime.now(UTC).replace(tzinfo=None)
@@ -1,5 +1,4 @@
1
- """
2
- Domain entities for workflow node execution.
1
+ """Domain entities for workflow node execution.
3
2
 
4
3
  These models capture node-level execution state for the graph runtime without
5
4
  describing storage or application-layer concerns.
@@ -19,8 +18,7 @@ from graphon.enums import (
19
18
 
20
19
 
21
20
  class WorkflowNodeExecution(BaseModel):
22
- """
23
- Domain model for workflow node execution.
21
+ """Domain model for workflow node execution.
24
22
 
25
23
  This model represents the graph-level record of a node execution and
26
24
  contains only execution state relevant to the runtime.
@@ -89,15 +87,22 @@ class WorkflowNodeExecution(BaseModel):
89
87
  def get_truncated_process_data(self) -> Mapping[str, Any] | None:
90
88
  return self._truncated_process_data
91
89
 
92
- def set_truncated_inputs(self, truncated_inputs: Mapping[str, Any] | None):
90
+ def set_truncated_inputs(
91
+ self,
92
+ truncated_inputs: Mapping[str, Any] | None,
93
+ ) -> None:
93
94
  self._truncated_inputs = truncated_inputs
94
95
 
95
- def set_truncated_outputs(self, truncated_outputs: Mapping[str, Any] | None):
96
+ def set_truncated_outputs(
97
+ self,
98
+ truncated_outputs: Mapping[str, Any] | None,
99
+ ) -> None:
96
100
  self._truncated_outputs = truncated_outputs
97
101
 
98
102
  def set_truncated_process_data(
99
- self, truncated_process_data: Mapping[str, Any] | None
100
- ):
103
+ self,
104
+ truncated_process_data: Mapping[str, Any] | None,
105
+ ) -> None:
101
106
  self._truncated_process_data = truncated_process_data
102
107
 
103
108
  def get_response_inputs(self) -> Mapping[str, Any] | None:
@@ -107,15 +112,15 @@ class WorkflowNodeExecution(BaseModel):
107
112
  return self.inputs
108
113
 
109
114
  @property
110
- def inputs_truncated(self):
115
+ def inputs_truncated(self) -> bool:
111
116
  return self._truncated_inputs is not None
112
117
 
113
118
  @property
114
- def outputs_truncated(self):
119
+ def outputs_truncated(self) -> bool:
115
120
  return self._truncated_outputs is not None
116
121
 
117
122
  @property
118
- def process_data_truncated(self):
123
+ def process_data_truncated(self) -> bool:
119
124
  return self._truncated_process_data is not None
120
125
 
121
126
  def get_response_outputs(self) -> Mapping[str, Any] | None:
@@ -136,15 +141,15 @@ class WorkflowNodeExecution(BaseModel):
136
141
  process_data: Mapping[str, Any] | None = None,
137
142
  outputs: Mapping[str, Any] | None = None,
138
143
  metadata: Mapping[WorkflowNodeExecutionMetadataKey, Any] | None = None,
139
- ):
140
- """
141
- Update the model from mappings.
144
+ ) -> None:
145
+ """Update the model from mappings.
142
146
 
143
147
  Args:
144
148
  inputs: The inputs to update
145
149
  process_data: The process data to update
146
150
  outputs: The outputs to update
147
151
  metadata: The metadata to update
152
+
148
153
  """
149
154
  if inputs is not None:
150
155
  self.inputs = dict(inputs)