reader-workbench 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. reader_workbench/__init__.py +22 -0
  2. reader_workbench/__main__.py +4 -0
  3. reader_workbench/_version.py +17 -0
  4. reader_workbench/api/__init__.py +74 -0
  5. reader_workbench/api/_record_reads.py +75 -0
  6. reader_workbench/api/artifacts.py +79 -0
  7. reader_workbench/api/facade.py +538 -0
  8. reader_workbench/api/models.py +285 -0
  9. reader_workbench/api/notebooks.py +63 -0
  10. reader_workbench/contracts/__init__.py +18 -0
  11. reader_workbench/contracts/builtins/__init__.py +36 -0
  12. reader_workbench/contracts/builtins/cytometry.py +140 -0
  13. reader_workbench/contracts/builtins/four_state_event_window.py +214 -0
  14. reader_workbench/contracts/builtins/generic.py +21 -0
  15. reader_workbench/contracts/builtins/logic.py +149 -0
  16. reader_workbench/contracts/builtins/plate_reader.py +47 -0
  17. reader_workbench/contracts/catalog.py +257 -0
  18. reader_workbench/contracts/model.py +109 -0
  19. reader_workbench/domains/__init__.py +1 -0
  20. reader_workbench/domains/cytometry/__init__.py +3 -0
  21. reader_workbench/domains/cytometry/analysis/__init__.py +29 -0
  22. reader_workbench/domains/cytometry/analysis/events.py +182 -0
  23. reader_workbench/domains/cytometry/analysis/gating.py +175 -0
  24. reader_workbench/domains/cytometry/analysis/workflow.py +248 -0
  25. reader_workbench/domains/cytometry/io/__init__.py +3 -0
  26. reader_workbench/domains/cytometry/io/fcs.py +135 -0
  27. reader_workbench/domains/cytometry/plots/__init__.py +5 -0
  28. reader_workbench/domains/cytometry/plots/diagnostic.py +155 -0
  29. reader_workbench/domains/logic/__init__.py +3 -0
  30. reader_workbench/domains/logic/crosstalk/__init__.py +3 -0
  31. reader_workbench/domains/logic/crosstalk/pairs.py +661 -0
  32. reader_workbench/domains/logic/four_state_vector/__init__.py +7 -0
  33. reader_workbench/domains/logic/four_state_vector/builder.py +321 -0
  34. reader_workbench/domains/logic/four_state_vector/collection/__init__.py +20 -0
  35. reader_workbench/domains/logic/four_state_vector/collection/checks.py +49 -0
  36. reader_workbench/domains/logic/four_state_vector/collection/constants.py +29 -0
  37. reader_workbench/domains/logic/four_state_vector/collection/model.py +19 -0
  38. reader_workbench/domains/logic/four_state_vector/collection/render.py +383 -0
  39. reader_workbench/domains/logic/four_state_vector/collection/sources.py +185 -0
  40. reader_workbench/domains/logic/four_state_vector/config.py +214 -0
  41. reader_workbench/domains/logic/four_state_vector/diagnostic.py +361 -0
  42. reader_workbench/domains/logic/four_state_vector/heatmap.py +86 -0
  43. reader_workbench/domains/logic/four_state_vector/math.py +191 -0
  44. reader_workbench/domains/logic/four_state_vector/reference.py +85 -0
  45. reader_workbench/domains/logic/four_state_vector/selection.py +228 -0
  46. reader_workbench/domains/logic/four_state_vector/treatment_semantics.py +51 -0
  47. reader_workbench/domains/logic/four_state_vector/validation.py +19 -0
  48. reader_workbench/domains/logic/logic_symmetry/__init__.py +3 -0
  49. reader_workbench/domains/logic/logic_symmetry/encodings.py +93 -0
  50. reader_workbench/domains/logic/logic_symmetry/extract_corners.py +192 -0
  51. reader_workbench/domains/logic/logic_symmetry/main.py +236 -0
  52. reader_workbench/domains/logic/logic_symmetry/metrics.py +96 -0
  53. reader_workbench/domains/logic/logic_symmetry/overlay.py +129 -0
  54. reader_workbench/domains/logic/logic_symmetry/prep.py +138 -0
  55. reader_workbench/domains/logic/logic_symmetry/render.py +356 -0
  56. reader_workbench/domains/logic/treatment_columns.py +42 -0
  57. reader_workbench/domains/plate_reader/__init__.py +1 -0
  58. reader_workbench/domains/plate_reader/analysis/__init__.py +14 -0
  59. reader_workbench/domains/plate_reader/analysis/fold_change.py +474 -0
  60. reader_workbench/domains/plate_reader/analysis/four_state_event_window/__init__.py +21 -0
  61. reader_workbench/domains/plate_reader/analysis/four_state_event_window/aggregation.py +191 -0
  62. reader_workbench/domains/plate_reader/analysis/four_state_event_window/contract_fields.py +50 -0
  63. reader_workbench/domains/plate_reader/analysis/four_state_event_window/contracts.py +320 -0
  64. reader_workbench/domains/plate_reader/analysis/four_state_event_window/design_dispositions.py +54 -0
  65. reader_workbench/domains/plate_reader/analysis/four_state_event_window/disposition_records.py +140 -0
  66. reader_workbench/domains/plate_reader/analysis/four_state_event_window/event_sensitivity.py +27 -0
  67. reader_workbench/domains/plate_reader/analysis/four_state_event_window/materialize.py +274 -0
  68. reader_workbench/domains/plate_reader/analysis/four_state_event_window/observation_resampling.py +97 -0
  69. reader_workbench/domains/plate_reader/analysis/four_state_event_window/reduction.py +62 -0
  70. reader_workbench/domains/plate_reader/analysis/four_state_event_window/seeds.py +15 -0
  71. reader_workbench/domains/plate_reader/analysis/four_state_event_window/sources.py +308 -0
  72. reader_workbench/domains/plate_reader/analysis/four_state_event_window/well_exclusion_validation.py +94 -0
  73. reader_workbench/domains/plate_reader/analysis/four_state_event_window/well_exclusions.py +54 -0
  74. reader_workbench/domains/plate_reader/analysis/timepoints.py +76 -0
  75. reader_workbench/domains/plate_reader/io/__init__.py +6 -0
  76. reader_workbench/domains/plate_reader/io/sample_map.py +65 -0
  77. reader_workbench/domains/plate_reader/io/synergy_h1/__init__.py +6 -0
  78. reader_workbench/domains/plate_reader/io/synergy_h1/_kinetic.py +141 -0
  79. reader_workbench/domains/plate_reader/io/synergy_h1/_parser.py +295 -0
  80. reader_workbench/domains/plate_reader/io/synergy_h1/_shared.py +195 -0
  81. reader_workbench/domains/plate_reader/io/synergy_h1/_snapshot.py +130 -0
  82. reader_workbench/domains/plate_reader/ordering.py +59 -0
  83. reader_workbench/domains/plate_reader/plots/__init__.py +15 -0
  84. reader_workbench/domains/plate_reader/plots/_data.py +29 -0
  85. reader_workbench/domains/plate_reader/plots/common.py +346 -0
  86. reader_workbench/domains/plate_reader/plots/distributions.py +324 -0
  87. reader_workbench/domains/plate_reader/plots/dual_reporter_triptych.py +525 -0
  88. reader_workbench/domains/plate_reader/plots/dual_reporter_triptych_render.py +195 -0
  89. reader_workbench/domains/plate_reader/plots/four_state_event_window/__init__.py +26 -0
  90. reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic.py +295 -0
  91. reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_components.py +149 -0
  92. reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_render.py +308 -0
  93. reader_workbench/domains/plate_reader/plots/four_state_event_window/diagnostic_style.py +51 -0
  94. reader_workbench/domains/plate_reader/plots/four_state_event_window/schema.py +8 -0
  95. reader_workbench/domains/plate_reader/plots/four_state_event_window/summary.py +140 -0
  96. reader_workbench/domains/plate_reader/plots/grouping.py +53 -0
  97. reader_workbench/domains/plate_reader/plots/panels/__init__.py +12 -0
  98. reader_workbench/domains/plate_reader/plots/panels/snapshot.py +161 -0
  99. reader_workbench/domains/plate_reader/plots/panels/snapshot_data.py +91 -0
  100. reader_workbench/domains/plate_reader/plots/panels/time_series.py +296 -0
  101. reader_workbench/domains/plate_reader/plots/single_reporter_diagnostic.py +435 -0
  102. reader_workbench/domains/plate_reader/plots/single_reporter_diagnostic_render.py +300 -0
  103. reader_workbench/domains/plate_reader/plots/snapshot_barplot/__init__.py +315 -0
  104. reader_workbench/domains/plate_reader/plots/snapshot_barplot/planning.py +168 -0
  105. reader_workbench/domains/plate_reader/plots/snapshot_heatmap/__init__.py +205 -0
  106. reader_workbench/domains/plate_reader/plots/snapshot_heatmap/inputs.py +103 -0
  107. reader_workbench/domains/plate_reader/plots/time_series.py +317 -0
  108. reader_workbench/domains/plate_reader/plots/ts_and_snap/__init__.py +479 -0
  109. reader_workbench/domains/plate_reader/plots/ts_and_snap/planning.py +283 -0
  110. reader_workbench/domains/time_series/__init__.py +29 -0
  111. reader_workbench/domains/time_series/aggregation.py +60 -0
  112. reader_workbench/domains/time_series/contracts.py +368 -0
  113. reader_workbench/domains/time_series/reduction.py +395 -0
  114. reader_workbench/errors.py +55 -0
  115. reader_workbench/maintenance/__init__.py +6 -0
  116. reader_workbench/maintenance/docs.py +335 -0
  117. reader_workbench/maintenance/model.py +28 -0
  118. reader_workbench/maintenance/release.py +39 -0
  119. reader_workbench/maintenance/skills.py +124 -0
  120. reader_workbench/plotting/__init__.py +20 -0
  121. reader_workbench/plotting/mpl.py +56 -0
  122. reader_workbench/plotting/sinks.py +69 -0
  123. reader_workbench/plotting/style.py +175 -0
  124. reader_workbench/plotting/utils.py +27 -0
  125. reader_workbench/plugins/__init__.py +1 -0
  126. reader_workbench/plugins/catalog.py +33 -0
  127. reader_workbench/plugins/export/__init__.py +0 -0
  128. reader_workbench/plugins/export/_paths.py +21 -0
  129. reader_workbench/plugins/export/csv.py +41 -0
  130. reader_workbench/plugins/export/xlsx.py +44 -0
  131. reader_workbench/plugins/ingest/__init__.py +0 -0
  132. reader_workbench/plugins/ingest/_discovery.py +58 -0
  133. reader_workbench/plugins/ingest/discovery_policy.py +66 -0
  134. reader_workbench/plugins/ingest/flow_cytometer.py +139 -0
  135. reader_workbench/plugins/ingest/synergy_h1.py +234 -0
  136. reader_workbench/plugins/manifests/__init__.py +1 -0
  137. reader_workbench/plugins/manifests/export.py +29 -0
  138. reader_workbench/plugins/manifests/ingest.py +29 -0
  139. reader_workbench/plugins/manifests/plot.py +161 -0
  140. reader_workbench/plugins/manifests/transform.py +172 -0
  141. reader_workbench/plugins/manifests/validator.py +18 -0
  142. reader_workbench/plugins/plot/__init__.py +0 -0
  143. reader_workbench/plugins/plot/_shared.py +55 -0
  144. reader_workbench/plugins/plot/cytometry_diagnostic.py +54 -0
  145. reader_workbench/plugins/plot/distributions.py +58 -0
  146. reader_workbench/plugins/plot/dual_reporter_triptych.py +224 -0
  147. reader_workbench/plugins/plot/four_state_event_window_diagnostic.py +133 -0
  148. reader_workbench/plugins/plot/four_state_event_window_summary.py +53 -0
  149. reader_workbench/plugins/plot/four_state_vector_collection.py +45 -0
  150. reader_workbench/plugins/plot/four_state_vector_diagnostic.py +105 -0
  151. reader_workbench/plugins/plot/four_state_vector_heatmap.py +63 -0
  152. reader_workbench/plugins/plot/logic_symmetry.py +56 -0
  153. reader_workbench/plugins/plot/single_reporter_diagnostic.py +279 -0
  154. reader_workbench/plugins/plot/snapshot_barplot.py +65 -0
  155. reader_workbench/plugins/plot/snapshot_heatmap.py +104 -0
  156. reader_workbench/plugins/plot/time_series.py +114 -0
  157. reader_workbench/plugins/plot/ts_and_snap.py +210 -0
  158. reader_workbench/plugins/transform/__init__.py +0 -0
  159. reader_workbench/plugins/transform/_four_state_vector.py +204 -0
  160. reader_workbench/plugins/transform/_labeling.py +109 -0
  161. reader_workbench/plugins/transform/alias.py +70 -0
  162. reader_workbench/plugins/transform/assay_labels.py +62 -0
  163. reader_workbench/plugins/transform/blank.py +79 -0
  164. reader_workbench/plugins/transform/crosstalk_pairs.py +180 -0
  165. reader_workbench/plugins/transform/cytometry_gating.py +120 -0
  166. reader_workbench/plugins/transform/fold_change.py +79 -0
  167. reader_workbench/plugins/transform/four_state_event_window.py +93 -0
  168. reader_workbench/plugins/transform/four_state_vector.py +62 -0
  169. reader_workbench/plugins/transform/four_state_vector_collection.py +41 -0
  170. reader_workbench/plugins/transform/logic_symmetry.py +67 -0
  171. reader_workbench/plugins/transform/outlier_filter.py +60 -0
  172. reader_workbench/plugins/transform/overflow.py +197 -0
  173. reader_workbench/plugins/transform/ratio.py +237 -0
  174. reader_workbench/plugins/transform/sample_map.py +170 -0
  175. reader_workbench/plugins/transform/sample_metadata.py +94 -0
  176. reader_workbench/plugins/validator/__init__.py +1 -0
  177. reader_workbench/plugins/validator/to_tidy_plus_map.py +155 -0
  178. reader_workbench/protocols/__init__.py +80 -0
  179. reader_workbench/protocols/_builtins_plate_reader_growth.py +179 -0
  180. reader_workbench/protocols/_builtins_plate_reader_variants.py +274 -0
  181. reader_workbench/protocols/builtins.py +1656 -0
  182. reader_workbench/protocols/compiler.py +22 -0
  183. reader_workbench/protocols/compilers/__init__.py +1 -0
  184. reader_workbench/protocols/compilers/common.py +100 -0
  185. reader_workbench/protocols/compilers/cytometry.py +87 -0
  186. reader_workbench/protocols/compilers/generic.py +14 -0
  187. reader_workbench/protocols/compilers/logic.py +245 -0
  188. reader_workbench/protocols/compilers/plate_reader.py +937 -0
  189. reader_workbench/protocols/compilers/plate_reader_pipeline.py +197 -0
  190. reader_workbench/protocols/model.py +1486 -0
  191. reader_workbench/protocols/semantic_coverage.py +234 -0
  192. reader_workbench/runtime/__init__.py +12 -0
  193. reader_workbench/runtime/builtin.py +23 -0
  194. reader_workbench/runtime/model.py +42 -0
  195. reader_workbench/workbench/__init__.py +60 -0
  196. reader_workbench/workbench/assets/__init__.py +22 -0
  197. reader_workbench/workbench/assets/types.py +118 -0
  198. reader_workbench/workbench/audit/__init__.py +5 -0
  199. reader_workbench/workbench/audit/experiments.py +307 -0
  200. reader_workbench/workbench/audit/staging.py +187 -0
  201. reader_workbench/workbench/cli/__init__.py +51 -0
  202. reader_workbench/workbench/cli/_lazy.py +9 -0
  203. reader_workbench/workbench/cli/_records_view.py +150 -0
  204. reader_workbench/workbench/cli/_surface_execution.py +443 -0
  205. reader_workbench/workbench/cli/audit.py +95 -0
  206. reader_workbench/workbench/cli/automation.py +229 -0
  207. reader_workbench/workbench/cli/demo.py +46 -0
  208. reader_workbench/workbench/cli/dop.py +91 -0
  209. reader_workbench/workbench/cli/experiments.py +635 -0
  210. reader_workbench/workbench/cli/helpers.py +232 -0
  211. reader_workbench/workbench/cli/main.py +59 -0
  212. reader_workbench/workbench/cli/maintenance.py +82 -0
  213. reader_workbench/workbench/cli/notebooks.py +260 -0
  214. reader_workbench/workbench/cli/pagination.py +117 -0
  215. reader_workbench/workbench/cli/protocols.py +336 -0
  216. reader_workbench/workbench/cli/shared.py +309 -0
  217. reader_workbench/workbench/cli/surfaces.py +534 -0
  218. reader_workbench/workbench/cli/verification.py +128 -0
  219. reader_workbench/workbench/commands.py +10 -0
  220. reader_workbench/workbench/config/__init__.py +47 -0
  221. reader_workbench/workbench/config/identity.py +13 -0
  222. reader_workbench/workbench/config/load.py +405 -0
  223. reader_workbench/workbench/config/model.py +274 -0
  224. reader_workbench/workbench/context.py +26 -0
  225. reader_workbench/workbench/decl/__init__.py +31 -0
  226. reader_workbench/workbench/decl/build.py +190 -0
  227. reader_workbench/workbench/decl/model.py +81 -0
  228. reader_workbench/workbench/dop/__init__.py +12 -0
  229. reader_workbench/workbench/dop/builtins.py +261 -0
  230. reader_workbench/workbench/dop/model.py +209 -0
  231. reader_workbench/workbench/engine/__init__.py +42 -0
  232. reader_workbench/workbench/engine/_shared.py +76 -0
  233. reader_workbench/workbench/engine/contracts.py +283 -0
  234. reader_workbench/workbench/engine/execution.py +326 -0
  235. reader_workbench/workbench/engine/file_outputs.py +260 -0
  236. reader_workbench/workbench/engine/inputs.py +161 -0
  237. reader_workbench/workbench/engine/invocations.py +507 -0
  238. reader_workbench/workbench/engine/planning.py +72 -0
  239. reader_workbench/workbench/engine/runtime.py +464 -0
  240. reader_workbench/workbench/engine/setup.py +149 -0
  241. reader_workbench/workbench/engine/validation.py +684 -0
  242. reader_workbench/workbench/experiment/__init__.py +47 -0
  243. reader_workbench/workbench/experiment/model.py +381 -0
  244. reader_workbench/workbench/experiments.py +133 -0
  245. reader_workbench/workbench/graph/__init__.py +47 -0
  246. reader_workbench/workbench/graph/nodes.py +102 -0
  247. reader_workbench/workbench/graph/normalize.py +177 -0
  248. reader_workbench/workbench/graph/refs.py +148 -0
  249. reader_workbench/workbench/input_discovery.py +19 -0
  250. reader_workbench/workbench/inspection/__init__.py +3 -0
  251. reader_workbench/workbench/inspection/catalogs.py +128 -0
  252. reader_workbench/workbench/inspection/common.py +92 -0
  253. reader_workbench/workbench/inspection/dop.py +64 -0
  254. reader_workbench/workbench/inspection/experiments.py +449 -0
  255. reader_workbench/workbench/inspection/inventory.py +68 -0
  256. reader_workbench/workbench/inspection/protocols.py +368 -0
  257. reader_workbench/workbench/inspection/readiness.py +333 -0
  258. reader_workbench/workbench/inspection/reports.py +367 -0
  259. reader_workbench/workbench/inspection/results.py +166 -0
  260. reader_workbench/workbench/inspection/runtime.py +287 -0
  261. reader_workbench/workbench/inspection/semantics.py +192 -0
  262. reader_workbench/workbench/inspection/validation.py +30 -0
  263. reader_workbench/workbench/notebooks/__init__.py +17 -0
  264. reader_workbench/workbench/notebooks/_launch_registry.py +112 -0
  265. reader_workbench/workbench/notebooks/_launch_runtime.py +104 -0
  266. reader_workbench/workbench/notebooks/components/__init__.py +21 -0
  267. reader_workbench/workbench/notebooks/components/deliverables.py +403 -0
  268. reader_workbench/workbench/notebooks/components/overview.py +119 -0
  269. reader_workbench/workbench/notebooks/eda.marimo.py.txt +153 -0
  270. reader_workbench/workbench/notebooks/launch.py +274 -0
  271. reader_workbench/workbench/notebooks/presentation.py +136 -0
  272. reader_workbench/workbench/notebooks/scaffold.py +60 -0
  273. reader_workbench/workbench/ontology.py +78 -0
  274. reader_workbench/workbench/paths.py +44 -0
  275. reader_workbench/workbench/ports/__init__.py +31 -0
  276. reader_workbench/workbench/ports/model.py +168 -0
  277. reader_workbench/workbench/records/__init__.py +44 -0
  278. reader_workbench/workbench/records/epoch.py +329 -0
  279. reader_workbench/workbench/records/evidence.py +247 -0
  280. reader_workbench/workbench/records/identity.py +87 -0
  281. reader_workbench/workbench/records/locking.py +185 -0
  282. reader_workbench/workbench/records/model.py +711 -0
  283. reader_workbench/workbench/records/sources.py +73 -0
  284. reader_workbench/workbench/records/store.py +1022 -0
  285. reader_workbench/workbench/records/verification.py +998 -0
  286. reader_workbench/workbench/registry.py +333 -0
  287. reader_workbench/workbench/spec_overrides.py +215 -0
  288. reader_workbench-1.0.0.dist-info/METADATA +91 -0
  289. reader_workbench-1.0.0.dist-info/RECORD +293 -0
  290. reader_workbench-1.0.0.dist-info/WHEEL +5 -0
  291. reader_workbench-1.0.0.dist-info/entry_points.txt +2 -0
  292. reader_workbench-1.0.0.dist-info/licenses/LICENSE +21 -0
  293. reader_workbench-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,635 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ import typer
