You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
microskills: the Windows py launcher is not read as the Python interpreter #340
classify_command in tokeneconomizer/microskills/observe.py reads python.exe and C:\Python312\python.exe as the Python interpreter, but not the Windows py launcher. CPython's "Using Python on Windows" says "To launch your default runtime, run python or py", and a -V:<tag> or -3.x option chooses a specific Python. So py -m pytest is not observed, and a repository whose tests run that way never gets a fact about them.
Expected: run_tests for all three, py's version option kept in the form
Actual: [('run_tests', 'python.exe -m pytest')] for the first, [] for both py forms
Issue:#340 — microskills: the Windows py launcher is not read as the Python interpreter
Understanding
classify_command (tokeneconomizer/microskills/observe.py) only treats python, python2/3, pypy* (PYTHON_GIT.interpreters, line 51) and pythonN[.M] (_INTERP_VERSIONED_RE, line 164) as interpreters. py -m pytest therefore yields no observation. The end state is that py, with or without a version selector (-3, -3.12, -V:3.12), is read as the Python interpreter and records run_tests, with the selector kept in the form. The issue doesn't say whether py.exe should work, but _command_base (line 839) already strips .exe, so it follows.
Approach
In observe.py, add "py" to PYTHON_GIT.interpreters. GENERIC (line 74) is the union of the two vocabularies, so it picks py up with no further change.
Add a small helper in observe.py and a module regex, e.g. _PY_SELECTOR_RE, matching ^-(?:V:\S+|\d(?:\.\d+)?(?:-(?:32|64|arm64))?)$. In _classify, when base == "py", split a leading selector token from rest. The remaining arguments then drive the existing logic: the --version/-V/-VV/-v probe check, -m, and _runner_script. This matters because py -3.12 --version would otherwise fail the all-tokens check, and py -3.12 script.py would not be recognised as a runner script.
Build the form from head plus the selector (py -3.12 -m pytest, py -V:3.12 -m pytest), so the selector is kept as the issue asks. Do this for the run_tests, run_interpreter, probe_env and coverage run branches. Without a selector the form is unchanged (py -m pytest).
py -0 and py -0p list installed runtimes. Make them probe_env rather than run_interpreter; check that -0 isn't swallowed as a selector.
Add tests/test_observe_py_launcher.py in the style of tests/test_observe_conda_run.py. It should cover:
the three commands from the issue, with expected forms python.exe -m pytest, py -m pytest and py -3.12 -m pytest;
a negative case such as py -m pip install x not being run_tests.
No on-disk state names, event kinds or settings change. Observation forms are keyed by their text, so new py ... forms simply pool separately from python ... ones. The plugin's user-visible text is untouched.
Run the issue's reproduction snippet and confirm run_tests for all three commands.
Replay any recorded Windows sessions that use py through the observation step, if available. The change adds observations and shouldn't alter any existing python form.
Open questions
None
Reply confirm to have scout implement this plan on a scout/issue-340 branch and link a one-click pull request (write access required). Reply /scout to plan again after editing the issue; text after the command is guidance for the new plan.
Generated by Scout for #340 · claude · sonnet55 · ~15 AIC · ⌖ ~16 AIC · ⊞ 2.6K · ◷
Activity
github-actions commentedon Nov 26, 2026
Scout plan
Issue: #340 — microskills: the Windows py launcher is not read as the Python interpreter
Understanding
classify_command(tokeneconomizer/microskills/observe.py) only treatspython,python2/3,pypy*(PYTHON_GIT.interpreters, line 51) andpythonN[.M](_INTERP_VERSIONED_RE, line 164) as interpreters.py -m pytesttherefore yields no observation. The end state is thatpy, with or without a version selector (-3,-3.12,-V:3.12), is read as the Python interpreter and recordsrun_tests, with the selector kept in the form. The issue doesn't say whetherpy.exeshould work, but_command_base(line 839) already strips.exe, so it follows.Approach
In
observe.py, add"py"toPYTHON_GIT.interpreters.GENERIC(line 74) is the union of the two vocabularies, so it pickspyup with no further change.Add a small helper in
observe.pyand a module regex, e.g._PY_SELECTOR_RE, matching^-(?:V:\S+|\d(?:\.\d+)?(?:-(?:32|64|arm64))?)$. In_classify, whenbase == "py", split a leading selector token fromrest. The remaining arguments then drive the existing logic: the--version/-V/-VV/-vprobe check,-m, and_runner_script. This matters becausepy -3.12 --versionwould otherwise fail the all-tokens check, andpy -3.12 script.pywould not be recognised as a runner script.Build the form from
headplus the selector (py -3.12 -m pytest,py -V:3.12 -m pytest), so the selector is kept as the issue asks. Do this for therun_tests,run_interpreter,probe_envandcoverage runbranches. Without a selector the form is unchanged (py -m pytest).py -0andpy -0plist installed runtimes. Make themprobe_envrather thanrun_interpreter; check that-0isn't swallowed as a selector.Add
tests/test_observe_py_launcher.pyin the style oftests/test_observe_conda_run.py. It should cover:python.exe -m pytest,py -m pytestandpy -3.12 -m pytest;py -V:3.12 -m pytest,py.exe -3 -m pytestandC:\Windows\py.exe -m pytest;py -3.12 -m coverage run -m pytest;py -3.12 runtests.py;py --versionandpy -0asprobe_env;py -m pip install xnot beingrun_tests.No on-disk state names, event kinds or settings change. Observation forms are keyed by their text, so new
py ...forms simply pool separately frompython ...ones. The plugin's user-visible text is untouched.Verification
python -m pytest tests/test_observe_py_launcher.py -qpython -m pytest tests experiments/tests -qrun_testsfor all three commands.pythrough the observation step, if available. The change adds observations and shouldn't alter any existingpythonform.Open questions
None
Reply
confirmto have scout implement this plan on ascout/issue-340branch and link a one-click pull request (write access required). Reply/scoutto plan again after editing the issue; text after the command is guidance for the new plan.