ezmsg 3.10.0b2__tar.gz → 3.10.0b4__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 (177) hide show
  1. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/PKG-INFO +3 -1
  2. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/pyproject.toml +10 -1
  3. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/backend.py +17 -8
  4. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/backendprocess.py +15 -1
  5. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/__init__.py +2 -0
  6. ezmsg-3.10.0b4/src/ezmsg/core/commands/inspect.py +156 -0
  7. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/graphmeta.py +6 -0
  8. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/settingsmeta.py +154 -2
  9. ezmsg-3.10.0b4/src/ezmsg/core/type_resolution.py +55 -0
  10. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/axisarray.py +17 -8
  11. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/modify.py +6 -6
  12. ezmsg-3.10.0b4/tests/conftest.py +40 -0
  13. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/test_axisarray.py +68 -15
  14. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/test_modify.py +13 -13
  15. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_attach.py +69 -27
  16. ezmsg-3.10.0b4/tests/test_hermetic_conftest.py +64 -0
  17. ezmsg-3.10.0b4/tests/test_inspect_command.py +133 -0
  18. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_run.py +19 -0
  19. ezmsg-3.10.0b4/tests/test_settings_json_schema.py +144 -0
  20. ezmsg-3.10.0b4/tests/test_stream_type_resolution.py +68 -0
  21. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.flake8 +0 -0
  22. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.git-blame-ignore-revs +0 -0
  23. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.github/workflows/ci.yml +0 -0
  24. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.github/workflows/docs.yml +0 -0
  25. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.github/workflows/publish.yml +0 -0
  26. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.gitignore +0 -0
  27. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/.pre-commit-config.yaml +0 -0
  28. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/LICENSE +0 -0
  29. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/README.md +0 -0
  30. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/Makefile +0 -0
  31. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/make.bat +0 -0
  32. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/cloning.png +0 -0
  33. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/ezmsg_logo.png +0 -0
  34. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/tutorial_graph.png +0 -0
  35. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/tutorial_graph_compact.png +0 -0
  36. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/tutorial_graphviz.png +0 -0
  37. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/tutorial_pipeline.png +0 -0
  38. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/_images/tutorial_system.png +0 -0
  39. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/_static/custom.css +0 -0
  40. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/conf.py +0 -0
  41. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/index.rst +0 -0
  42. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/axisarray-util-units.rst +0 -0
  43. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/axisarray.rst +0 -0
  44. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/components.rst +0 -0
  45. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/content-api.rst +0 -0
  46. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/entrypoint.rst +0 -0
  47. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/functiondecorators.rst +0 -0
  48. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/API/util-units.rst +0 -0
  49. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/docs/source/reference/content-reference.rst +0 -0
  50. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/.gitignore +0 -0
  51. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_attach.py +0 -0
  52. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_configs.py +0 -0
  53. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_count.py +0 -0
  54. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_generator.py +0 -0
  55. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_intro.py +0 -0
  56. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_leaky_subscriber.py +0 -0
  57. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_log_to_file.py +0 -0
  58. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_normalterm.py +0 -0
  59. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_stop.py +0 -0
  60. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/ezmsg_toy.py +0 -0
  61. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/profiling_tui.py +0 -0
  62. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/settings_tui.py +0 -0
  63. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/simple_async_publisher.py +0 -0
  64. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/simple_async_subscriber.py +0 -0
  65. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/simple_publisher.py +0 -0
  66. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/simple_subscriber.py +0 -0
  67. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/examples/topology_tui.py +0 -0
  68. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/scripts/perf_ab.py +0 -0
  69. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/__init__.py +0 -0
  70. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/__main__.py +0 -0
  71. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/addressable.py +0 -0
  72. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/backpressure.py +0 -0
  73. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/channelmanager.py +0 -0
  74. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/collection.py +0 -0
  75. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/command.py +0 -0
  76. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/common.py +0 -0
  77. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/dashboard.py +0 -0
  78. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/dashboard_cmd.py +0 -0
  79. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/graphviz.py +0 -0
  80. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/mermaid.py +0 -0
  81. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/serve.py +0 -0
  82. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/shutdown.py +0 -0
  83. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/commands/start.py +0 -0
  84. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/component.py +0 -0
  85. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/dag.py +0 -0
  86. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/graph_util.py +0 -0
  87. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/graphcontext.py +0 -0
  88. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/graphserver.py +0 -0
  89. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/logconfig.py +0 -0
  90. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/message.py +0 -0
  91. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/messagecache.py +0 -0
  92. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/messagechannel.py +0 -0
  93. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/messagemarshal.py +0 -0
  94. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/netprotocol.py +0 -0
  95. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/processclient.py +0 -0
  96. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/profiling.py +0 -0
  97. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/pubclient.py +0 -0
  98. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/relay.py +0 -0
  99. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/settings.py +0 -0
  100. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/shm.py +0 -0
  101. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/shm_grow_test_support.py +0 -0
  102. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/state.py +0 -0
  103. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/stream.py +0 -0
  104. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/subclient.py +0 -0
  105. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/sync.py +0 -0
  106. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/test.py +0 -0
  107. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/unit.py +0 -0
  108. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/core/util.py +0 -0
  109. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/__init__.py +0 -0
  110. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/debuglog.py +0 -0
  111. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/gen_to_unit.py +0 -0
  112. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/generator.py +0 -0
  113. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messagecodec.py +0 -0
  114. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messagegate.py +0 -0
  115. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messagelogger.py +0 -0
  116. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messagequeue.py +0 -0
  117. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messagereplay.py +0 -0
  118. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/__init__.py +0 -0
  119. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/chunker.py +0 -0
  120. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/key.py +0 -0
  121. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/messages/util.py +0 -0
  122. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/__init__.py +0 -0
  123. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/ab.py +0 -0
  124. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/analysis.py +0 -0
  125. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/command.py +0 -0
  126. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/envinfo.py +0 -0
  127. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/hotpath.py +0 -0
  128. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/impl.py +0 -0
  129. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/run.py +0 -0
  130. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/perf/util.py +0 -0
  131. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/profiler.py +0 -0
  132. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/rate.py +0 -0
  133. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/src/ezmsg/util/terminate.py +0 -0
  134. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/__init__.py +0 -0
  135. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/clean_shutdown_examples_runner.py +0 -0
  136. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/ez_test_utils.py +0 -0
  137. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/__init__.py +0 -0
  138. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/test_chunker.py +0 -0
  139. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/test_key.py +0 -0
  140. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/messages/test_replace.py +0 -0
  141. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/perf_sync_overhead.py +0 -0
  142. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/shm_resize_race_runner.py +0 -0
  143. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/shutdown_runner.py +0 -0
  144. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_addressable.py +0 -0
  145. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_channel.py +0 -0
  146. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_channelmanager.py +0 -0
  147. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_clean_shutdown.py +0 -0
  148. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_command.py +0 -0
  149. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_connections.py +0 -0
  150. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_dag.py +0 -0
  151. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_dashboard_commands.py +0 -0
  152. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_generator.py +0 -0
  153. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_graph.py +0 -0
  154. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_graph_session.py +0 -0
  155. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_graph_visualization.py +0 -0
  156. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_leaky_subscriber.py +0 -0
  157. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_logconfig.py +0 -0
  158. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_messagereplay.py +0 -0
  159. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_perf_ab.py +0 -0
  160. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_perf_analysis.py +0 -0
  161. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_perf_configs.py +0 -0
  162. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_perf_hotpath.py +0 -0
  163. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_process_control.py +0 -0
  164. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_process_routing.py +0 -0
  165. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_profiler.py +0 -0
  166. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_profiling_api.py +0 -0
  167. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_pubclient.py +0 -0
  168. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_settings_api.py +0 -0
  169. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_settingsmeta.py +0 -0
  170. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_shm.py +0 -0
  171. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_shm_grow.py +0 -0
  172. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_state.py +0 -0
  173. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_subclient.py +0 -0
  174. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_sync_api.py +0 -0
  175. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_test.py +0 -0
  176. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_topics.py +0 -0
  177. {ezmsg-3.10.0b2 → ezmsg-3.10.0b4}/tests/test_topology_api.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ezmsg