6
+ from rich import box
7
+ from rich.panel import Panel
8
+ from rich.table import Table
9
+
10
+ from reader_workbench.errors import ReaderError
11
+
12
+ from . import shared
13
+ from ._lazy import load as _load
14
+ from .helpers import (
15
+ ensure_active_lifecycle,
16
+ find_nearest_experiments_dir,
17
+ format_job_arg,
18
+ indexed_jobs,
19
+ infer_job_path,
20
+ load_job_models,
21
+ resolve_pipeline_step_id,
22
+ )
23
+ from .shared import (
24
+ app,
25
+ checkmark,
26
+ emit_json,
27
+ emit_json_error,
28
+ handle_reader_error,
29
+ normalize_flag,
30
+ normalize_lifecycle_filter,
31
+ normalize_output_format,
32
+ normalize_status_filter,
33
+ table,
34
+ )
35
+
36
+
37
+ @app.command(help="List experiments under a root (default: ./experiments).")
38
+ def ls(
39
+ root: str = typer.Option(
40
+ "./experiments",
41
+ "--root",
42
+ metavar="DIR",
43
+ help="Directory to search recursively for experiment directories.",
44
+ ),
45
+ include_scaffolds: bool = typer.Option(
46
+ False,
47
+ "--all",
48
+ help="Include scaffold and template directories too.",
49
+ ),
50
+ protocol: str | None = typer.Option(
51
+ None, "--protocol", metavar="ID", help="Only show experiments bound to the given protocol id."
52
+ ),
53
+ status: str | None = typer.Option(
54
+ None,
55
+ "--status",
56
+ metavar="STATE",
57
+ help="Only show experiments with status: ok | config_error.",
58
+ ),
59
+ lifecycle: str | None = typer.Option(
60
+ None,
61
+ "--lifecycle",
62
+ metavar="KIND",
63
+ help="Only show experiments with lifecycle: active | draft | template.",
64
+ ),
65
+ details: bool = typer.Option(
66
+ False,
67
+ "--details",
68
+ help="Show protocol id, selected steps, and generated output counts for each experiment.",
69
+ ),
70
+ readiness: bool = typer.Option(
71
+ False,
72
+ "--readiness",
73
+ help="With --details, run preflight and records checks for each experiment.",
74
+ ),
75
+ format: str = typer.Option(
76
+ "table",
77
+ "--format",
78
+ metavar="FMT",
79
+ help="Output format: table | json (default: table).",
80
+ ),
81
+ limit: int | None = typer.Option(
82
+ None,
83
+ "--limit",
84
+ metavar="N",
85
+ help="Maximum experiments per JSON page (default: 25; maximum: 100).",
86
+ ),
87
+ continuation: str | None = typer.Option(
88
+ None,
89
+ "--continuation",
90
+ metavar="TOKEN",
91
+ help="Opaque continuation token from a previous JSON page.",
92
+ ),
93
+ ):
94
+ include_scaffolds = normalize_flag(include_scaffolds)
95
+ details = normalize_flag(details)
96
+ readiness = normalize_flag(readiness)
97
+ fmt = normalize_output_format(format)
98
+ limit, continuation = shared.normalize_paging_options(limit, continuation)
99
+ shared.require_json_paging(format=fmt, limit=limit, continuation=continuation)
100
+ protocol_filter = protocol.strip() if isinstance(protocol, str) and protocol.strip() else None
101
+ status_filter = normalize_status_filter(status)
102
+ lifecycle_filter = normalize_lifecycle_filter(lifecycle)
103
+ if readiness and not details:
104
+ raise typer.BadParameter("--readiness requires --details")
105
+
106
+ root_path = (
107
+ find_nearest_experiments_dir(Path.cwd()) if str(root).strip() == "./experiments" else Path(root).resolve()
108
+ )
109
+ if not root_path.exists() or not root_path.is_dir():
110
+ raise typer.BadParameter(f"Experiments root not found: {root_path}")
111
+ job_inventory = indexed_jobs(root_path, include_scaffolds=include_scaffolds)
112
+ jobs = [job_path for _, job_path in job_inventory]
113
+ inspection_common = _load("reader_workbench.workbench.inspection.common")
114
+ inspection_inventory = _load("reader_workbench.workbench.inspection.inventory")
115
+ inspection_readiness = _load("reader_workbench.workbench.inspection.readiness")
116
+ inspection_runtime = _load("reader_workbench.workbench.inspection.runtime")
117
+
118
+ def emit_inventory_json(experiments: list[dict[str, object]]) -> None:
119
+ payload = inspection_inventory.inventory_surface_payload(
120
+ root=root_path,
121
+ include_scaffolds=include_scaffolds,
122
+ details=details,
123
+ readiness=readiness,
124
+ protocol=protocol_filter,
125
+ status=status_filter,
126
+ lifecycle=lifecycle_filter,
127
+ experiments=experiments,
128
+ )
129
+ page = shared.page_json_collection(
130
+ experiments,
131
+ key=lambda item: str(item["config"]),
132
+ surface="experiments",
133
+ selection={
134
+ "root": str(root_path),
135
+ "include_scaffolds": include_scaffolds,
136
+ "details": details,
137
+ "readiness": readiness,
138
+ "protocol": protocol_filter,
139
+ "status": status_filter,
140
+ "lifecycle": lifecycle_filter,
141
+ },
142
+ limit=limit,
143
+ continuation=continuation,
144
+ )
145
+ payload["experiments"] = list(page.items)
146
+ emit_json(
147
+ payload,
148
+ truncated=page.truncated,
149
+ continuation=page.continuation,
150
+ )
151
+
152
+ if not jobs:
153
+ if fmt == "json":
154
+ emit_inventory_json([])
155
+ return
156
+ shared.console.print(
157
+ Panel.fit(f"No experiments found under [path]{root_path}[/path].", border_style="warn", box=box.ROUNDED)
158
+ )
159
+ return
160
+
161
+ entries: list[dict[str, object]] = []
162
+ runtime = _load("reader_workbench.runtime").builtin_runtime() if details else None
163
+ for idx, config_path in job_inventory:
164
+ entry: dict[str, object] = {
165
+ "index": idx,
166
+ "name": config_path.parent.name,
167
+ "config": str(config_path),
168
+ "root": str(config_path.parent),
169
+ "protocol": None,
170
+ "lifecycle": None,
171
+ "generated": {"records": 0, "plots": 0, "exports": 0, "notebooks": 0},
172
+ "selected": None,
173
+ "has_outputs": False,
174
+ "status": "ok",
175
+ "error": None,
176
+ "readiness": None,
177
+ }
178
+ try:
179
+ if details:
180
+ spec, decl = load_job_models(config_path, runtime=runtime)
181
+ entry["selected"] = inspection_runtime.selected_plan_payload(spec=spec, decl=decl, runtime=runtime)
182
+ else:
183
+ spec = _load("reader_workbench.workbench.config").ReaderSpec.load(config_path)
184
+ entry["protocol"] = spec.protocol.id
185
+ entry["lifecycle"] = spec.experiment.lifecycle
186
+ outputs_dir = (config_path.parent / spec.paths.outputs).resolve()
187
+ counts = inspection_common.summarize_outputs_dir(
188
+ outputs_dir,
189
+ plots_subdir=spec.paths.plots,
190
+ exports_subdir=spec.paths.exports,
191
+ notebooks_subdir=spec.paths.notebooks,
192
+ )
193
+ entry["generated"] = counts
194
+ entry["has_outputs"] = any(counts.values())
195
+ if details:
196
+ entry["generated_examples"] = {
197
+ "records": inspection_common.preview_output_files(
198
+ outputs_dir / "artifacts", base=config_path.parent
199
+ ),
200
+ "plots": inspection_common.preview_output_files(
201
+ inspection_common.resolve_output_subdir(outputs_dir, spec.paths.plots), base=config_path.parent
202
+ ),
203
+ "exports": inspection_common.preview_output_files(
204
+ inspection_common.resolve_output_subdir(outputs_dir, spec.paths.exports),
205
+ base=config_path.parent,
206
+ ),
207
+ "notebooks": inspection_common.preview_output_files(
208
+ inspection_common.resolve_output_subdir(outputs_dir, spec.paths.notebooks),
209
+ base=config_path.parent,
210
+ ),
211
+ }
212
+ if readiness:
213
+ entry["readiness"] = inspection_readiness.experiment_readiness_payload(
214
+ job_path=config_path,
215
+ decl=decl,
216
+ runtime=runtime,
217
+ )
218
+ except ReaderError as err:
219
+ entry["status"] = "config_error"
220
+ entry["error"] = str(err)
221
+ if readiness:
222
+ entry["readiness"] = inspection_readiness.config_error_readiness_payload(str(err))
223
+ if protocol_filter and entry["protocol"] != protocol_filter:
224
+ continue
225
+ if status_filter and entry["status"] != status_filter:
226
+ continue
227
+ if lifecycle_filter and entry["lifecycle"] != lifecycle_filter:
228
+ continue
229
+ entries.append(entry)
230
+
231
+ if not entries:
232
+ if fmt == "json":
233
+ emit_inventory_json([])
234
+ return
235
+ filters = []
236
+ if protocol_filter:
237
+ filters.append(f"protocol={protocol_filter}")
238
+ if status_filter:
239
+ filters.append(f"status={status_filter}")
240
+ if lifecycle_filter:
241
+ filters.append(f"lifecycle={lifecycle_filter}")
242
+ suffix = f" for filters ({', '.join(filters)})" if filters else ""
243
+ shared.console.print(
244
+ Panel.fit(
245
+ f"No experiments found under [path]{root_path}[/path]{suffix}.",
246
+ border_style="warn",
247
+ box=box.ROUNDED,
248
+ )
249
+ )
250
+ return
251
+
252
+ if fmt == "json":
253
+ emit_inventory_json(entries)
254
+ return
255
+
256
+ inventory_summary = inspection_inventory.inventory_summary_payload(entries)
257
+ listing = table("Experiments")
258
+ listing.add_column("#", justify="right", style="muted")
259
+ name_values = [str(entry["name"]) for entry in entries]
260
+ max_name = max((len(name) for name in name_values), default=12)
261
+ max_width = int((shared.console.width or 80) * (0.35 if details else 0.6))
262
+ name_width = max(12, min(max_name + 2, max_width))
263
+ listing.add_column("Name", style="accent", max_width=name_width, overflow="ellipsis")
264
+ if details:
265
+ listing.add_column("Protocol", max_width=28, overflow="ellipsis")
266
+ listing.add_column("Lifecycle", width=10)
267
+ listing.add_column("Status", width=12)
268
+ listing.add_column("Selected", overflow="fold")
269
+ listing.add_column("Generated", overflow="fold")
270
+ if readiness:
271
+ listing.add_column("Readiness", overflow="fold")
272
+ listing.add_column("Issue", overflow="fold")
273
+ else:
274
+ listing.add_column("Outputs", justify="center", width=7)
275
+
276
+ for entry in entries:
277
+ status_value = str(entry["status"])
278
+ generated = dict(entry["generated"])
279
+ if details:
280
+ listing.add_row(
281
+ str(entry["index"]),
282
+ str(entry["name"]),
283
+ str(entry["protocol"] or "—"),
284
+ str(entry["lifecycle"] or "—"),
285
+ status_value,
286
+ inspection_runtime.selected_plan_summary(entry.get("selected") if isinstance(entry, dict) else None),
287
+ inspection_runtime.generated_summary(generated),
288
+ inspection_readiness.readiness_summary_text(entry.get("readiness") if isinstance(entry, dict) else None)
289
+ if readiness
290
+ else "",
291
+ str(entry["error"] or "—"),
292
+ )
293
+ else:
294
+ outputs_cell = "[error]ERR[/error]" if status_value != "ok" else checkmark(bool(entry["has_outputs"]))
295
+ listing.add_row(str(entry["index"]), str(entry["name"]), outputs_cell)
296
+ shared.console.print(
297
+ Panel(
298
+ listing,
299
+ border_style="accent",
300
+ box=box.ROUNDED,
301
+ subtitle=(
302
+ f"[muted]root: [path]{root_path}[/path] — {len(entries)} shown"
303
+ + (f" (protocol={protocol_filter})" if protocol_filter else "")
304
+ + (f" (status={status_filter})" if status_filter else "")
305
+ + (f" (lifecycle={lifecycle_filter})" if lifecycle_filter else "")
306
+ + "[/muted]"
307
+ ),
308
+ )
309
+ )
310
+ if details:
311
+ summary = Table(box=box.ROUNDED, expand=True, show_header=False)
312
+ summary.add_column("Field", style="accent", no_wrap=True)
313
+ summary.add_column("Value")
314
+ summary.add_row("Shown", str(len(entries)))
315
+ summary.add_row(
316
+ "Outputs",
317
+ (
318
+ f"{inventory_summary['outputs']['with_outputs']} with outputs"
319
+ f" • {inventory_summary['outputs']['without_outputs']} without outputs"
320
+ ),
321
+ )
322
+ status_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_status"]).items()]
323
+ summary.add_row("Status", ", ".join(status_bits) if status_bits else "—")
324
+ lifecycle_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_lifecycle"]).items()]
325
+ summary.add_row("Lifecycle", ", ".join(lifecycle_bits) if lifecycle_bits else "—")
326
+ protocol_bits = [f"{key}={value}" for key, value in dict(inventory_summary["by_protocol"]).items()]
327
+ summary.add_row("Protocols", ", ".join(protocol_bits) if protocol_bits else "—")
328
+ readiness_bits = [f"{key}={value}" for key, value in dict(inventory_summary.get("by_readiness") or {}).items()]
329
+ if readiness_bits:
330
+ summary.add_row("Readiness", ", ".join(readiness_bits))
331
+ shared.console.print(Panel(summary, border_style="accent", box=box.ROUNDED, title="Experiment summary"))
332
+
333
+
334
+ @app.command(help="Inspect one experiment: readiness, inputs, pipeline steps, plots, exports, and generated outputs.")
335
+ def inspect(
336
+ job: str | None = typer.Argument(
337
+ None,
338
+ metavar="[CONFIG]",
339
+ help=shared.JOB_ARG_HELP_WITH_DEFAULT,
340
+ ),
341
+ format: str = typer.Option(
342
+ "table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
343
+ ),
344
+ section: str | None = typer.Option(
345
+ None,
346
+ "--section",
347
+ metavar="NAME",
348
+ help=("JSON projection: identity | authoring | semantics | plan | compiled | inputs | generated | readiness."),
349
+ ),
350
+ ):
351
+ try:
352
+ job_path = infer_job_path(job)
353
+ spec, decl = load_job_models(job_path)
354
+ except ReaderError as err:
355
+ handle_reader_error(err)
356
+ fmt = normalize_output_format(format)
357
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
358
+ inspection_experiments = _load("reader_workbench.workbench.inspection.experiments")
359
+ selected_section = shared.normalize_semantic_section(
360
+ section,
361
+ allowed=inspection_experiments.EXPERIMENT_INSPECT_SECTIONS,
362
+ format=fmt,
363
+ )
364
+ payload = inspection_experiments.experiment_inspect_payload(
365
+ job_path=job_path, spec=spec, decl=decl, runtime=runtime
366
+ )
367
+ if fmt == "json":
368
+ if selected_section is not None:
369
+ payload = inspection_experiments.experiment_inspect_section_payload(
370
+ payload,
371
+ section=selected_section,
372
+ )
373
+ emit_json(
374
+ payload,
375
+ projection=f"section:{selected_section}" if selected_section is not None else "full",
376
+ )
377
+ return
378
+ semantic_program = decl.experiment_semantics.protocol_program
379
+ for renderable in _load("reader_workbench.workbench.inspection.reports").experiment_inspect_renderables(
380
+ payload=payload,
381
+ semantic_program=semantic_program,
382
+ ):
383
+ shared.console.print(renderable)
384
+
385
+
386
+ @app.command(help="Show planned steps and contracts (no execution).")
387
+ def explain(
388
+ job: str | None = typer.Argument(
389
+ None,
390
+ metavar="[CONFIG]",
391
+ help=shared.JOB_ARG_HELP_WITH_DEFAULT,
392
+ ),
393
+ format: str = typer.Option(
394
+ "table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
395
+ ),
396
+ ):
397
+ try:
398
+ job_path = infer_job_path(job)
399
+ spec, decl = load_job_models(job_path)
400
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
401
+ fmt = normalize_output_format(format)
402
+ if fmt == "json":
403
+ emit_json(
404
+ _load("reader_workbench.workbench.inspection.experiments").experiment_explain_payload(
405
+ job_path=job_path, spec=spec, decl=decl, runtime=runtime
406
+ )
407
+ )
408
+ return
409
+ _load("reader_workbench.workbench.engine").explain(decl, console=shared.console, runtime=runtime)
410
+ except ReaderError as err:
411
+ handle_reader_error(err)
412
+
413
+
414
+ @app.command(help="Validate config, plugin params, reads wiring, and input files.")
415
+ def validate(
416
+ job: str | None = typer.Argument(
417
+ None,
418
+ metavar="[CONFIG]",
419
+ help=shared.JOB_ARG_HELP_WITH_DEFAULT,
420
+ ),
421
+ no_files: bool = typer.Option(False, "--no-files", help="Skip file existence checks (config-only validation)."),
422
+ format: str = typer.Option(
423
+ "table", "--format", metavar="FMT", help="Output format: table | json (default: table)."
424
+ ),
425
+ ):
426
+ try:
427
+ job_path = infer_job_path(job)
428
+ _, decl = load_job_models(job_path)
429
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
430
+ fmt = normalize_output_format(format)
431
+ if fmt == "json":
432
+ summary = _load("reader_workbench.workbench.engine").validation_summary(
433
+ decl, check_files=not no_files, exp_root=decl.experiment.root, runtime=runtime
434
+ )
435
+ if summary["status"] != "ok":
436
+ errors = list(summary.get("errors") or [])
437
+ emit_json_error(
438
+ code="validation_failed",
439
+ field="experiment",
440
+ reason="; ".join(str(error) for error in errors) or "Experiment validation failed.",
441
+ remediation="Correct the reported configuration, binding, dependency, or input issue, then validate again.",
442
+ )
443
+ raise typer.Exit(code=1)
444
+ emit_json(
445
+ _load("reader_workbench.workbench.inspection.validation").validation_surface_payload(
446
+ experiment=_load("reader_workbench.workbench.inspection.experiments").experiment_identity_payload(
447
+ job_path=job_path, decl=decl
448
+ ),
449
+ check_files=not no_files,
450
+ summary=summary,
451
+ )
452
+ )
453
+ return
454
+ summary = _load("reader_workbench.workbench.engine").validate(
455
+ decl,
456
+ console=shared.console,
457
+ check_files=not no_files,
458
+ exp_root=decl.experiment.root,
459
+ runtime=runtime,
460
+ )
461
+ if summary["status"] != "ok":
462
+ raise typer.Exit(code=1)
463
+ except ReaderError as err:
464
+ handle_reader_error(err)
465
+
466
+
467
+ @app.command(help="Print the config plus compiled runtime plan.")
468
+ def config(
469
+ job: str | None = typer.Argument(
470
+ None,
471
+ metavar="[CONFIG]",
472
+ help=shared.JOB_ARG_HELP_WITH_DEFAULT,
473
+ ),
474
+ format: str = typer.Option("yaml", "--format", metavar="FMT", help="Output format: yaml | json (default: yaml)."),
475
+ ):
476
+ try:
477
+ job_path = infer_job_path(job)
478
+ spec, decl = load_job_models(job_path)
479
+ except ReaderError as err:
480
+ handle_reader_error(err)
481
+ fmt = str(format).strip().lower()
482
+ if fmt == "json":
483
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
484
+ emit_json(
485
+ _load("reader_workbench.workbench.inspection.experiments").experiment_config_json_payload(
486
+ job_path=job_path, spec=spec, decl=decl, runtime=runtime
487
+ )
488
+ )
489
+ return
490
+ if fmt == "yaml":
491
+ payload = spec.model_dump(by_alias=True)
492
+ materialized = _load("reader_workbench.workbench.graph").materialize_workbench(decl)
493
+ payload["compiled"] = {
494
+ "pipeline": materialized["pipeline"],
495
+ "plots": materialized["plots"],
496
+ "exports": materialized["exports"],
497
+ }
498
+ typer.echo(_load("yaml").safe_dump(payload, sort_keys=False))
499
+ return
500
+ raise typer.BadParameter("format must be 'yaml' or 'json'")
501
+
502
+
503
+ @app.command(help="Run pipeline to generate dataframe records.")
504
+ def run(
505
+ job: str | None = typer.Argument(
506
+ None,
507
+ metavar="[CONFIG]",
508
+ help=shared.JOB_ARG_HELP_WITH_DEFAULT,
509
+ ),
510
+ from_step: str | None = typer.Option(
511
+ None,
512
+ "--from",
513
+ metavar="STEP_ID",
514
+ help="Start from this pipeline step (inclusive). Use an exact id as declared in the config.",
515
+ ),
516
+ until: str | None = typer.Option(
517
+ None,
518
+ "--until",
519
+ metavar="STEP_ID",
520
+ help="Stop after this step (inclusive). Use an exact id as declared in the config.",
521
+ ),
522
+ only: str | None = typer.Option(None, "--only", metavar="STEP_ID", help="Run exactly one pipeline step by id."),
523
+ reset_records: bool = typer.Option(
524
+ False,
525
+ "--reset-records",
526
+ help="Start a fresh generated-output epoch before a complete pipeline rerun.",
527
+ ),
528
+ dry_run: bool = typer.Option(
529
+ False, "--dry-run", help="Plan only: validate and print the plan without executing steps."
530
+ ),
531
+ format: str = typer.Option(
532
+ "table", "--format", metavar="FMT", help="Output format for --dry-run: table | json (default: table)."
533
+ ),
534
+ log_level: str = typer.Option(
535
+ "INFO",
536
+ "--log-level",
537
+ metavar="LEVEL",
538
+ help="Logging level: DEBUG | INFO | WARNING | ERROR | CRITICAL (default: INFO).",
539
+ ),
540
+ compact: bool = typer.Option(False, "--compact", help="Use concise progress output instead of per-step logs."),
541
+ ):
542
+ job_path = infer_job_path(job)
543
+ if only and (from_step or until):
544
+ raise typer.BadParameter("--only cannot be combined with --from/--until")
545
+ if reset_records and (only or from_step or until):
546
+ raise typer.BadParameter("--reset-records requires a complete run without --only, --from, or --until")
547
+ if reset_records and dry_run:
548
+ raise typer.BadParameter("--reset-records cannot be combined with --dry-run")
549
+
550
+ try:
551
+ spec, decl = load_job_models(job_path)
552
+ except ReaderError as err:
553
+ handle_reader_error(err)
554
+ fmt = normalize_output_format(format)
555
+ if fmt == "json" and not dry_run:
556
+ raise typer.BadParameter("--format json is only supported with --dry-run")
557
+ try:
558
+ _load("reader_workbench.workbench.engine").normalize_log_level(log_level)
559
+ except ReaderError as err:
560
+ handle_reader_error(err)
561
+ if not dry_run:
562
+ ensure_active_lifecycle(decl, job_path, command_name="run")
563
+
564
+ if only:
565
+ resolve_pipeline_step_id(decl, only, job_path=job_path)
566
+ try:
567
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
568
+ if dry_run and fmt == "json":
569
+ emit_json(
570
+ _load("reader_workbench.workbench.inspection.experiments").experiment_run_dry_run_payload(
571
+ job_path=job_path,
572
+ spec=spec,
573
+ decl=decl,
574
+ runtime=runtime,
575
+ resume_from=None,
576
+ until=None,
577
+ only=only,
578
+ )
579
+ )
580
+ return
581
+ _load("reader_workbench.workbench.engine").run_job(
582
+ job_path,
583
+ resume_from=only,
584
+ until=only,
585
+ dry_run=dry_run,
586
+ log_level=log_level,
587
+ verbose=not compact,
588
+ console=shared.console,
589
+ include_pipeline=True,
590
+ include_plots=False,
591
+ include_exports=False,
592
+ job_label=format_job_arg(job),
593
+ show_next_steps=True,
594
+ runtime=runtime,
595
+ )
596
+ except ReaderError as err:
597
+ handle_reader_error(err)
598
+ return
599
+
600
+ if from_step:
601
+ resolve_pipeline_step_id(decl, from_step, job_path=job_path)
602
+ if until:
603
+ resolve_pipeline_step_id(decl, until, job_path=job_path)
604
+ try:
605
+ runtime = _load("reader_workbench.runtime").builtin_runtime()
606
+ if dry_run and fmt == "json":
607
+ emit_json(
608
+ _load("reader_workbench.workbench.inspection.experiments").experiment_run_dry_run_payload(
609
+ job_path=job_path,
610
+ spec=spec,
611
+ decl=decl,
612
+ runtime=runtime,
613
+ resume_from=from_step,
614
+ until=until,
615
+ )
616
+ )
617
+ return
618
+ _load("reader_workbench.workbench.engine").run_job(
619
+ job_path,
620
+ resume_from=from_step,
621
+ until=until,
622
+ reset_records=reset_records,
623
+ dry_run=dry_run,
624
+ log_level=log_level,
625
+ verbose=not compact,
626
+ console=shared.console,
627
+ include_pipeline=True,
628
+ include_plots=False,
629
+ include_exports=False,
630
+ job_label=format_job_arg(job),
631
+ show_next_steps=True,
632
+ runtime=runtime,
633
+ )
634
+ except ReaderError as err:
635
+ handle_reader_error(err)