hgraph 0.3.26__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.
- hgraph-0.3.26/LICENSE +21 -0
- hgraph-0.3.26/PKG-INFO +116 -0
- hgraph-0.3.26/README.md +74 -0
- hgraph-0.3.26/pyproject.toml +143 -0
- hgraph-0.3.26/src/hgraph/__init__.py +7 -0
- hgraph-0.3.26/src/hgraph/_builder/__init__.py +7 -0
- hgraph-0.3.26/src/hgraph/_builder/_builder.py +28 -0
- hgraph-0.3.26/src/hgraph/_builder/_graph_builder.py +92 -0
- hgraph-0.3.26/src/hgraph/_builder/_input_builder.py +19 -0
- hgraph-0.3.26/src/hgraph/_builder/_node_builder.py +39 -0
- hgraph-0.3.26/src/hgraph/_builder/_output_builder.py +20 -0
- hgraph-0.3.26/src/hgraph/_builder/_scalar_builder.py +19 -0
- hgraph-0.3.26/src/hgraph/_builder/_ts_builder.py +241 -0
- hgraph-0.3.26/src/hgraph/_impl/__init__.py +5 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/__init__.py +7 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_component_builder.py +30 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_graph_builder.py +68 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_map_builder.py +34 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_mesh_builder.py +36 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_node_builder.py +127 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_node_impl_builder.py +30 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_reduce_builder.py +34 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_service_impl_builder.py +30 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_switch_builder.py +35 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_try_except_builder.py +34 -0
- hgraph-0.3.26/src/hgraph/_impl/_builder/_ts_builder.py +340 -0
- hgraph-0.3.26/src/hgraph/_impl/_impl_configuration.py +9 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/__init__.py +30 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_bool_operators.py +25 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/__init__.py +12 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_compound_scalar_conversion_operators.py +60 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_conversion_operator_util.py +17 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_date_time_conversion_operators.py +40 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_general_conversion_operators.py +19 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_mapping_conversion_operators.py +147 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_set_conversion_operators.py +97 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_ts_conversion_operators.py +75 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_tsb_conversion_operators.py +91 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_tsd_conversion_operators.py +239 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_tsl_conversion_operators.py +83 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_tss_conversion_operators.py +134 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_conversion_operators/_tuple_conversion_operators.py +130 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_date_time_operators.py +211 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_enum_operators.py +112 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_flow_control.py +381 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_frame_operators.py +39 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_frozendict_operators.py +250 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_frozenset_operators.py +78 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_getattr.py +12 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_graph_operators.py +187 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_number_operators.py +226 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_record_replay_in_memory.py +219 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_scalar_operators.py +505 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_series_operators.py +115 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_set_operators.py +81 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_str_operators.py +174 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_stream_analytical_operators.py +73 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_stream_operators.py +406 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_time_series_conversion.py +30 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_time_series_properties.py +66 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_to_json.py +163 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_to_table_dispatch_impl.py +253 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_to_table_impl.py +78 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_tsb_operators.py +312 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_tsd_operators.py +638 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_tsl_operators.py +387 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_tss_operators.py +210 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_tuple_operators.py +133 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_type.py +15 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_type_operators.py +32 -0
- hgraph-0.3.26/src/hgraph/_impl/_operators/_zero.py +40 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/__init__.py +13 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_common.py +39 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_component_node.py +132 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_data_writer.py +25 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_evaluation_clock.py +198 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_evaluation_engine.py +136 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_graph.py +266 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_graph_executor.py +77 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_graph_recorder.py +70 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_map_node.py +186 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_mesh_node.py +263 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_nested_evaluation_engine.py +101 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_node.py +589 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_reduce_node.py +267 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_service_node_impl.py +54 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_switch_node.py +130 -0
- hgraph-0.3.26/src/hgraph/_impl/_runtime/_try_except_node.py +86 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/__init__.py +11 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_feature_extension.py +60 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_input.py +206 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_output.py +96 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_ref.py +315 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_scalar_value.py +49 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_signal.py +67 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_ts.py +79 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_tsb.py +207 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_tsd.py +477 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_tsl.py +199 -0
- hgraph-0.3.26/src/hgraph/_impl/_types/_tss.py +291 -0
- hgraph-0.3.26/src/hgraph/_impl/graph_construction.md +40 -0
- hgraph-0.3.26/src/hgraph/_operators/__init__.py +13 -0
- hgraph-0.3.26/src/hgraph/_operators/_analytical_operators.py +46 -0
- hgraph-0.3.26/src/hgraph/_operators/_flow_control.py +91 -0
- hgraph-0.3.26/src/hgraph/_operators/_graph_operators.py +107 -0
- hgraph-0.3.26/src/hgraph/_operators/_operators.py +790 -0
- hgraph-0.3.26/src/hgraph/_operators/_record_replay.py +152 -0
- hgraph-0.3.26/src/hgraph/_operators/_stream.py +159 -0
- hgraph-0.3.26/src/hgraph/_operators/_string.py +70 -0
- hgraph-0.3.26/src/hgraph/_operators/_time_series_conversion.py +82 -0
- hgraph-0.3.26/src/hgraph/_operators/_time_series_properties.py +37 -0
- hgraph-0.3.26/src/hgraph/_operators/_to_json.py +48 -0
- hgraph-0.3.26/src/hgraph/_operators/_to_table.py +228 -0
- hgraph-0.3.26/src/hgraph/_operators/_tsd_and_mapping.py +86 -0
- hgraph-0.3.26/src/hgraph/_operators/_type_operators.py +28 -0
- hgraph-0.3.26/src/hgraph/_runtime/__init__.py +13 -0
- hgraph-0.3.26/src/hgraph/_runtime/_constants.py +10 -0
- hgraph-0.3.26/src/hgraph/_runtime/_data_writer.py +117 -0
- hgraph-0.3.26/src/hgraph/_runtime/_delayed_binding.py +68 -0
- hgraph-0.3.26/src/hgraph/_runtime/_evaluation_clock.py +168 -0
- hgraph-0.3.26/src/hgraph/_runtime/_evaluation_engine.py +368 -0
- hgraph-0.3.26/src/hgraph/_runtime/_feedback.py +69 -0
- hgraph-0.3.26/src/hgraph/_runtime/_global_state.py +123 -0
- hgraph-0.3.26/src/hgraph/_runtime/_graph.py +100 -0
- hgraph-0.3.26/src/hgraph/_runtime/_graph_executor.py +95 -0
- hgraph-0.3.26/src/hgraph/_runtime/_graph_recorder.py +49 -0
- hgraph-0.3.26/src/hgraph/_runtime/_graph_runner.py +248 -0
- hgraph-0.3.26/src/hgraph/_runtime/_lifecycle.py +150 -0
- hgraph-0.3.26/src/hgraph/_runtime/_node.py +438 -0
- hgraph-0.3.26/src/hgraph/_runtime/_traits.py +32 -0
- hgraph-0.3.26/src/hgraph/_types/__init__.py +26 -0
- hgraph-0.3.26/src/hgraph/_types/_context_meta_data.py +130 -0
- hgraph-0.3.26/src/hgraph/_types/_context_type.py +28 -0
- hgraph-0.3.26/src/hgraph/_types/_error_type.py +131 -0
- hgraph-0.3.26/src/hgraph/_types/_frame_scalar_type_meta_data.py +158 -0
- hgraph-0.3.26/src/hgraph/_types/_generic_rank_util.py +39 -0
- hgraph-0.3.26/src/hgraph/_types/_recordable_state.py +79 -0
- hgraph-0.3.26/src/hgraph/_types/_ref_meta_data.py +122 -0
- hgraph-0.3.26/src/hgraph/_types/_ref_type.py +70 -0
- hgraph-0.3.26/src/hgraph/_types/_scalar_type_meta_data.py +1176 -0
- hgraph-0.3.26/src/hgraph/_types/_scalar_types.py +386 -0
- hgraph-0.3.26/src/hgraph/_types/_scalar_value.py +82 -0
- hgraph-0.3.26/src/hgraph/_types/_schema_type.py +291 -0
- hgraph-0.3.26/src/hgraph/_types/_time_series_meta_data.py +89 -0
- hgraph-0.3.26/src/hgraph/_types/_time_series_types.py +455 -0
- hgraph-0.3.26/src/hgraph/_types/_ts_meta_data.py +114 -0
- hgraph-0.3.26/src/hgraph/_types/_ts_signal_meta_data.py +58 -0
- hgraph-0.3.26/src/hgraph/_types/_ts_type.py +40 -0
- hgraph-0.3.26/src/hgraph/_types/_ts_type_var_meta_data.py +143 -0
- hgraph-0.3.26/src/hgraph/_types/_tsb_meta_data.py +275 -0
- hgraph-0.3.26/src/hgraph/_types/_tsb_type.py +667 -0
- hgraph-0.3.26/src/hgraph/_types/_tsd_meta_data.py +158 -0
- hgraph-0.3.26/src/hgraph/_types/_tsd_type.py +276 -0
- hgraph-0.3.26/src/hgraph/_types/_tsl_meta_data.py +177 -0
- hgraph-0.3.26/src/hgraph/_types/_tsl_type.py +253 -0
- hgraph-0.3.26/src/hgraph/_types/_tss_meta_data.py +104 -0
- hgraph-0.3.26/src/hgraph/_types/_tss_type.py +128 -0
- hgraph-0.3.26/src/hgraph/_types/_type_meta_data.py +231 -0
- hgraph-0.3.26/src/hgraph/_types/_typing_utils.py +105 -0
- hgraph-0.3.26/src/hgraph/_wiring/__init__.py +20 -0
- hgraph-0.3.26/src/hgraph/_wiring/_context_wiring.py +227 -0
- hgraph-0.3.26/src/hgraph/_wiring/_decorators.py +1068 -0
- hgraph-0.3.26/src/hgraph/_wiring/_dispatch.py +230 -0
- hgraph-0.3.26/src/hgraph/_wiring/_exception_handling.py +180 -0
- hgraph-0.3.26/src/hgraph/_wiring/_graph_builder.py +157 -0
- hgraph-0.3.26/src/hgraph/_wiring/_helper_functions.py +51 -0
- hgraph-0.3.26/src/hgraph/_wiring/_map.py +692 -0
- hgraph-0.3.26/src/hgraph/_wiring/_mesh.py +250 -0
- hgraph-0.3.26/src/hgraph/_wiring/_reduce.py +177 -0
- hgraph-0.3.26/src/hgraph/_wiring/_source_code_details.py +17 -0
- hgraph-0.3.26/src/hgraph/_wiring/_stub_wiring_node.py +125 -0
- hgraph-0.3.26/src/hgraph/_wiring/_switch.py +311 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_context.py +82 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_errors.py +189 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/__init__.py +19 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_adaptor_impl_node_class.py +130 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_adaptor_node_class.py +149 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_component_node_class.py +162 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_graph_wiring_node_class.py +489 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_map_wiring_node.py +113 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_mesh_wiring_node.py +47 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_node_impl_wiring_node_class.py +51 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_operator_wiring_node.py +226 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_pull_source_node_class.py +66 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_python_const_wiring_node_class.py +49 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_python_wiring_node_classes.py +118 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_reduce_wiring_node.py +60 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_reference_service_node_class.py +115 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_req_repl_service_node_service.py +104 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_service_adaptor_impl_node_class.py +114 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_service_adaptor_node_class.py +180 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_service_impl_node_class.py +400 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_service_interface_node_class.py +41 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_stub_wiring_node_class.py +39 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_subscription_service_node_service.py +104 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_switch_wiring_node.py +74 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_try_except_wiring_node.py +54 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_class/_wiring_node_class.py +557 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_instance.py +221 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_node_signature.py +732 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_observer.py +95 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_port.py +393 -0
- hgraph-0.3.26/src/hgraph/_wiring/_wiring_utils.py +151 -0
- hgraph-0.3.26/src/hgraph/adaptors/__init__.py +0 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/__init__.py +5 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/_data_frame_operators.py +97 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/_data_frame_record_replay.py +340 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/_data_frame_source.py +204 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/_data_source_generators.py +433 -0
- hgraph-0.3.26/src/hgraph/adaptors/data_frame/_to_data_frame_converters.py +303 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/__init__.py +11 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/_perspective.py +495 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/_perspective_adaptor.py +117 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/_perspetive_publish.py +258 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/index_template.html +120 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/table_template.html +39 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/table_workarounds.js +210 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/workspace_tables.js +71 -0
- hgraph-0.3.26/src/hgraph/adaptors/perspective/workspace_template.html +63 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/__init__.py +2 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/_rest_client.py +94 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/_rest_handler.py +445 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/_tornado_web.py +86 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/http_client_adaptor.py +84 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/http_server_adaptor.py +409 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/websocket_client_adaptor.py +76 -0
- hgraph-0.3.26/src/hgraph/adaptors/tornado/websocket_server_adaptor.py +264 -0
- hgraph-0.3.26/src/hgraph/debug/__init__.py +2 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector.py +132 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_handler.py +475 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_http_handler.py +32 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_item_id.py +397 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_observer.py +150 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_publish.py +147 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_state.py +35 -0
- hgraph-0.3.26/src/hgraph/debug/_inspector_util.py +360 -0
- hgraph-0.3.26/src/hgraph/debug/_trace_controller.py +100 -0
- hgraph-0.3.26/src/hgraph/debug/frame_template.html +46 -0
- hgraph-0.3.26/src/hgraph/debug/inspector_template.html +356 -0
- hgraph-0.3.26/src/hgraph/nodes/__init__.py +8 -0
- hgraph-0.3.26/src/hgraph/nodes/_analytical.py +13 -0
- hgraph-0.3.26/src/hgraph/nodes/_graph.py +10 -0
- hgraph-0.3.26/src/hgraph/nodes/_mesh_util.py +68 -0
- hgraph-0.3.26/src/hgraph/nodes/_numpy.py +121 -0
- hgraph-0.3.26/src/hgraph/nodes/_pass_through.py +10 -0
- hgraph-0.3.26/src/hgraph/nodes/_service_utils.py +261 -0
- hgraph-0.3.26/src/hgraph/nodes/_tsd_operators.py +84 -0
- hgraph-0.3.26/src/hgraph/nodes/_tsl_operators.py +36 -0
- hgraph-0.3.26/src/hgraph/nodes/_window_operators.py +60 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/__init__.py +4 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/_polars_recorder_api_impl.py +203 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/_recordable_converters.py +189 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/_recordable_feedback.py +158 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/_recorder_api.py +215 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/_ts_to_data_frame.py +86 -0
- hgraph-0.3.26/src/hgraph/nodes/analytics/analytics.md +14 -0
- hgraph-0.3.26/src/hgraph/notebook/NoteBook.md +35 -0
- hgraph-0.3.26/src/hgraph/notebook/__init__.py +1 -0
- hgraph-0.3.26/src/hgraph/notebook/_notebook_graph.py +62 -0
- hgraph-0.3.26/src/hgraph/test/__init__.py +4 -0
- hgraph-0.3.26/src/hgraph/test/_node_printer.py +207 -0
- hgraph-0.3.26/src/hgraph/test/_node_profiler.py +151 -0
- hgraph-0.3.26/src/hgraph/test/_node_unit_tester.py +205 -0
- hgraph-0.3.26/src/hgraph/test/_wiring_tracer.py +71 -0
- hgraph-0.3.26/src/hgraph/test/testing.md +19 -0
hgraph-0.3.26/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Howard Henson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
hgraph-0.3.26/PKG-INFO
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hgraph
|
|
3
|
+
Version: 0.3.26
|
|
4
|
+
Summary: A functional reactive platform used to process time-series streams. Provides support for backtest (simulation) and realtime time-series processing. Using a forward propagation graph with a microtask scheduler for the runtime engine.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: reactive,graph,fpg,forward propogating graph,time series,functional reactive programming,frp,functional,time-series
|
|
7
|
+
Author: Howard Henson
|
|
8
|
+
Author-email: howard@henson.me.uk
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
+
Provides-Extra: web
|
|
19
|
+
Requires-Dist: duckdb
|
|
20
|
+
Requires-Dist: frozendict (>=2.3.10)
|
|
21
|
+
Requires-Dist: multimethod
|
|
22
|
+
Requires-Dist: numpy (>=1.23)
|
|
23
|
+
Requires-Dist: ordered-set (>=4.1.0)
|
|
24
|
+
Requires-Dist: perspective-python (<3.0.0) ; extra == "web"
|
|
25
|
+
Requires-Dist: polars (>=1.0)
|
|
26
|
+
Requires-Dist: pyarrow (>=16.1.0)
|
|
27
|
+
Requires-Dist: requests ; extra == "web"
|
|
28
|
+
Requires-Dist: sortedcontainers (>=2.4.0)
|
|
29
|
+
Requires-Dist: sphinx (>=7.4)
|
|
30
|
+
Requires-Dist: sphinx-autodoc-typehints (>=2.3.0)
|
|
31
|
+
Requires-Dist: sphinx_rtd_theme (>=2.0.0)
|
|
32
|
+
Requires-Dist: sphinxcontrib-plantuml (>=0.30)
|
|
33
|
+
Requires-Dist: sqlalchemy
|
|
34
|
+
Requires-Dist: tornado ; extra == "web"
|
|
35
|
+
Project-URL: Changelog, https://github.com/hhenson/hgraph/blob/main/CHANGELOG.md
|
|
36
|
+
Project-URL: Documentation, https://github.com/hhenson/hgraph/blob/main/docs/index.md
|
|
37
|
+
Project-URL: Homepage, https://github.com/hhenson/hgraph
|
|
38
|
+
Project-URL: Issues, https://github.com/hhenson/hgraph/blob/main/ISSUES.md
|
|
39
|
+
Project-URL: Repository, https://github.com/hhenson/hgraph.git
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# hgraph
|
|
43
|
+
A functional reactive programming engine with a Python front-end.
|
|
44
|
+
|
|
45
|
+
This provides a DSL and runtime to support the computation of results over time, featuring
|
|
46
|
+
a graph based directed acyclic dependency graph and the concept of time-series properties.
|
|
47
|
+
The language is function-based, and promotes composition to extend behaviour.
|
|
48
|
+
|
|
49
|
+
Here is a simple example:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from hgraph import graph, run_graph, const
|
|
53
|
+
from hgraph.nodes import debug_print
|
|
54
|
+
|
|
55
|
+
@graph
|
|
56
|
+
def main():
|
|
57
|
+
a = const(1)
|
|
58
|
+
c = a + 2
|
|
59
|
+
debug_print("a + 2", c)
|
|
60
|
+
|
|
61
|
+
run_graph(main)
|
|
62
|
+
```
|
|
63
|
+
Results in:
|
|
64
|
+
```
|
|
65
|
+
[1970-01-01 00:00:00.000385][1970-01-01 00:00:00.000001] a + 2: 3
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
See [this](https://hgraph.readthedocs.io/en/latest/) for more information.
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
The project is currently configured to make use of [Poetry](https://python-poetry.org) for dependency management.
|
|
73
|
+
Take a look at the website to see how best to install the tool.
|
|
74
|
+
|
|
75
|
+
Here are some useful commands:
|
|
76
|
+
|
|
77
|
+
First, this will cause the virtual environment to be installed in the same folder as the project (in .venv folder)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
poetry config virtualenvs.in-project true
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use this command to set the version of Python to make use of if you want a specific version of Python.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
poetry env use 3.11
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Then use the following command to install the project and its dependencies. Note that the ``--with docs`` installs
|
|
90
|
+
the dependencies to build the documentation set which is not required otherwise, also the ``--all-extras`` is only
|
|
91
|
+
required for the adaptors.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
poetry install --with docs --all-extras
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If you did not use the first command, you can find the location of the installation using:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
poetry env info
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
PyCharm can make use of poetry to ``setup`` the project.
|
|
104
|
+
|
|
105
|
+
### Run Tests
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# No Coverage
|
|
109
|
+
poetry run pytest
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Generate Coverage Report
|
|
114
|
+
poetry run pytest --cov=your_package_name --cov-report=xml
|
|
115
|
+
```
|
|
116
|
+
|
hgraph-0.3.26/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# hgraph
|
|
2
|
+
A functional reactive programming engine with a Python front-end.
|
|
3
|
+
|
|
4
|
+
This provides a DSL and runtime to support the computation of results over time, featuring
|
|
5
|
+
a graph based directed acyclic dependency graph and the concept of time-series properties.
|
|
6
|
+
The language is function-based, and promotes composition to extend behaviour.
|
|
7
|
+
|
|
8
|
+
Here is a simple example:
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
from hgraph import graph, run_graph, const
|
|
12
|
+
from hgraph.nodes import debug_print
|
|
13
|
+
|
|
14
|
+
@graph
|
|
15
|
+
def main():
|
|
16
|
+
a = const(1)
|
|
17
|
+
c = a + 2
|
|
18
|
+
debug_print("a + 2", c)
|
|
19
|
+
|
|
20
|
+
run_graph(main)
|
|
21
|
+
```
|
|
22
|
+
Results in:
|
|
23
|
+
```
|
|
24
|
+
[1970-01-01 00:00:00.000385][1970-01-01 00:00:00.000001] a + 2: 3
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
See [this](https://hgraph.readthedocs.io/en/latest/) for more information.
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
The project is currently configured to make use of [Poetry](https://python-poetry.org) for dependency management.
|
|
32
|
+
Take a look at the website to see how best to install the tool.
|
|
33
|
+
|
|
34
|
+
Here are some useful commands:
|
|
35
|
+
|
|
36
|
+
First, this will cause the virtual environment to be installed in the same folder as the project (in .venv folder)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
poetry config virtualenvs.in-project true
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use this command to set the version of Python to make use of if you want a specific version of Python.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
poetry env use 3.11
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then use the following command to install the project and its dependencies. Note that the ``--with docs`` installs
|
|
49
|
+
the dependencies to build the documentation set which is not required otherwise, also the ``--all-extras`` is only
|
|
50
|
+
required for the adaptors.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
poetry install --with docs --all-extras
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If you did not use the first command, you can find the location of the installation using:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
poetry env info
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
PyCharm can make use of poetry to ``setup`` the project.
|
|
63
|
+
|
|
64
|
+
### Run Tests
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# No Coverage
|
|
68
|
+
poetry run pytest
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Generate Coverage Report
|
|
73
|
+
poetry run pytest --cov=your_package_name --cov-report=xml
|
|
74
|
+
```
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "hgraph"
|
|
3
|
+
version = "0.3.26"
|
|
4
|
+
description = """ \
|
|
5
|
+
A functional reactive platform used to process time-series streams. \
|
|
6
|
+
Provides support for backtest (simulation) and realtime time-series processing. \
|
|
7
|
+
Using a forward propagation graph with a microtask scheduler for the runtime engine. \
|
|
8
|
+
"""
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
"Howard Henson <howard@henson.me.uk>",
|
|
13
|
+
"Alexander Balabin <balabin@me.com>",
|
|
14
|
+
"Simon Young <whepstead@gmail.com>",
|
|
15
|
+
"Tope Olukemi <tolukemi@gmail.com>"
|
|
16
|
+
]
|
|
17
|
+
keywords = [
|
|
18
|
+
"reactive", "graph", "fpg", "forward propogating graph",
|
|
19
|
+
"time series", "functional reactive programming",
|
|
20
|
+
"frp", "functional", "time-series"
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 3 - Alpha",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
28
|
+
]
|
|
29
|
+
packages = [
|
|
30
|
+
{ include = "hgraph", from = "src" },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[tool.poetry.dependencies]
|
|
34
|
+
python = ">=3.11"
|
|
35
|
+
frozendict = ">=2.3.10"
|
|
36
|
+
sortedcontainers = ">=2.4.0"
|
|
37
|
+
ordered-set = ">=4.1.0"
|
|
38
|
+
numpy = ">=1.23"
|
|
39
|
+
polars = ">=1.0"
|
|
40
|
+
sqlalchemy = "*"
|
|
41
|
+
duckdb = "*"
|
|
42
|
+
pyarrow = ">=16.1.0"
|
|
43
|
+
multimethod = "*"
|
|
44
|
+
tornado = { version = "*", optional = true }
|
|
45
|
+
perspective-python = {version = "<3.0.0", optional=true}
|
|
46
|
+
requests = { version = "*", optional = true }
|
|
47
|
+
sphinx = { version = ">=7.4", optional = true }
|
|
48
|
+
sphinx_rtd_theme = { version = ">=2.0.0", optional = true }
|
|
49
|
+
sphinx-autodoc-typehints = { version = ">=2.3.0", optional = true }
|
|
50
|
+
sphinxcontrib-plantuml = { version = ">=0.30", optional = true }
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
[tool.poetry.extras]
|
|
54
|
+
web = [
|
|
55
|
+
"perspective-python",
|
|
56
|
+
"tornado",
|
|
57
|
+
"requests"
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[tool.poetry.group.docs]
|
|
61
|
+
optional = true
|
|
62
|
+
|
|
63
|
+
[tool.poetry.group.docs.dependencies]
|
|
64
|
+
sphinx = "*"
|
|
65
|
+
sphinx_rtd_theme = "*"
|
|
66
|
+
sphinx-autodoc-typehints = "*"
|
|
67
|
+
sphinxcontrib-plantuml = "*"
|
|
68
|
+
|
|
69
|
+
[tool.poetry.urls]
|
|
70
|
+
Homepage = "https://github.com/hhenson/hgraph"
|
|
71
|
+
Documentation = "https://github.com/hhenson/hgraph/blob/main/docs/index.md"
|
|
72
|
+
Repository = "https://github.com/hhenson/hgraph.git"
|
|
73
|
+
Issues = "https://github.com/hhenson/hgraph/blob/main/ISSUES.md"
|
|
74
|
+
Changelog = "https://github.com/hhenson/hgraph/blob/main/CHANGELOG.md"
|
|
75
|
+
|
|
76
|
+
[build-system]
|
|
77
|
+
requires = ["poetry-core"]
|
|
78
|
+
build-backend = "poetry.core.masonry.api"
|
|
79
|
+
|
|
80
|
+
[tool.poetry.group.test.dependencies]
|
|
81
|
+
pytest = "*"
|
|
82
|
+
mypy = "*"
|
|
83
|
+
pytest-cov = "*"
|
|
84
|
+
coverage = "*"
|
|
85
|
+
pytest-xdist = "*"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Configure pytest
|
|
89
|
+
[tool.pytest.ini_options]
|
|
90
|
+
minversion = "7.4.3"
|
|
91
|
+
addopts = "-n auto -ra -q --dist=loadscope" # " --cov=hgraph --cov-report=term-missing --cov-report=xml"
|
|
92
|
+
testpaths = [
|
|
93
|
+
"tests",
|
|
94
|
+
]
|
|
95
|
+
markers = [
|
|
96
|
+
"serial: mark test to run serially (not in parallel with xdist)",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
# Configure coverage
|
|
100
|
+
[tool.coverage.run]
|
|
101
|
+
source_pkgs = ["hgraph",]
|
|
102
|
+
branch = true
|
|
103
|
+
parallel = true
|
|
104
|
+
omit = [
|
|
105
|
+
"tests/*",
|
|
106
|
+
"examples/*",
|
|
107
|
+
"docs/*",
|
|
108
|
+
"src/hgraph/notebook/*",
|
|
109
|
+
"src/hgraph/debug/*"
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.coverage.paths]
|
|
113
|
+
hg = ["src/hgraph",]
|
|
114
|
+
tests = ["tests",]
|
|
115
|
+
|
|
116
|
+
[tool.coverage.report]
|
|
117
|
+
fail_under = 80
|
|
118
|
+
exclude_lines = [
|
|
119
|
+
"no cov",
|
|
120
|
+
"if __name__ == .__main__.:",
|
|
121
|
+
"if TYPE_CHECKING:",
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
[tool.black]
|
|
125
|
+
line-length = 120
|
|
126
|
+
target-version = ['py311']
|
|
127
|
+
unstable = true
|
|
128
|
+
include = '\.pyi?$'
|
|
129
|
+
# 'extend-exclude' excludes files or directories in addition to the defaults
|
|
130
|
+
extend-exclude = '''
|
|
131
|
+
# A regex preceded with ^/ will apply only to files and directories
|
|
132
|
+
# in the root of the project.
|
|
133
|
+
(
|
|
134
|
+
^/foo.py # exclude a file named foo.py in the root of the project
|
|
135
|
+
| .*_pb2.py # exclude autogenerated Protocol Buffer files anywhere in the project
|
|
136
|
+
)
|
|
137
|
+
'''
|
|
138
|
+
|
|
139
|
+
[tool.mypy]
|
|
140
|
+
files = ["src",]
|
|
141
|
+
|
|
142
|
+
[tool.poetry.scripts]
|
|
143
|
+
build-docs = "sphinx.cmd.build:main"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from hgraph._builder._builder import *
|
|
2
|
+
from hgraph._builder._graph_builder import *
|
|
3
|
+
from hgraph._builder._input_builder import *
|
|
4
|
+
from hgraph._builder._node_builder import *
|
|
5
|
+
from hgraph._builder._output_builder import *
|
|
6
|
+
from hgraph._builder._scalar_builder import *
|
|
7
|
+
from hgraph._builder._ts_builder import *
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import TypeVar, Generic
|
|
3
|
+
|
|
4
|
+
ITEM = TypeVar("ITEM")
|
|
5
|
+
|
|
6
|
+
__all__ = ("Builder",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Builder(ABC, Generic[ITEM]):
|
|
10
|
+
"""
|
|
11
|
+
The builder is responsible for constructing and initialising the item type it is responsible for.
|
|
12
|
+
It is also responsible for destroying and cleaning up the resources associated to the item.
|
|
13
|
+
These can be thought of as life-cycle methods.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def make_instance(self, **kwargs) -> ITEM:
|
|
18
|
+
"""
|
|
19
|
+
Create a new instance of the item.
|
|
20
|
+
And additional attributes required for construction are passed in as kwargs.
|
|
21
|
+
Actual instance of the builder will fix these args for all instances of builder for the type.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def release_instance(self, item: ITEM):
|
|
26
|
+
"""
|
|
27
|
+
Release the item and it's resources.
|
|
28
|
+
"""
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
from abc import abstractmethod
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Iterable
|
|
5
|
+
|
|
6
|
+
from hgraph._builder._builder import Builder
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from hgraph._runtime._graph import Graph
|
|
10
|
+
from hgraph._runtime._node import Node
|
|
11
|
+
from hgraph._builder._node_builder import NodeBuilder
|
|
12
|
+
from hgraph._types._scalar_types import SCALAR
|
|
13
|
+
|
|
14
|
+
__all__ = ("Edge", "GraphBuilder", "GraphBuilderFactory")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True)
|
|
18
|
+
class Edge:
|
|
19
|
+
src_node: int
|
|
20
|
+
output_path: tuple["SCALAR", ...]
|
|
21
|
+
dst_node: int
|
|
22
|
+
input_path: tuple["SCALAR", ...]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class GraphBuilder(Builder["Graph"]):
|
|
27
|
+
node_builders: tuple["NodeBuilder", ...]
|
|
28
|
+
edges: tuple[Edge, ...]
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def make_instance(self, graph_id: tuple[int, ...], parent_node: "Node" = None, label: str = None) -> "Graph":
|
|
32
|
+
"""
|
|
33
|
+
Construct an instance of a graph. The id provided is the id for the graph instance to be constructed.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def make_and_connect_nodes(self, graph_id: tuple[int, ...], first_node_ndx: int) -> Iterable["Node"]:
|
|
38
|
+
"""
|
|
39
|
+
Make the nodes described in the node builders and connect the edges as described in the edges.
|
|
40
|
+
Return the iterable of newly constructed and wired nodes.
|
|
41
|
+
This can be used to feed into a new graph instance or to extend (or re-initialise) an existing graph.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def release_instance(self, item: "Graph"):
|
|
46
|
+
"""
|
|
47
|
+
Release resources constructed during the build process, plus the graph.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class GraphBuilderFactory:
|
|
52
|
+
|
|
53
|
+
_graph_builder_class: typing.Optional[typing.Type[GraphBuilder]] = None
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
def default():
|
|
57
|
+
from hgraph._impl._builder._graph_builder import PythonGraphBuilder
|
|
58
|
+
|
|
59
|
+
return PythonGraphBuilder
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
def is_declared() -> bool:
|
|
63
|
+
return GraphBuilderFactory._graph_builder_class is not None
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def declared() -> typing.Type[GraphBuilder]:
|
|
67
|
+
if GraphBuilderFactory._graph_builder_class is None:
|
|
68
|
+
raise RuntimeError("No graph builder type has been declared")
|
|
69
|
+
return GraphBuilderFactory._graph_builder_class
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def declare(cls: typing.Type[GraphBuilder]):
|
|
73
|
+
if GraphBuilderFactory._graph_builder_class is not None:
|
|
74
|
+
raise RuntimeError("A graph builder type has already been declared")
|
|
75
|
+
GraphBuilderFactory._graph_builder_class = cls
|
|
76
|
+
|
|
77
|
+
@staticmethod
|
|
78
|
+
def un_declare():
|
|
79
|
+
GraphBuilderFactory._graph_builder_class = None
|
|
80
|
+
|
|
81
|
+
@staticmethod
|
|
82
|
+
def make(node_builders: tuple["NodeBuilder", ...], edges: tuple[Edge, ...]) -> GraphBuilder:
|
|
83
|
+
"""
|
|
84
|
+
Make a graph builder instance. If no graph builder class is declared, the default builder will be used.
|
|
85
|
+
:param node_builders: The node builders to use
|
|
86
|
+
:param edges: The edges to use for binding the node outputs to inputs.
|
|
87
|
+
:return: The GraphBuilder instance.
|
|
88
|
+
"""
|
|
89
|
+
if GraphBuilderFactory.is_declared():
|
|
90
|
+
return GraphBuilderFactory.declared()(node_builders=node_builders, edges=edges)
|
|
91
|
+
else:
|
|
92
|
+
return GraphBuilderFactory.default()(node_builders=node_builders, edges=edges)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
|
|
3
|
+
from hgraph._builder._builder import Builder
|
|
4
|
+
|
|
5
|
+
if typing.TYPE_CHECKING:
|
|
6
|
+
from hgraph._types._time_series_types import TimeSeriesInput
|
|
7
|
+
from hgraph._runtime._node import Node
|
|
8
|
+
|
|
9
|
+
__all__ = ("InputBuilder",)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class InputBuilder(Builder["TimeSeriesInput"]):
|
|
13
|
+
|
|
14
|
+
def make_instance(self, owning_node: "Node" = None, owning_input: "TimeSeriesInput" = None) -> "TimeSeriesInput":
|
|
15
|
+
"""One of owning_node or owning_input must be defined."""
|
|
16
|
+
raise NotImplementedError()
|
|
17
|
+
|
|
18
|
+
def release_instance(self, item: "TimeSeriesInput"):
|
|
19
|
+
raise NotImplementedError()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional, Any, Mapping, TypeVar
|
|
4
|
+
|
|
5
|
+
from hgraph._builder._builder import Builder
|
|
6
|
+
from hgraph._builder._input_builder import InputBuilder
|
|
7
|
+
from hgraph._builder._output_builder import OutputBuilder
|
|
8
|
+
from hgraph._runtime._node import NodeSignature, Node
|
|
9
|
+
|
|
10
|
+
__all__ = ("NodeBuilder",)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
NODE = TypeVar("NODE", bound=Node)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class NodeBuilder(Builder[NODE]):
|
|
18
|
+
signature: NodeSignature
|
|
19
|
+
scalars: Mapping[str, Any]
|
|
20
|
+
input_builder: Optional[InputBuilder] = None
|
|
21
|
+
output_builder: Optional[OutputBuilder] = None
|
|
22
|
+
error_builder: Optional[OutputBuilder] = None
|
|
23
|
+
recordable_state_builder: Optional[OutputBuilder] = None
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def make_instance(self, owning_graph_id: tuple[int, ...], node_ndx) -> NODE:
|
|
27
|
+
"""
|
|
28
|
+
Construct an instance of a node. The id provided is the id for the node instance to be constructed.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def release_instance(self, item: NODE):
|
|
33
|
+
"""
|
|
34
|
+
Release any resources constructed during the build process, plus the node.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# TODO: Need to ensure that each type of NodeBuilder is described in the abstract and a factory is provided
|
|
39
|
+
# to provide instances of the builder to allow us to support multiple engines.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from hgraph._builder._builder import Builder
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from hgraph._runtime._node import Node
|
|
7
|
+
from hgraph._types._time_series_types import TimeSeriesOutput
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
__all__ = ("OutputBuilder",)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class OutputBuilder(Builder["TimeSeriesOutput"]):
|
|
14
|
+
|
|
15
|
+
def make_instance(self, owning_node: "Node" = None, owning_output: "TimeSeriesOutput" = None) -> "TimeSeriesOutput":
|
|
16
|
+
"""One of owning_node or owning_output must be defined."""
|
|
17
|
+
raise NotImplementedError()
|
|
18
|
+
|
|
19
|
+
def release_instance(self, item: "TimeSeriesOutput"):
|
|
20
|
+
raise NotImplementedError()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from hgraph._builder._builder import Builder
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from hgraph._types._scalar_value import ScalarValue
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__ = ("ScalarValueBuilder",)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ScalarValueBuilder(Builder["ScalarValue"]):
|
|
13
|
+
|
|
14
|
+
def make_instance(self) -> "ScalarValue":
|
|
15
|
+
"""A scalar value is a basic type"""
|
|
16
|
+
raise NotImplementedError()
|
|
17
|
+
|
|
18
|
+
def release_instance(self, item: "ScalarValue"):
|
|
19
|
+
raise NotImplementedError()
|