3
- Version: 3.10.0b2
3
+ Version: 3.10.0b4
4
4
  Summary: A simple DAG-based computation model
5
5
  Author-email: Griffin Milsap <griffin.milsap@gmail.com>, Preston Peranich <pperanich@gmail.com>, Chadwick Boulay <chadwick.boulay@gmail.com>
6
6
  License: MIT License
@@ -29,6 +29,8 @@ Provides-Extra: dashboard
29
29
  Requires-Dist: ezmsg-dashboard; (python_version >= '3.11') and extra == 'dashboard'
30
30
  Provides-Extra: perf
31
31
  Requires-Dist: xarray>=2025.6.1; extra == 'perf'
32
+ Provides-Extra: schema
33
+ Requires-Dist: pydantic>=2.7; extra == 'schema'
32
34
  Description-Content-Type: text/markdown
33
35
 
34
36
  # <img src="https://raw.githubusercontent.com/ezmsg-org/ezmsg/main/docs/source/_static/_images/ezmsg_logo.png" width="50" alt="ezmsg logo" /> ezmsg
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ezmsg"
3
- version = "3.10.0b2"
3
+ version = "3.10.0b4"
4
4
  description = "A simple DAG-based computation model"
5
5
  authors = [
6
6
  { name = "Griffin Milsap", email = "griffin.milsap@gmail.com" },
@@ -44,6 +44,9 @@ test = [
44
44
  "xarray>=2025.6.1",
45
45
  "psutil>=7.1.0",
46
46
  "pytest-benchmark>=5.2.3",
47
+ # Exercises the schema extra's pydantic-present paths; the absent paths
48
+ # are tested by stubbing the soft import out.
49
+ "pydantic>=2.7",
47
50
  ]
48
51
  docs = [
49
52
  {include-group = "axisarray"},
@@ -71,6 +74,12 @@ perf = [
71
74
  dashboard = [
72
75
  "ezmsg-dashboard; python_version >= '3.11'",
73
76
  ]
77
+ # Standard JSON Schema in settings metadata, and validation/coercion of
78
+ # dynamic settings field updates in the owning process. Without it, schema
79
+ # fields are None and field updates apply raw, exactly as before.
80
+ schema = [
81
+ "pydantic>=2.7",
82
+ ]
74
83
 
75
84
  [tool.pytest.ini_options]
76
85
  addopts = ["--import-mode=importlib"]
@@ -14,6 +14,7 @@ from multiprocessing.synchronize import Event as EventType
14
14
  from multiprocessing.synchronize import Barrier as BarrierType
15
15
  from multiprocessing.connection import wait, Connection
16
16
  from socket import socket
17
+ from typing import get_origin
17
18
 
18
19
  from .netprotocol import DEFAULT_SHM_SIZE, AddressType
19
20
 
@@ -31,6 +32,7 @@ from .stream import (
31
32
  OutputRelay,
32
33
  )
33
34
  from .unit import Unit, PROCESS_ATTR, SUBSCRIBES_ATTR, PUBLISHES_ATTR
35
+ from .type_resolution import resolve_stream_type
34
36
  from .settings import Settings
35
37
  from .graphmeta import (
36
38
  CollectionMetadata,
@@ -391,7 +393,9 @@ class GraphRunner:
391
393
  return f"{tp.__module__}.{tp.__qualname__}"
392
394
 
393
395
  def _stream_type_name(self, stream_type: object) -> str:
394
- if inspect.isclass(stream_type):
396
+ # Python 3.10 considers GenericAlias objects (e.g. list[int]) classes.
397
+ # Preserve their parameters instead of naming only the origin class.
398
+ if get_origin(stream_type) is None and inspect.isclass(stream_type):
395
399
  return self._type_name(stream_type)
396
400
  return repr(stream_type)
397
401
 
@@ -421,7 +425,9 @@ class GraphRunner:
421
425
  else None
422
426
  ),
423
427
  settings_type=(
424
- self._stream_type_name(input_settings.msg_type)
428
+ self._stream_type_name(
429
+ resolve_stream_type(type(comp), input_settings.msg_type)
430
+ )
425
431
  if isinstance(input_settings, InputStream)
426
432
  else None
427
433
  ),
@@ -431,7 +437,9 @@ class GraphRunner:
431
437
  topic_entries: dict[str, TopicMetadataType] = {}
432
438
  relay_entries: dict[str, RelayMetadataType] = {}
433
439
  for stream_name, stream in comp.streams.items():
434
- msg_type = self._stream_type_name(stream.msg_type)
440
+ msg_type = self._stream_type_name(
441
+ resolve_stream_type(type(comp), stream.msg_type)
442
+ )
435
443
  if isinstance(stream, InputRelay):
436
444
  runtime = _relay_runtime_info(stream)
437
445
  relay_entries[stream_name] = InputRelayMetadata(
@@ -702,16 +710,17 @@ class GraphRunner:
702
710
  self._graph_context = graph_context
703
711
  self._graph_server_spawned = graph_context._graph_server is not None
704
712
 
713
+ address = graph_context.graph_address
714
+ if address is None:
715
+ address = GraphService.default_address()
716
+
705
717
  if graph_context._graph_server is None:
706
- address = graph_context.graph_address
707
- if address is None:
708
- address = GraphService.default_address()
709
718
  logger.info(f"Connected to GraphServer @ {address}")
710
719
  else:
711
- logger.info(f"Spawned GraphServer @ {graph_context.graph_address}")
720
+ logger.info(f"Spawned GraphServer @ {address}")
712
721
 
713
722
  self._execution_context.create_processes(
714
- graph_address=graph_context.graph_address,
723
+ graph_address=address,
715
724
  backend_process=self._backend_process,
716
725
  )
717
726
 
@@ -50,6 +50,7 @@ from .pubclient import Publisher
50
50
  from .subclient import Subscriber
51
51
  from .netprotocol import AddressType
52
52
  from .settingsmeta import (
53
+ coerce_settings_field_value,
53
54
  settings_repr_value,
54
55
  settings_schema_from_value,
55
56
  settings_structured_value,
@@ -422,10 +423,23 @@ class DefaultBackendProcess(BackendProcess):
422
423
  )
423
424
 
424
425
  try:
426
+ # Authoritative validation/coercion: this process is the one
427
+ # place the settings class (and everything it references,
428
+ # enums included) is importable, so a value is checked against
429
+ # the field's annotation HERE rather than trusting callers to
430
+ # pre-cast. With the `schema` extra absent, or for annotations
431
+ # pydantic cannot resolve, the value applies raw as before; a
432
+ # refused value fails the request instead of publishing a
433
+ # value the settings type cannot hold.
434
+ coerced_value = coerce_settings_field_value(
435
+ type(current_settings[unit_address]),
436
+ update_obj.field_path,
437
+ update_obj.value,
438
+ )
425
439
  patched = self._replace_settings_field(
426
440
  current_settings[unit_address],
427
441
  update_obj.field_path,
428
- update_obj.value,
442
+ coerced_value,
429
443
  )
430
444
  control_pub = control_publishers.get(input_topic)
431
445
  if control_pub is None:
@@ -2,6 +2,7 @@ import argparse
2
2
 
3
3
  from .dashboard_cmd import setup_dashboard_cmdline
4
4
  from .graphviz import setup_graphviz_cmdline
5
+ from .inspect import setup_inspect_cmdline
5
6
  from .mermaid import setup_mermaid_cmdline
6
7
  from .serve import setup_serve_cmdline
7
8
  from .shutdown import setup_shutdown_cmdline
@@ -15,3 +16,4 @@ def setup_core_cmdline(subparsers: argparse._SubParsersAction) -> None:
15
16
  setup_shutdown_cmdline(subparsers)
16
17
  setup_graphviz_cmdline(subparsers)
17
18
  setup_mermaid_cmdline(subparsers)
19
+ setup_inspect_cmdline(subparsers)
@@ -0,0 +1,156 @@
1
+ """``ezmsg inspect`` — describe an app's components without running it.
2
+
3
+ Everything reported here is read from CLASS-level state the component
4
+ metaclasses already maintain (``__streams__``, ``__settings_type__``,
5
+ ``__components__``), so nothing is instantiated, no settings are required,
6
+ and no graph connection is involved: the target module is imported and its
7
+ component classes are described as declared. Because a child's attribute
8
+ name is exactly the segment ezmsg uses for its runtime address, the
9
+ ``path`` reported for each nested component matches the address it will
10
+ register under at run time (below whatever root name ``ez.run`` is given —
11
+ the class name stands in for that root segment here).
12
+
13
+ Two things are invisible to a static description, by design: components a
14
+ Collection creates dynamically in ``configure()``, and stream addresses
15
+ (assigned at graph build). Settings schemas ride along in both the
16
+ field-list form and, when the ``schema`` extra is installed, the standard
17
+ JSON Schema — the same payload the graph metadata carries for a running
18
+ app, so consumers can share one contract for "at rest" and "live".
19
+ """
20
+
21
+ import argparse
22
+ import dataclasses
23
+ import importlib
24
+ import importlib.util
25
+ import json
26
+ import sys
27
+ from pathlib import Path
28
+ from typing import Any
29
+
30
+ from ..collection import Collection
31
+ from ..component import Component
32
+ from ..settingsmeta import settings_schema_from_type
33
+ from ..stream import InputStream
34
+
35
+ INSPECT_SCHEMA_VERSION = 1
36
+
37
+
38
+ def _type_name(tp: object) -> str:
39
+ if isinstance(tp, type):
40
+ return f"{tp.__module__}.{tp.__qualname__}"
41
+ return str(tp)
42
+
43
+
44
+ def _load_module(source: str) -> Any:
45
+ """Import ``source`` as a file path or a dotted module name."""
46
+ path = Path(source).expanduser()
47
+ if path.suffix == ".py" or path.exists():
48
+ spec = importlib.util.spec_from_file_location(path.stem, path)
49
+ if spec is None or spec.loader is None:
50
+ raise ImportError(f"Cannot load a module from {source!r}")
51
+ module = importlib.util.module_from_spec(spec)
52
+ # Registered so dataclass/typing resolution that imports the module
53
+ # by name (get_type_hints, pydantic) can find it.
54
+ sys.modules[path.stem] = module
55
+ spec.loader.exec_module(module)
56
+ return module
57
+ return importlib.import_module(source)
58
+
59
+
60
+ def _streams_description(component_cls: type) -> list[dict[str, Any]]:
61
+ streams = getattr(component_cls, "__streams__", {})
62
+ return [
63
+ {
64
+ "name": name,
65
+ "kind": type(stream).__name__,
66
+ "msg_type": _type_name(getattr(stream, "msg_type", None)),
67
+ }
68
+ for name, stream in streams.items()
69
+ ]
70
+
71
+
72
+ def _component_description(name: str, path: str, component_cls: type) -> dict[str, Any]:
73
+ settings_type = getattr(component_cls, "__settings_type__", None)
74
+ schema = settings_schema_from_type(settings_type) if settings_type is not None else None
75
+ input_settings = getattr(component_cls, "__streams__", {}).get("INPUT_SETTINGS")
76
+ description: dict[str, Any] = {
77
+ "name": name,
78
+ "path": path,
79
+ "component_type": _type_name(component_cls),
80
+ "collection": issubclass(component_cls, Collection),
81
+ "settings_type": _type_name(settings_type) if settings_type is not None else None,
82
+ "settings_schema": dataclasses.asdict(schema) if schema is not None else None,
83
+ # Same rule the graph metadata applies to a running component: only
84
+ # an InputStream inlet named INPUT_SETTINGS accepts dynamic updates.
85
+ "dynamic_settings": isinstance(input_settings, InputStream),
86
+ "streams": _streams_description(component_cls),
87
+ }
88
+ children = getattr(component_cls, "__components__", None)
89
+ if issubclass(component_cls, Collection) and isinstance(children, dict):
90
+ description["components"] = [
91
+ _component_description(child_name, f"{path}/{child_name}", type(child))
92
+ for child_name, child in children.items()
93
+ ]
94
+ return description
95
+
96
+
97
+ def _root_component_classes(module: Any, component_name: str | None) -> list[type]:
98
+ if component_name is not None:
99
+ target = getattr(module, component_name, None)
100
+ if not (isinstance(target, type) and issubclass(target, Component)):
101
+ raise SystemExit(
102
+ f"{component_name!r} is not an ezmsg Component class in {module.__name__!r}"
103
+ )
104
+ return [target]
105
+ roots = [
106
+ value
107
+ for value in vars(module).values()
108
+ if isinstance(value, type)
109
+ and issubclass(value, Component)
110
+ and value.__module__ == module.__name__
111
+ ]
112
+ if not roots:
113
+ raise SystemExit(f"No ezmsg Component classes are defined in {module.__name__!r}")
114
+ return roots
115
+
116
+
117
+ def handle_inspect(args: argparse.Namespace) -> None:
118
+ try:
119
+ module = _load_module(args.source)
120
+ except SystemExit:
121
+ raise
122
+ except BaseException as exc:
123
+ raise SystemExit(f"Could not import {args.source!r}: {type(exc).__name__}: {exc}") from exc
124
+
125
+ roots = _root_component_classes(module, args.component)
126
+ result = {
127
+ "inspect_schema_version": INSPECT_SCHEMA_VERSION,
128
+ "source": args.source,
129
+ "components": [
130
+ _component_description(root.__name__, root.__name__, root) for root in roots
131
+ ],
132
+ }
133
+ print(json.dumps(result, indent=args.indent))
134
+
135
+
136
+ def setup_inspect_cmdline(subparsers: argparse._SubParsersAction) -> None:
137
+ parser = subparsers.add_parser(
138
+ "inspect",
139
+ help="describe a module's components and settings schemas without running them",
140
+ )
141
+ parser.add_argument(
142
+ "source",
143
+ help="path to a .py file, or a dotted module name, defining ezmsg Components",
144
+ )
145
+ parser.add_argument(
146
+ "--component",
147
+ default=None,
148
+ help="describe only this Component class (default: every Component the module defines)",
149
+ )
150
+ parser.add_argument(
151
+ "--indent",
152
+ type=int,
153
+ default=None,
154
+ help="pretty-print the JSON with this indent (default: one line)",
155
+ )
156
+ parser.set_defaults(_handler=handle_inspect)
@@ -122,6 +122,12 @@ class SettingsSchemaMetadata:
122
122
  provider: str
123
123
  settings_type: str
124
124
  fields: list[SettingsFieldMetadata]
125
+ # Standard JSON Schema for the settings type, generated by pydantic when
126
+ # the optional `schema` extra is installed (None otherwise, and for types
127
+ # pydantic cannot model). Rides everywhere this schema already goes —
128
+ # component metadata, settings snapshots, settings events — so any
129
+ # consumer can validate values without parsing the field_type strings.
130
+ json_schema: dict[str, Any] | None = None
125
131
 
126
132
 
127
133
  SettingsReprType: TypeAlias = dict[str, Any] | str
@@ -1,12 +1,145 @@
1
1
  from __future__ import annotations
2
2
 
3
- from dataclasses import MISSING, asdict, fields as dataclass_fields, is_dataclass
4
3
  import enum
4
+ import types
5
+ import typing
5
6
  from collections.abc import Mapping
6
- from typing import Any, get_args, get_origin
7
+ from dataclasses import MISSING, asdict, is_dataclass
8
+ from dataclasses import fields as dataclass_fields
9
+ from typing import Annotated, Any, get_args, get_origin, get_type_hints
7
10
 
8
11
  from .graphmeta import SettingsFieldMetadata, SettingsSchemaMetadata
9
12
 
13
+ # Soft dependency (the `schema` extra): with pydantic installed, settings
14
+ # metadata carries a standard JSON Schema and dynamic settings field updates
15
+ # are validated/coerced in the owning process; without it, schema fields are
16
+ # None and updates apply raw, exactly as before.
17
+ #
18
+ # Resolved on first use rather than at import. This module is reached by a
19
+ # plain ``import ezmsg.core``, so importing pydantic here would charge every
20
+ # ezmsg process ~200 ms and ~5 MB — including every spawned backend process,
21
+ # which on spawn platforms re-imports from scratch — whether or not it ever
22
+ # describes or coerces a setting. Deferring it means only the process that
23
+ # builds graph metadata, and processes that actually handle settings, pay.
24
+ _UNRESOLVED = object()
25
+ _TYPE_ADAPTER: Any = _UNRESOLVED
26
+
27
+
28
+ def _type_adapter() -> Any:
29
+ """``pydantic.TypeAdapter`` if it can be imported, else None (cached)."""
30
+ global _TYPE_ADAPTER
31
+ if _TYPE_ADAPTER is _UNRESOLVED:
32
+ try:
33
+ from pydantic import TypeAdapter
34
+ except ImportError: # pragma: no cover — exercised via the stubbed tests
35
+ TypeAdapter = None
36
+ _TYPE_ADAPTER = TypeAdapter
37
+ return _TYPE_ADAPTER
38
+
39
+
40
+ class SettingsCoercionError(ValueError):
41
+ """A dynamic settings field update refused by the settings type.
42
+
43
+ Raised only when pydantic is installed AND resolved the field's
44
+ annotation AND rejected the value — never for gaps in coverage, which
45
+ fall back to applying the value raw.
46
+ """
47
+
48
+
49
+ def settings_json_schema(settings_type: object) -> dict[str, Any] | None:
50
+ """Standard JSON Schema for a settings type, or None. Never raises.
51
+
52
+ None means pydantic is not installed, or it cannot model this type (an
53
+ arbitrary-typed field, an exotic annotation); consumers treat that as
54
+ "no schema" and keep whatever behavior they had.
55
+ """
56
+ type_adapter = _type_adapter()
57
+ if type_adapter is None or not isinstance(settings_type, type):
58
+ return None
59
+ try:
60
+ schema = type_adapter(settings_type).json_schema(mode="validation")
61
+ except Exception:
62
+ return None
63
+ return schema if isinstance(schema, dict) else None
64
+
65
+
66
+ def _unwrap_annotation(annotation: Any) -> Any:
67
+ """Peel Annotated and single-member-Optional wrappers for shape checks.
68
+
69
+ Only used to decide how to DESCEND a dotted field path; the full
70
+ (wrapped) annotation is what gets validated against, so metadata like
71
+ pydantic Field constraints is never lost.
72
+ """
73
+ while True:
74
+ if get_origin(annotation) is Annotated:
75
+ annotation = get_args(annotation)[0]
76
+ continue
77
+ origin = get_origin(annotation)
78
+ if origin in (typing.Union, types.UnionType):
79
+ non_none = [arg for arg in get_args(annotation) if arg is not type(None)]
80
+ if len(non_none) == 1:
81
+ annotation = non_none[0]
82
+ continue
83
+ return annotation
84
+
85
+
86
+ def _annotation_at_path(settings_type: type, field_path: str) -> Any | None:
87
+ """The annotation a dotted settings field path addresses, or None.
88
+
89
+ Walks dataclass/pydantic-model fields by name and str-keyed mappings by
90
+ value type — the same shapes ``_replace_settings_field`` patches. None
91
+ (unknown field, unresolvable hints, an unsupported container in the
92
+ middle of the path) means "no annotation available", not an error.
93
+ """
94
+ current: Any = settings_type
95
+ for segment in str(field_path).split("."):
96
+ base = _unwrap_annotation(current)
97
+ if is_dataclass(base) or hasattr(base, "model_fields"):
98
+ try:
99
+ hints = get_type_hints(base, include_extras=True)
100
+ except Exception:
101
+ return None
102
+ if segment not in hints:
103
+ return None
104
+ current = hints[segment]
105
+ continue
106
+ if get_origin(base) is dict or (isinstance(get_origin(base), type) and issubclass(get_origin(base), Mapping)):
107
+ args = get_args(base)
108
+ if len(args) != 2:
109
+ return None
110
+ current = args[1]
111
+ continue
112
+ return None
113
+ return current
114
+
115
+
116
+ def coerce_settings_field_value(settings_type: object, field_path: str, value: Any) -> Any:
117
+ """Validate/coerce one dynamic settings field update against its annotation.
118
+
119
+ The authoritative reconstruction point: this runs in the process that
120
+ owns the unit, the one place the settings class and everything it
121
+ references (enums included) is importable. Returns the coerced value;
122
+ returns ``value`` unchanged when pydantic is absent or the annotation
123
+ cannot be resolved/modelled (raw behavior, as before this existed); and
124
+ raises :class:`SettingsCoercionError` when pydantic refuses the value —
125
+ a refusal the process control response reports back to the caller
126
+ instead of publishing a value the settings type cannot hold.
127
+ """
128
+ type_adapter = _type_adapter()
129
+ if type_adapter is None or not isinstance(settings_type, type):
130
+ return value
131
+ annotation = _annotation_at_path(settings_type, field_path)
132
+ if annotation is None:
133
+ return value
134
+ try:
135
+ adapter = type_adapter(annotation)
136
+ except Exception:
137
+ return value
138
+ try:
139
+ return adapter.validate_python(value)
140
+ except Exception as exc:
141
+ raise SettingsCoercionError(f"Invalid value for settings field '{field_path}': {exc}") from None
142
+
10
143
 
11
144
  def _type_name(tp: object) -> str:
12
145
  if isinstance(tp, type):
@@ -41,6 +174,19 @@ def settings_structured_value(value: object) -> dict[str, Any] | None:
41
174
  if value is None:
42
175
  return None
43
176
 
177
+ # Pydantic's JSON-mode dump first: it round-trips exactly what the
178
+ # type's JSON Schema describes (enums by value, tuples as arrays, paths
179
+ # and datetimes as strings). A type pydantic cannot model fails at
180
+ # adapter construction and falls through to the legacy renderings.
181
+ type_adapter = _type_adapter()
182
+ if type_adapter is not None:
183
+ try:
184
+ dumped = type_adapter(type(value)).dump_python(value, mode="json")
185
+ if isinstance(dumped, dict):
186
+ return dumped
187
+ except Exception:
188
+ pass
189
+
44
190
  if is_dataclass(value):
45
191
  try:
46
192
  asdict_value = asdict(value)
@@ -144,6 +290,8 @@ def settings_schema_from_type(settings_type: object) -> SettingsSchemaMetadata |
144
290
  if not isinstance(settings_type, type):
145
291
  return None
146
292
 
293
+ json_schema = settings_json_schema(settings_type)
294
+
147
295
  if is_dataclass(settings_type):
148
296
  fields: list[SettingsFieldMetadata] = []
149
297
  for f in dataclass_fields(settings_type):
@@ -193,6 +341,7 @@ def settings_schema_from_type(settings_type: object) -> SettingsSchemaMetadata |
193
341
  provider="dataclass",
194
342
  settings_type=_type_name(settings_type),
195
343
  fields=fields,
344
+ json_schema=json_schema,
196
345
  )
197
346
 
198
347
  if hasattr(settings_type, "model_fields"):
@@ -233,6 +382,7 @@ def settings_schema_from_type(settings_type: object) -> SettingsSchemaMetadata |
233
382
  provider="pydantic",
234
383
  settings_type=_type_name(settings_type),
235
384
  fields=fields,
385
+ json_schema=json_schema,
236
386
  )
237
387
 
238
388
  if hasattr(settings_type, "__fields__"):
@@ -266,6 +416,7 @@ def settings_schema_from_type(settings_type: object) -> SettingsSchemaMetadata |
266
416
  provider="pydantic",
267
417
  settings_type=_type_name(settings_type),
268
418
  fields=fields,
419
+ json_schema=json_schema,
269
420
  )
270
421
 
271
422
  param_ns = getattr(settings_type, "param", None)
@@ -323,6 +474,7 @@ def settings_schema_from_type(settings_type: object) -> SettingsSchemaMetadata |
323
474
  provider="param",
324
475
  settings_type=_type_name(settings_type),
325
476
  fields=fields,
477
+ json_schema=json_schema,
326
478
  )
