scout-rig 0.2.6 → 0.2.7
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.
- checksums.yaml +4 -4
- data/.vimproject +31 -13
- data/README.md +27 -4
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/doc/Improvements.md +396 -0
- data/doc/StartHere.md +95 -0
- data/doc/developer/Architecture.md +232 -0
- data/doc/developer/DataConversionInternals.md +407 -0
- data/doc/developer/DesignPrinciples.md +254 -0
- data/doc/developer/PythonTaskRunnerInternals.md +371 -0
- data/doc/developer/PythonWorkflowInternals.md +539 -0
- data/doc/developer/ScoutPythonInternals.md +504 -0
- data/doc/user/Cookbook.md +337 -0
- data/doc/user/DefiningPythonTasks.md +708 -0
- data/doc/user/DrivingWorkflowsFromPython.md +418 -0
- data/doc/user/IteratingPythonData.md +142 -0
- data/doc/user/PassingDataToPython.md +223 -0
- data/doc/user/PythonEnvironments.md +197 -0
- data/doc/user/RunningPythonFromRuby.md +267 -0
- data/doc/user/ScriptingPython.md +281 -0
- data/doc/user/TestingAndPackaging.md +487 -0
- data/lib/scout/python/script.rb +11 -2
- data/lib/scout/workflow/python/inputs.rb +33 -23
- data/lib/scout/workflow/python/task.rb +219 -22
- data/lib/scout/workflow/python.rb +236 -9
- data/lib/scout-rig/testing/availability.rb +608 -0
- data/python/README.md +51 -0
- data/python/scout/__init__.py +2 -0
- data/python/scout/runner.py +193 -29
- data/python/scout/task_errors.py +6 -0
- data/research/00_scope_and_themes.md +131 -0
- data/research/data-conversion-and-scripting-analysis.md +209 -0
- data/research/design-philosophy-analysis.md +246 -0
- data/research/python-helper-package-analysis.md +272 -0
- data/research/pythonworkflow-analysis.md +199 -0
- data/research/scoutpython-bridge-analysis.md +185 -0
- data/research/synthesis-report.md +109 -0
- data/research/testing-availability-baseline.md +1625 -0
- data/research/testing-availability-final-report.md +500 -0
- data/research/validation-report.md +149 -0
- data/scout-rig.gemspec +35 -5
- data/test/scout/python/test_util.rb +13 -0
- data/test/scout/test_python.rb +10 -0
- data/test/scout/workflow/python/test_task.rb +1119 -1
- data/test/scout-rig/testing/test_availability.rb +495 -0
- data/test/scout-rig/testing/test_test_support.rb +166 -0
- data/test/test_helper.rb +96 -19
- metadata +47 -4
- data/doc/Python.md +0 -482
- data/doc/PythonWorkflow.md +0 -163
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3d50eb8dc414e471cb7a70228c89d56549a3b4799726ce94c8fe67e21b8a6d0
|
|
4
|
+
data.tar.gz: fc12a6faa89c9043382c7a6263d34651cabbfaba5f3ee4770ac979db104f9a82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40821d00c5b64f094170c24ff54720465018a8079cfa63861b239b381569b53f423c81d4bea7e2d37c651eaafc9f3296a134bf86abdeac7c2dd07f33cb519f36
|
|
7
|
+
data.tar.gz: 7ed1e7e3bd5d7b0891b9636037c9fe97af70eee5fac369114956a77347648e2143dbd04f204afce9a4e5534a490d6940caedd4431917ae65f499b3cfc506ff3d
|
data/.vimproject
CHANGED
|
@@ -4,17 +4,7 @@ scout-rig=/$PWD filter="*" {
|
|
|
4
4
|
Rakefile
|
|
5
5
|
chats=chats{
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
python_workflow
|
|
10
|
-
|
|
11
|
-
python_init
|
|
12
|
-
|
|
13
|
-
python_pycall
|
|
14
|
-
|
|
15
|
-
python_multi
|
|
16
|
-
|
|
17
|
-
docstring
|
|
7
|
+
biomodel_fix
|
|
18
8
|
}
|
|
19
9
|
lib=lib {
|
|
20
10
|
scout-rig.rb
|
|
@@ -37,6 +27,15 @@ scout-rig=/$PWD filter="*" {
|
|
|
37
27
|
}
|
|
38
28
|
test=test{
|
|
39
29
|
test_helper.rb
|
|
30
|
+
scout=scout{
|
|
31
|
+
test_python.rb
|
|
32
|
+
workflow=workflow{
|
|
33
|
+
test_python.rb
|
|
34
|
+
python=python{
|
|
35
|
+
test_task.rb
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
40
39
|
}
|
|
41
40
|
python=python filter="*.py"{
|
|
42
41
|
test.py
|
|
@@ -50,7 +49,26 @@ scout-rig=/$PWD filter="*" {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
doc=doc{
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
Improvements.md
|
|
53
|
+
StartHere.md
|
|
54
|
+
developer=developer{
|
|
55
|
+
Architecture.md
|
|
56
|
+
DataConversionInternals.md
|
|
57
|
+
DesignPrinciples.md
|
|
58
|
+
PythonTaskRunnerInternals.md
|
|
59
|
+
PythonWorkflowInternals.md
|
|
60
|
+
ScoutPythonInternals.md
|
|
61
|
+
}
|
|
62
|
+
user=user{
|
|
63
|
+
Cookbook.md
|
|
64
|
+
DefiningPythonTasks.md
|
|
65
|
+
DrivingWorkflowsFromPython.md
|
|
66
|
+
IteratingPythonData.md
|
|
67
|
+
PassingDataToPython.md
|
|
68
|
+
PythonEnvironments.md
|
|
69
|
+
RunningPythonFromRuby.md
|
|
70
|
+
ScriptingPython.md
|
|
71
|
+
TestingAndPackaging.md
|
|
72
|
+
}
|
|
55
73
|
}
|
|
56
74
|
}
|
data/README.md
CHANGED
|
@@ -14,9 +14,10 @@ For broader background and many real workflow examples, see Rbbt (the bioinforma
|
|
|
14
14
|
- https://github.com/mikisvaz/rbbt
|
|
15
15
|
- https://github.com/Rbbt-Workflows
|
|
16
16
|
|
|
17
|
-
This README focuses on the Python bridge in scout-rig (ScoutPython). See
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
This README focuses on the Python bridge in scout-rig (ScoutPython). See
|
|
18
|
+
[doc/StartHere.md](doc/StartHere.md) for the full reference material: user
|
|
19
|
+
guides in doc/user/, internals in doc/developer/, and investigation notes in
|
|
20
|
+
research/.
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -62,6 +63,28 @@ Add scout-rig to your Ruby project (Gemfile or local checkout), then ensure Pyth
|
|
|
62
63
|
|
|
63
64
|
---
|
|
64
65
|
|
|
66
|
+
## Development and testing
|
|
67
|
+
|
|
68
|
+
The repository tests itself with `rake test` (a `Rake::TestTask` over
|
|
69
|
+
`test/**/test_*.rb`). The suite needs a Python environment whose interpreter
|
|
70
|
+
is reachable as `python` on `PATH` (both the in-process PyCall route and the
|
|
71
|
+
`script()`/`run_file` subprocess route use it). Optional test prerequisites
|
|
72
|
+
such as `torch` are gated with scout-rig's opt-in availability probes
|
|
73
|
+
(`require 'scout-rig/testing/availability'`), so a plain `rake test` reports
|
|
74
|
+
an honest *omission* naming the missing module instead of erroring:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
omit("torch not importable: #{ScoutRig::Testing::Availability.python_modules_reason('torch', route: :embedded)}") \
|
|
78
|
+
unless ScoutRig::Testing::Availability.python_modules?('torch', route: :embedded)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See [doc/user/TestingAndPackaging.md](doc/user/TestingAndPackaging.md)
|
|
82
|
+
for the full picture: interpreter selection via `PATH`/`PYTHON`, per-file
|
|
83
|
+
prerequisites, individual test commands, and how to build the gem
|
|
84
|
+
(`rake gemspec` then `rake build`) and the Python package.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
65
88
|
## Quick start
|
|
66
89
|
|
|
67
90
|
Execute Python directly from Ruby:
|
|
@@ -267,7 +290,7 @@ scout-rig itself does not register standalone CLI commands; instead, its Python
|
|
|
267
290
|
|
|
268
291
|
## Reference
|
|
269
292
|
|
|
270
|
-
Read the full
|
|
293
|
+
Read the full documentation set from [doc/StartHere.md](doc/StartHere.md) — user guides in doc/user/, internals in doc/developer/. For core building blocks referenced above, see these docs in scout-essentials and scout-gear:
|
|
271
294
|
|
|
272
295
|
- Annotation.md, CMD.md, ConcurrentStream.md, IndiferentHash.md, Log.md, Open.md, Path.md, Persist.md, TmpFile.md
|
|
273
296
|
- TSV.md, Workflow.md, KnowledgeBase.md, Association.md, Entity.md, WorkQueue.md, Semaphore.md
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.7
|
data/doc/Improvements.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# Improvements
|
|
2
|
+
|
|
3
|
+
This document lists actionable recommendations for code improvements in
|
|
4
|
+
scout-rig, discovered during the documentation investigation. Items are
|
|
5
|
+
categorized by type and marked with a status.
|
|
6
|
+
|
|
7
|
+
Status legend: ☐ Open · ✓ Resolved · ◐ Partially resolved ·
|
|
8
|
+
● Verified open (confirmed at HEAD, no code change yet) ·
|
|
9
|
+
✗ Withdrawn (premise disproved by probe)
|
|
10
|
+
|
|
11
|
+
Statuses below were reconciled in the 2026-09-12 documentation-completion
|
|
12
|
+
campaign against the probe evidence recorded in the Cortex artifacts under
|
|
13
|
+
`scout-rig/subsys/`. Each item names the artifact that carries the evidence.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Bugs
|
|
18
|
+
|
|
19
|
+
### B1. Unused `err` variable in `read_python_metadata`
|
|
20
|
+
|
|
21
|
+
**Status:** ● Resolved — the raise no longer interpolates the undefined
|
|
22
|
+
local; it reads `raise "Error getting metadata from #{file}" unless
|
|
23
|
+
out.exit_status == 0`. In practice `ScoutPython.run_file` → `CMD.cmd`
|
|
24
|
+
still raises `ProcessFailed` on a non-zero exit before this check runs, so
|
|
25
|
+
the user-facing failure remains a `ProcessFailed` with the interpreter's
|
|
26
|
+
stderr embedded; the previously misquoted message ("for
|
|
27
|
+
#{File.basename(file)}: #{err}") never existed in that form at this site.
|
|
28
|
+
|
|
29
|
+
**Location:** `lib/scout/workflow/python/task.rb`
|
|
30
|
+
|
|
31
|
+
The historical issue: the raise referenced an `err` local that was never
|
|
32
|
+
assigned, and the line was unreachable in practice because `CMD.cmd`
|
|
33
|
+
raises `ProcessFailed` first.
|
|
34
|
+
|
|
35
|
+
### B2. `at_exit` hook kills all non-main threads
|
|
36
|
+
|
|
37
|
+
**Status:** ● Verified open — confirmed and worse than described: killing
|
|
38
|
+
foreign threads reproduced directly, and the threaded path never exits
|
|
39
|
+
cleanly (hang or segfault), with or without `stop_thread` (evidence:
|
|
40
|
+
`scout-rig/subsys/python-bridge.md`; user-facing consequences documented in
|
|
41
|
+
[Running Python from Ruby](user/RunningPythonFromRuby.md) and
|
|
42
|
+
[ScoutPython Internals](developer/ScoutPythonInternals.md))
|
|
43
|
+
|
|
44
|
+
**Location:** `lib/scout/python/run.rb` — `init_scout`
|
|
45
|
+
|
|
46
|
+
The at_exit hook iterates all threads and kills them:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
at_exit do
|
|
50
|
+
GC.start
|
|
51
|
+
Thread.list.each do |thread|
|
|
52
|
+
next if thread == Thread.main
|
|
53
|
+
thread.kill
|
|
54
|
+
thread.join rescue nil
|
|
55
|
+
end
|
|
56
|
+
GC.start
|
|
57
|
+
PyCall.builtins.object # GIL health check
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This kills ALL non-main threads, not just the ScoutPython background thread.
|
|
62
|
+
This could interfere with other threading code in the host process.
|
|
63
|
+
|
|
64
|
+
**Fix:** Track the ScoutPython thread explicitly and only kill that one:
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
at_exit do
|
|
68
|
+
ScoutPython.stop_thread if ScoutPython.thread && ScoutPython.thread.alive?
|
|
69
|
+
GC.start
|
|
70
|
+
PyCall.builtins.object
|
|
71
|
+
end
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### B3. `binding_run` ignores its `binding` parameter
|
|
75
|
+
|
|
76
|
+
**Status:** ● Verified open — confirmed in code and by probe; documented
|
|
77
|
+
as actual behaviour (parameter ignored, `new_binding` always used) in
|
|
78
|
+
[Running Python from Ruby](user/RunningPythonFromRuby.md), with the
|
|
79
|
+
`new_binding` + `instance_exec` reuse pattern as the workaround (evidence:
|
|
80
|
+
`scout-rig/subsys/python-bridge.md`)
|
|
81
|
+
|
|
82
|
+
**Location:** `lib/scout/python.rb`
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
def self.binding_run(binding = nil, *args, &block)
|
|
86
|
+
binding = new_binding # parameter overwritten!
|
|
87
|
+
binding.instance_exec(*args, &block)
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The `binding` parameter is overwritten by `new_binding`. If a caller passes
|
|
92
|
+
a binding, it is silently ignored.
|
|
93
|
+
|
|
94
|
+
**Fix:** Respect the parameter:
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
def self.binding_run(binding = nil, *args, &block)
|
|
98
|
+
binding ||= new_binding
|
|
99
|
+
binding.instance_exec(*args, &block)
|
|
100
|
+
end
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### B4. Dead code: `save_inputs` in Python `workflow.py`
|
|
104
|
+
|
|
105
|
+
**Status:** ● Verified open — still a `return`-only stub at HEAD, never
|
|
106
|
+
called anywhere in `python/`, `lib/`, `test/` or `Rakefile` (evidence:
|
|
107
|
+
`scout-rig/subsys/python-package.md`)
|
|
108
|
+
|
|
109
|
+
**Location:** `python/scout/workflow.py`
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
def save_inputs(directory, inputs, types):
|
|
113
|
+
return
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This function is a stub that does nothing. It is never called with non-trivial
|
|
117
|
+
arguments and never returns anything useful.
|
|
118
|
+
|
|
119
|
+
**Fix:** Either implement it or remove it. If it was intended to implement
|
|
120
|
+
the `save_job_inputs` logic, it should be completed. Otherwise remove the
|
|
121
|
+
stub to avoid confusion.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Outdated / Incomplete
|
|
126
|
+
|
|
127
|
+
### O1. No metadata caching
|
|
128
|
+
|
|
129
|
+
**Status:** ● Verified open — confirmed; ~0.42–0.48 s per registration,
|
|
130
|
+
interpreter startup dominating, linear in file count (evidence:
|
|
131
|
+
`scout-rig/subsys/pythonworkflow.md`)
|
|
132
|
+
|
|
133
|
+
**Location:** `lib/scout/workflow/python/task.rb`
|
|
134
|
+
|
|
135
|
+
Every `python_task` call runs a Python subprocess to read metadata:
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
metas = read_python_metadata(file)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For workflows with many Python tasks, this spawns N Python processes at
|
|
142
|
+
definition time, which can be slow.
|
|
143
|
+
|
|
144
|
+
**Suggestion:** Cache metadata results. Options:
|
|
145
|
+
- Cache by file mtime (if file hasn't changed, reuse cached metadata).
|
|
146
|
+
- Read metadata from all files in a directory in a single subprocess call.
|
|
147
|
+
|
|
148
|
+
### O2. `process_paths` called multiple times without deduplication
|
|
149
|
+
|
|
150
|
+
**Status:** ● Verified open — refined: main-thread modes append the Scout
|
|
151
|
+
directory once per `run` (8→9→10 over three calls); `run_threaded` is
|
|
152
|
+
stable because `init_thread` only re-runs `process_paths` when recreating
|
|
153
|
+
the thread (evidence: `scout-rig/subsys/python-bridge.md`; quantified in
|
|
154
|
+
[ScoutPython Internals](developer/ScoutPythonInternals.md))
|
|
155
|
+
|
|
156
|
+
*(Verified — see the status above.)* `process_paths` is called in
|
|
157
|
+
`init_scout`, `run_simple`, and `init_thread`. If `add_paths` or
|
|
158
|
+
`Scout.python.find_all`
|
|
159
|
+
produces overlapping paths, they may accumulate as duplicates in
|
|
160
|
+
`sys.path`.
|
|
161
|
+
|
|
162
|
+
**Suggestion:** Deduplicate paths before appending, or check if a path is
|
|
163
|
+
already in `sys.path` before appending.
|
|
164
|
+
|
|
165
|
+
### O3. `info` command may be outdated (scout-ai cross-reference)
|
|
166
|
+
|
|
167
|
+
**Status:** ☐ Open (out of scope for this repository — scout-ai issue)
|
|
168
|
+
|
|
169
|
+
This is a scout-ai issue, not a scout-rig issue. Listed here because
|
|
170
|
+
scout-rig's documentation references scout-ai's provenance system. See
|
|
171
|
+
[scout-ai Improvements](https://github.com/mikisvaz/scout-ai/blob/main/doc/Improvements.md).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Architecture / Design
|
|
176
|
+
|
|
177
|
+
### A1. `script()` exception handling
|
|
178
|
+
|
|
179
|
+
**Status:** ◐ Partially resolved — narrower than described: the *last*
|
|
180
|
+
traceback line is already embedded in the exception message, and the full
|
|
181
|
+
traceback reaches the Scout log at DEBUG severity. Documented in
|
|
182
|
+
[Scripting Python](user/ScriptingPython.md) and
|
|
183
|
+
[Data Conversion Internals](developer/DataConversionInternals.md)
|
|
184
|
+
(evidence: `scout-rig/subsys/data-conversion.md`)
|
|
185
|
+
|
|
186
|
+
**Location:** `lib/scout/python/script.rb`
|
|
187
|
+
|
|
188
|
+
When `script()` calls a Python subprocess that errors, the error is raised
|
|
189
|
+
as `ConcurrentStreamProcessFailed`. The current error message does not
|
|
190
|
+
include the Python traceback.
|
|
191
|
+
|
|
192
|
+
**Suggestion:** Capture and include the Python traceback in the exception
|
|
193
|
+
message.
|
|
194
|
+
|
|
195
|
+
### A2. Return value decoding ambiguity
|
|
196
|
+
|
|
197
|
+
**Status:** ● Verified open — confirmed end-to-end (`"[1, 2, 3]"` decodes
|
|
198
|
+
to Ruby `[1, 2, 3]`, `"1"` to `1`); documented as a decoding caveat in
|
|
199
|
+
[PythonWorkflow Internals](developer/PythonWorkflowInternals.md) and
|
|
200
|
+
[Defining Python Tasks](user/DefiningPythonTasks.md) (evidence:
|
|
201
|
+
`scout-rig/subsys/pythonworkflow.md`)
|
|
202
|
+
|
|
203
|
+
**Location:** `lib/scout/workflow/python/task.rb`
|
|
204
|
+
|
|
205
|
+
If a Python function returns a string that happens to be valid JSON (e.g.,
|
|
206
|
+
`"[1, 2, 3]"`), Ruby will JSON-parse it into a Ruby array instead of
|
|
207
|
+
keeping it as a string.
|
|
208
|
+
|
|
209
|
+
**Suggestion:** Add an explicit return type marker (e.g., a wrapper format)
|
|
210
|
+
or respect the declared return type strictly during decoding.
|
|
211
|
+
|
|
212
|
+
### A3. List input comma-split ambiguity
|
|
213
|
+
|
|
214
|
+
**Status:** ● Resolved (2026-11-23 simplification pass) — the deprecated
|
|
215
|
+
filename-to-lines expansion and its `python_literal_lists` flag are
|
|
216
|
+
removed outright: the bridge serializes an `Array` list value literally,
|
|
217
|
+
full stop, and a `String` list value is comma-split only, never read from
|
|
218
|
+
disk. Passing an `Array` keeps comma-containing elements intact. The
|
|
219
|
+
remaining sharp edges (bare `-`-prefixed elements still break argparse,
|
|
220
|
+
exit 2; the Scout input layer may still expand a bare-filename `String`
|
|
221
|
+
into its lines before the task block runs — Scout-native behaviour, out
|
|
222
|
+
of scope) are documented in
|
|
223
|
+
[Defining Python Tasks](user/DefiningPythonTasks.md) and
|
|
224
|
+
[PythonWorkflow Internals](developer/PythonWorkflowInternals.md)
|
|
225
|
+
(evidence: `scout-rig/subsys/pythonworkflow.md`)
|
|
226
|
+
|
|
227
|
+
**Location:** `lib/scout/workflow/python/inputs.rb`
|
|
228
|
+
|
|
229
|
+
In `build_python_argv`, list inputs with string values are split by comma:
|
|
230
|
+
|
|
231
|
+
```ruby
|
|
232
|
+
# If value is a String, split by comma
|
|
233
|
+
values = value.split(",")
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
If the actual data contains commas (e.g., gene names with commas, file
|
|
237
|
+
paths with commas), this will incorrectly split the value.
|
|
238
|
+
|
|
239
|
+
**Delivered design (superseded):** the flag-based mitigation was replaced
|
|
240
|
+
in the 2026-11-23 simplification pass by outright removal — the bridge's
|
|
241
|
+
filename-expansion branch no longer exists, so there is no legacy mode to
|
|
242
|
+
opt into. `['a,b']` (an `Array`) is passed faithfully and is the
|
|
243
|
+
recommended spelling for comma-bearing elements.
|
|
244
|
+
|
|
245
|
+
### A4. `path` return type maps to `:string`
|
|
246
|
+
|
|
247
|
+
**Status:** ● Verified open — confirmed: input `path` maps to `:file` but
|
|
248
|
+
return `path` maps to `:string`; the asymmetry is documented as a known
|
|
249
|
+
issue in [PythonWorkflow Internals](developer/PythonWorkflowInternals.md)
|
|
250
|
+
(evidence: `scout-rig/subsys/pythonworkflow.md`)
|
|
251
|
+
|
|
252
|
+
**Location:** `lib/scout/workflow/python/task.rb`
|
|
253
|
+
|
|
254
|
+
When a Python function's return annotation is `pathlib.Path`, it maps to
|
|
255
|
+
Scout `:string` return type:
|
|
256
|
+
|
|
257
|
+
```ruby
|
|
258
|
+
when "path"
|
|
259
|
+
:string
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
This means downstream tasks receiving this result will treat it as a
|
|
263
|
+
string, not as a file. This could cause issues with Scout's file-type
|
|
264
|
+
checking.
|
|
265
|
+
|
|
266
|
+
**Suggestion:** Consider mapping `path` returns to `:file` instead, or
|
|
267
|
+
adding a separate `:path` return type.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Missing features / Documentation gaps
|
|
272
|
+
|
|
273
|
+
### M1. No streaming Python iterator support
|
|
274
|
+
|
|
275
|
+
**Status:** ✗ Withdrawn — the premise is false. `iterate` *is* lazy: a
|
|
276
|
+
generator's `__next__` is called only when the Ruby block asks for the
|
|
277
|
+
next element (probe: interleaved pull/consume log, 2026-09-12), so
|
|
278
|
+
streaming already exists today via `iterate`; documented in
|
|
279
|
+
[Iterating Python Data](user/IteratingPythonData.md)
|
|
280
|
+
|
|
281
|
+
*(The original description below is inaccurate — see the status above:
|
|
282
|
+
`iterate` pulls elements lazily, one per block iteration, and is not
|
|
283
|
+
verified to materialize anything up front.)*
|
|
284
|
+
|
|
285
|
+
The `iterate` helper collects all elements by default. There is no way to
|
|
286
|
+
stream elements one at a time from a Python generator to Ruby without
|
|
287
|
+
loading them all into memory.
|
|
288
|
+
|
|
289
|
+
**Suggestion:** Add a streaming iteration mode that yields elements as they
|
|
290
|
+
are produced by the Python generator.
|
|
291
|
+
|
|
292
|
+
### M2. No Python-side documentation for the `scout` package
|
|
293
|
+
|
|
294
|
+
**Status:** ✓ Resolved (by documentation) — `python/README.md` plus
|
|
295
|
+
[Driving Workflows from Python](user/DrivingWorkflowsFromPython.md) and
|
|
296
|
+
[Defining Python Tasks](user/DefiningPythonTasks.md) now cover the Python
|
|
297
|
+
API, and [Python Task Runner Internals](developer/PythonTaskRunnerInternals.md)
|
|
298
|
+
documents the docstring grammar and CLI output conventions. The suggested
|
|
299
|
+
`python/docs/` directory was not created; the existing pages were extended
|
|
300
|
+
instead (evidence: `scout-rig/subsys/python-package.md`)
|
|
301
|
+
|
|
302
|
+
The Python `scout` package has a `python/README.md` but no user-facing
|
|
303
|
+
documentation beyond that. The Python-side API (scout.tsv, scout.save_tsv,
|
|
304
|
+
scout.cmd, scout.Workflow) is not documented in a structured way.
|
|
305
|
+
|
|
306
|
+
**Suggestion:** Add a `python/docs/` directory or expand the user
|
|
307
|
+
documentation to cover the Python API in more detail.
|
|
308
|
+
|
|
309
|
+
### M3. No integration test for Ruby→Python→Ruby round-trip
|
|
310
|
+
|
|
311
|
+
**Status:** ◐ Partially resolved — stale in both directions. *Covered at
|
|
312
|
+
HEAD*: define a Python task, run it, verify the result
|
|
313
|
+
(`test/scout/workflow/test_python.rb#test_file`); TSV→DataFrame→TSV
|
|
314
|
+
round-trip (`test/scout/python/test_util.rb#test_tuple`). *Still
|
|
315
|
+
missing*: multi-function file task creation, remote workflow client
|
|
316
|
+
tests, threaded execution + GC tests. Note the "existing tests" list
|
|
317
|
+
below is itself wrong for `test_run.rb`: its `run_threaded` test is
|
|
318
|
+
`__test_run_threaded` (disabled), so that file runs zero tests
|
|
319
|
+
(evidence: `scout-rig/subsys/packaging-tests.md`; see
|
|
320
|
+
[Testing and Packaging](user/TestingAndPackaging.md))
|
|
321
|
+
|
|
322
|
+
*(The list below predates the campaign; the verified picture is in the
|
|
323
|
+
status above and in [Testing and Packaging](user/TestingAndPackaging.md).)*
|
|
324
|
+
|
|
325
|
+
**Existing tests cover:**
|
|
326
|
+
- `test_run.rb` — `run_threaded` basic test
|
|
327
|
+
- `test_script.rb` — `script()` basic and exception tests
|
|
328
|
+
- `test_util.rb` — numpy conversion
|
|
329
|
+
- `test_python.rb` — PyCall proxy behavior
|
|
330
|
+
- `test_task.rb` — `read_python_metadata`
|
|
331
|
+
- `test_python.rb` (workflow) — basic python_task
|
|
332
|
+
|
|
333
|
+
**Missing:**
|
|
334
|
+
- Full round-trip: define a Python task, run it, verify result type and value.
|
|
335
|
+
- TSV → DataFrame → TSV round-trip.
|
|
336
|
+
- Multi-function file task creation.
|
|
337
|
+
- Remote workflow client tests.
|
|
338
|
+
- Threaded execution + GC interaction tests.
|
|
339
|
+
|
|
340
|
+
**Suggestion:** Add integration tests covering these scenarios.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Documentation-specific
|
|
345
|
+
|
|
346
|
+
### D1. Old documentation files should be removed
|
|
347
|
+
|
|
348
|
+
**Status:** ✓ Resolved in the tree, ☐ gemspec remnant — both files are
|
|
349
|
+
deleted at HEAD, and the last stale README links were fixed in this
|
|
350
|
+
campaign. The checked-in `scout-rig.gemspec` still lists both deleted
|
|
351
|
+
files, so a plain `gem build` fails; `rake gemspec` regenerates the list
|
|
352
|
+
and fixes the build (evidence: `scout-rig/subsys/packaging-tests.md`;
|
|
353
|
+
see [Testing and Packaging](user/TestingAndPackaging.md))
|
|
354
|
+
|
|
355
|
+
The old flat documentation files `doc/Python.md` and `doc/PythonWorkflow.md`
|
|
356
|
+
should be removed once the new documentation is finalized, as they are
|
|
357
|
+
superseded by the new three-layer structure.
|
|
358
|
+
|
|
359
|
+
**Note:** Some of these old files may contain unique detail not captured
|
|
360
|
+
in the new documentation. Review before deleting.
|
|
361
|
+
|
|
362
|
+
### D2. Cross-reference validation
|
|
363
|
+
|
|
364
|
+
**Status:** ☐ Open — no automated link validation exists (no CI, no link
|
|
365
|
+
checker, no rake task). A full manual sweep of every relative markdown
|
|
366
|
+
link (27 files — README.md, doc/, research/ and python/README.md; 122
|
|
367
|
+
links) plus the remote scout-essentials/scout-ai URLs was run at the end
|
|
368
|
+
of the documentation campaign and found no dead links; the sweep is not repeatable automatically until this item is
|
|
369
|
+
addressed (evidence: `scout-rig/subsys/doc-corpus.md`)
|
|
370
|
+
|
|
371
|
+
The documentation contains cross-references to scout-essentials and
|
|
372
|
+
scout-ai GitHub URLs. These should be validated periodically to ensure
|
|
373
|
+
they don't break.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## Priority recommendations
|
|
378
|
+
|
|
379
|
+
1. **B1 (err variable)** — Simple fix, immediate clarity improvement.
|
|
380
|
+
(Verified: the `raise` is currently unreachable; `ProcessFailed` from
|
|
381
|
+
`CMD.cmd` fires first — see the B1 status above.)
|
|
382
|
+
2. **B3 (binding_run)** — Simple fix, corrects a silent bug.
|
|
383
|
+
3. **B2 (at_exit kills all threads)** — Important for multi-threaded apps
|
|
384
|
+
using ScoutPython. (Verified: also blocks clean exit of the threaded
|
|
385
|
+
path altogether.)
|
|
386
|
+
4. **A2 (return decoding ambiguity)** — Could cause subtle data corruption
|
|
387
|
+
if a string return is valid JSON. (Verified end-to-end.)
|
|
388
|
+
5. **M3 (integration tests)** — The test suite is sparse. Adding round-trip
|
|
389
|
+
integration tests would increase confidence. (Partially covered —
|
|
390
|
+
see the M3 status above.)
|
|
391
|
+
6. **D1 (gemspec remnant)** — Regenerate `scout-rig.gemspec` with
|
|
392
|
+
`rake gemspec` so it stops listing `doc/Python.md` and
|
|
393
|
+
`doc/PythonWorkflow.md`; the stale list is the only remaining blocker
|
|
394
|
+
for a plain `gem build`.
|
|
395
|
+
7. **D2 (link validation)** — Wire the relative-link sweep used at the end
|
|
396
|
+
of the campaign into a rake task so it runs before every release.
|
data/doc/StartHere.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Scout-Rig Documentation
|
|
2
|
+
|
|
3
|
+
Scout-rig bridges the Ruby Scout framework with Python. It lets you run
|
|
4
|
+
Python code from Ruby, define Scout workflow tasks backed by Python
|
|
5
|
+
functions, and drive Scout workflows from Python.
|
|
6
|
+
|
|
7
|
+
This documentation is organized into three layers, depending on what
|
|
8
|
+
you're trying to do:
|
|
9
|
+
|
|
10
|
+
## Which documentation should I read?
|
|
11
|
+
|
|
12
|
+
### I want to build applications using scout-rig
|
|
13
|
+
|
|
14
|
+
→ Read the **[User Documentation](user/)**
|
|
15
|
+
|
|
16
|
+
The user docs are concept-oriented guides that teach you how to use
|
|
17
|
+
scout-rig to solve problems. They are organized around tasks, not classes.
|
|
18
|
+
|
|
19
|
+
**Start here:**
|
|
20
|
+
- [Running Python from Ruby](user/RunningPythonFromRuby.md) — Execute Python
|
|
21
|
+
code from Ruby with different execution modes.
|
|
22
|
+
- [Passing Data to Python](user/PassingDataToPython.md) — Convert Ruby data
|
|
23
|
+
to Python (TSV↔DataFrame, numpy, lists).
|
|
24
|
+
- [Scripting Python](user/ScriptingPython.md) — Run ad-hoc Python scripts
|
|
25
|
+
with Ruby variables and get results back.
|
|
26
|
+
- [Defining Python Tasks](user/DefiningPythonTasks.md) — Write Scout
|
|
27
|
+
workflow tasks whose logic lives in Python.
|
|
28
|
+
- [Driving Workflows from Python](user/DrivingWorkflowsFromPython.md) — Use
|
|
29
|
+
the Python `scout` package to run Scout workflows locally or remotely.
|
|
30
|
+
- [Iterating Python Data](user/IteratingPythonData.md) — Traverse Python
|
|
31
|
+
iterables from Ruby.
|
|
32
|
+
- [Python Environments](user/PythonEnvironments.md) — How Python
|
|
33
|
+
environments relate to Scout, and the native-library hazards of embedding
|
|
34
|
+
Python inside a Ruby process.
|
|
35
|
+
- [Testing and Packaging](user/TestingAndPackaging.md) — How to run the test
|
|
36
|
+
suite, which Python environment it needs, and how the gem and the Python
|
|
37
|
+
package are built.
|
|
38
|
+
- [Cookbook](user/Cookbook.md) — Practical recipes combining multiple
|
|
39
|
+
features.
|
|
40
|
+
|
|
41
|
+
### I want to understand how scout-rig is implemented
|
|
42
|
+
|
|
43
|
+
→ Read the **[Developer Documentation](developer/)**
|
|
44
|
+
|
|
45
|
+
The developer docs explain the internal architecture, key abstractions, and
|
|
46
|
+
design decisions behind scout-rig.
|
|
47
|
+
|
|
48
|
+
**Start here:**
|
|
49
|
+
- [Architecture](developer/Architecture.md) — Module map and data flow.
|
|
50
|
+
- [ScoutPython Internals](developer/ScoutPythonInternals.md) — PyCall
|
|
51
|
+
integration, execution modes, threading, garbage collection.
|
|
52
|
+
- [PythonWorkflow Internals](developer/PythonWorkflowInternals.md) —
|
|
53
|
+
Metadata discovery, type mapping, CLI generation.
|
|
54
|
+
- [Python Task Runner Internals](developer/PythonTaskRunnerInternals.md) —
|
|
55
|
+
The Python-side `scout.task` runner: docstring grammar, CLI dispatch,
|
|
56
|
+
serialization and exit codes.
|
|
57
|
+
- [Data Conversion Internals](developer/DataConversionInternals.md) —
|
|
58
|
+
Serialization pipeline, pickle/JSON, subprocess management.
|
|
59
|
+
- [Design Principles](developer/DesignPrinciples.md) — Scout-rig coding
|
|
60
|
+
philosophy and idiomatic patterns.
|
|
61
|
+
|
|
62
|
+
### I'm investigating a subsystem in deep detail
|
|
63
|
+
|
|
64
|
+
→ Read the **[Research Artifacts](../research/)**
|
|
65
|
+
|
|
66
|
+
These are curated architectural investigations. They are **non-normative**:
|
|
67
|
+
they may contain implementation history, abandoned ideas, and experimental
|
|
68
|
+
observations. They are supporting material, not primary documentation. Each
|
|
69
|
+
one carries a status note pointing at the authoritative doc/ page where its
|
|
70
|
+
conclusions have since been verified or corrected.
|
|
71
|
+
|
|
72
|
+
## Prerequisites
|
|
73
|
+
|
|
74
|
+
Scout-rig builds on the Scout framework. To understand foundational
|
|
75
|
+
concepts like TSV data structures, file I/O, command execution, logging,
|
|
76
|
+
and path resolution, see the
|
|
77
|
+
[scout-essentials documentation](https://github.com/mikisvaz/scout-essentials/blob/main/doc/StartHere.md).
|
|
78
|
+
|
|
79
|
+
## Known issues and improvements
|
|
80
|
+
|
|
81
|
+
[Improvements](Improvements.md) tracks actionable code-level defects and
|
|
82
|
+
gaps (bugs, outdated behaviour, architecture concerns, missing features).
|
|
83
|
+
Each item's status was re-verified against HEAD `290ee22` during the
|
|
84
|
+
2026-09 documentation campaign, and names the Cortex artifact carrying the
|
|
85
|
+
probe evidence (`artifacts/scout-rig/subsys/*`).
|
|
86
|
+
|
|
87
|
+
## Documentation philosophy
|
|
88
|
+
|
|
89
|
+
- **User documentation** teaches how to build with scout-rig.
|
|
90
|
+
- **Developer documentation** explains how scout-rig itself is built.
|
|
91
|
+
- **Research artifacts** preserve the reasoning behind the current design.
|
|
92
|
+
- **Improvements** records verified defects to fix next.
|
|
93
|
+
|
|
94
|
+
Each layer becomes progressively more detailed while remaining focused on
|
|
95
|
+
its intended audience.
|