327
479
 
328
480
  return None
@@ -0,0 +1,55 @@
1
+ """Resolve inherited generic annotations without changing shared stream objects."""
2
+
3
+ import types
4
+ from functools import reduce
5
+ from operator import or_
6
+ from typing import TypeVar, Union, get_args, get_origin
7
+
8
+
9
+ def _substitute(annotation, bindings):
10
+ if isinstance(annotation, TypeVar):
11
+ seen = set()
12
+ while isinstance(annotation, TypeVar) and annotation in bindings and annotation not in seen:
13
+ seen.add(annotation)
14
+ annotation = bindings[annotation]
15
+ return annotation
16
+ args = get_args(annotation)
17
+ if not args:
18
+ return annotation
19
+ resolved = tuple(_substitute(arg, bindings) for arg in args)
20
+ if resolved == args:
21
+ return annotation
22
+ if hasattr(annotation, "copy_with"):
23
+ return annotation.copy_with(resolved)
24
+ origin = get_origin(annotation)
25
+ if origin in (Union, types.UnionType):
26
+ return reduce(or_, resolved)
27
+ try:
28
+ return origin[resolved[0] if len(resolved) == 1 else resolved]
29
+ except (TypeError, AttributeError):
30
+ return annotation
31
+
32
+
33
+ def resolve_stream_type(component_type: type, annotation):
34
+ """Substitute explicit generic base arguments; leave unbound types unresolved."""
35
+ candidates = {}
36
+
37
+ def walk(cls, inherited):
38
+ for parent in cls.__dict__.get("__orig_bases__", cls.__bases__):
39
+ origin = get_origin(parent) or parent
40
+ args = tuple(_substitute(arg, inherited) for arg in get_args(parent))
41
+ bindings = {**inherited, **dict(zip(getattr(origin, "__parameters__", ()), args))}
42
+ for variable, value in bindings.items():
43
+ if variable != value:
44
+ candidates.setdefault(variable, []).append(value)
45
+ if isinstance(origin, type) and origin is not object:
46
+ walk(origin, bindings)
47
+
48
+ walk(component_type, {})
49
+ # Ambiguous multiple inheritance must not advertise an invented concrete type.
50
+ bindings = {
51
+ variable: values[0]
52
+ for variable, values in candidates.items()
53
+ if all(value == values[0] for value in values)
54
+ }
55
+ return _substitute(annotation, bindings)
@@ -149,11 +149,11 @@ class ArrayWithNamedDims:
149
149
  # Checked here rather than in an AxisArray override: reusing this frame
150
150
  # costs one getattr instead of a second __post_init__ call, and message
151
151
  # construction is hot.
152
- chunk_dim = getattr(self, "chunk_dim", None)
153
- if chunk_dim is not None and chunk_dim not in self.dims:
152
+ stream_dim = getattr(self, "stream_dim", None)
153
+ if stream_dim is not None and stream_dim not in self.dims:
154
154
  raise ValueError(
155
- f"chunk_dim {chunk_dim!r} is not one of dims {self.dims}. "
156
- "An operation that renames this dimension must update chunk_dim too."
155
+ f"stream_dim {stream_dim!r} is not one of dims {self.dims}. "
156
+ "An operation that renames this dimension must update stream_dim too."
157
157
  )
158
158
 
159
159
  def __eq__(self, other):
@@ -316,16 +316,16 @@ class AxisArray(ArrayWithNamedDims):
316
316
  :type attrs: dict[str, typing.Any]
317
317
  :param key: Optional key identifier for this array, typically used to specify source device (default is empty string)
318
318
  :type key: str
319
- :param chunk_dim: Name of the dimension this message is a chunk along, or None if not declared
320
- :type chunk_dim: str | None
319
+ :param stream_dim: Name of the dimension this message streams along, or None if not declared
320
+ :type stream_dim: str | None
321
321
  """
322
322
 
323
323
  axes: dict[str, AxisBase] = field(default_factory=dict)
324
324
  attrs: dict[str, typing.Any] = field(default_factory=dict)
325
325
  key: str = ""
326
326
 
327
- chunk_dim: str | None = None
328
- """The dimension this message is a *chunk* along.
327
+ stream_dim: str | None = None
328
+ """The dimension this message *streams* along.
329
329
 
330
330
  Successive messages in a stream append to one another along this dimension,
331
331
  so it is the one whose extent is arbitrary: its length is however much
@@ -655,6 +655,13 @@ class AxisArray(ArrayWithNamedDims):
655
655
  Yields AxisArray objects for each slice along the given axis, with that
656
656
  dimension removed from the resulting arrays.
657
657
 
658
+ Iterating over the stream dimension consumes it: each slice is a single
659
+ element along it, not a stretch of a stream that accumulates there. The
660
+ yielded arrays therefore declare no :attr:`stream_dim` -- keeping the old
661
+ one would name a dimension that is no longer in ``dims``, which
662
+ :meth:`__post_init__` rejects outright. A caller that knows what the
663
+ slices stream along should say so on the way out.
664
+
658
665
  :param axis: Dimension name or index to iterate over
659
666
  :type axis: str | int
660
667
  :yields: AxisArray objects for each slice along the axis
@@ -665,6 +672,7 @@ class AxisArray(ArrayWithNamedDims):
665
672
  dim_name = self.dims[axis_idx]
666
673
  new_dims = [d for i, d in enumerate(self.dims) if i != axis_idx]
667
674
  new_axes = {d: a for d, a in self.axes.items() if d != dim_name}
675
+ new_stream_dim = None if self.stream_dim == dim_name else self.stream_dim
668
676
 
669
677
  for it_data in xp.moveaxis(self.data, axis_idx, 0):
670
678
  it_aa = replace(
@@ -672,6 +680,7 @@ class AxisArray(ArrayWithNamedDims):
672
680
  data=it_data,
673
681
  dims=new_dims,
674
682
  axes=new_axes,
683
+ stream_dim=new_stream_dim,
675
684
  )
676
685
  yield it_aa
677
686