swizzle_search, tex_mode_probe: say numpy is missing in one line, as tile_probe does #949

Merged
barkodr merged 1 commit from upstream-pr/949 into main 2026-11-29 01:35:37 +00:00
barkodr commented 2026-11-24 15:37:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by barkodr on 2026-11-24T15:37:05Z.


Claimed in the coordination issue as: claiming: tools/bc_feature.py, calibrated_texture.py, tex_mode_probe.py and swizzle_search.py import numpy unconditionally and never say they need it; give them the one-line "numpy is missing" message tools/tile_probe.py uses. Tools only. AI-assisted.

What and why

Without numpy, tools/swizzle_search.py and tools/tex_mode_probe.py stopped with a traceback. They now check their arguments first and then print one ERROR: ... needs numpy (python -m pip install numpy) line and exit 2, as tools/tile_probe.py does.

tools/bc_feature.py and tools/calibrated_texture.py are left as they are: they are modules with no command line of their own. tex_mode_probe.py now imports bc_feature only when numpy is present, and ttpf_mips.py and ttpf_assets.py already catch the ImportError from calibrated_texture and say what is missing.

Tested

On macOS 26.6.2 with Python 3.12.16 (no numpy installed) and on Ubuntu 26.04 (WSL2) with Python 3.14.4, from the checkout root with python -I: tests/test_swizzle_search.py, tests/test_tex_mode_probe.py, tests/test_text_write_line_endings.py and tests/test_docs_python_deps.py pass on both. On macOS both tools print the one line and exit 2. With numpy 2.5.5 installed, the four new tests (which hide numpy from a child process) pass, and they fail against the tools on main. Without numpy, tests/test_tex_mode_probe.py skips the whole module in setUpModule, so its two new tests only run where numpy is installed.

GPUs tested: none (no GPU code changed)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5475314702 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/949). Originally posted by [barkodr](https://github.com/barkodr) on 2026-11-24T15:37:05Z. --- Claimed in the coordination issue as: claiming: tools/bc_feature.py, calibrated_texture.py, tex_mode_probe.py and swizzle_search.py import numpy unconditionally and never say they need it; give them the one-line "numpy is missing" message tools/tile_probe.py uses. Tools only. AI-assisted. ### What and why Without numpy, `tools/swizzle_search.py` and `tools/tex_mode_probe.py` stopped with a traceback. They now check their arguments first and then print one `ERROR: ... needs numpy (python -m pip install numpy)` line and exit 2, as `tools/tile_probe.py` does. `tools/bc_feature.py` and `tools/calibrated_texture.py` are left as they are: they are modules with no command line of their own. `tex_mode_probe.py` now imports `bc_feature` only when numpy is present, and `ttpf_mips.py` and `ttpf_assets.py` already catch the `ImportError` from `calibrated_texture` and say what is missing. ### Tested On macOS 26.6.2 with Python 3.12.16 (no numpy installed) and on Ubuntu 26.04 (WSL2) with Python 3.14.4, from the checkout root with `python -I`: `tests/test_swizzle_search.py`, `tests/test_tex_mode_probe.py`, `tests/test_text_write_line_endings.py` and `tests/test_docs_python_deps.py` pass on both. On macOS both tools print the one line and exit 2. With numpy 2.5.5 installed, the four new tests (which hide numpy from a child process) pass, and they fail against the tools on `main`. Without numpy, `tests/test_tex_mode_probe.py` skips the whole module in `setUpModule`, so its two new tests only run where numpy is installed. GPUs tested: none (no GPU code changed) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
PierreEbele commented 2026-11-25 21:50:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T21:50:02Z.


Reviewed e61aadd: I ran test_swizzle_search.py (30 OK) and test_tex_mode_probe.py (39 OK) on the PR tree, both on origin/main (28/37 OK), and the PR's test files copied onto main - the four new without-numpy tests fail there and pass here, so they exercise the fix. Also compileall, check_no_game_data, and a direct A/B probe: with numpy simulated missing, main gives an ImportError traceback (rc 1) even for bad arguments, while the PR tools give argument errors and the one-line "needs numpy" (rc 2), matching tile_probe; with numpy present the output is byte-identical to main. Nits for a follow-up: the now-stale comment at tests/test_swizzle_search.py:430, and the ...Test-suffixed new classes a plain pytest run would skip (they run under python -I). AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175596729 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/949#issuecomment-7175596729). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T21:50:02Z. --- Reviewed e61aadd: I ran test_swizzle_search.py (30 OK) and test_tex_mode_probe.py (39 OK) on the PR tree, both on origin/main (28/37 OK), and the PR's test files copied onto main - the four new without-numpy tests fail there and pass here, so they exercise the fix. Also compileall, check_no_game_data, and a direct A/B probe: with numpy simulated missing, main gives an ImportError traceback (rc 1) even for bad arguments, while the PR tools give argument errors and the one-line "needs numpy" (rc 2), matching tile_probe; with numpy present the output is byte-identical to main. Nits for a follow-up: the now-stale comment at tests/test_swizzle_search.py:430, and the `...Test`-suffixed new classes a plain pytest run would skip (they run under `python -I`). AI-assisted review. **Recommendation:** Merge
zmasi commented 2026-11-28 22:00:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:00:43Z.


Native Windows 11 Verification (e61aadda9f)

Verified e61aadda9f79c0d594ec289aafdfd108ccae4ca4 merged cleanly onto origin/main (c7753ed98a56677f10e34078b37eab0540e190ec, git merge-tree --write-tree rc=0) on native Windows 11 (26200) across both standard-library-only Python (3.12.10) and numpy 1.26.4 Python:

  • Red (origin/main c7753ed98a): SwizzleSearchWithoutNumpyTest (FAILED (errors=1)) and TexModeProbeWithoutNumpyTest (FAILED (failures=2)) failed with rc=1 and a ModuleNotFoundError: No module named 'numpy' traceback before CLI argument validation.
  • Green (origin/main + e61aadda9f):
    • tests/test_swizzle_search.py: passed under both stdlib-only Python and numpy 1.26.4 (rc=0, single-line ERROR: swizzle_search.py needs numpy (python -m pip install numpy) with rc=2 when numpy is absent, and usage errors reported before checking numpy).
    • tests/test_tex_mode_probe.py: 39/39 OK under numpy 1.26.4 (TexModeProbeWithoutNumpyTest confirmed rc=2 and single-line ERROR: tex_mode_probe.py needs numpy (python -m pip install numpy)).
  • Non-blocking test note: In tests/test_tex_mode_probe.py, module-level setUpModule() (line 43) and pytestmark (line 36) skip the entire test module when the outer test runner itself lacks numpy (python -I tests/test_tex_mode_probe.py under stdlib-only Python prints Ran 0 tests in 0.000s / OK (skipped=1)), so TexModeProbeWithoutNumpyTest is skipped in CI's stdlib-only job unless the skip decorator is scoped to the numpy-requiring test class/functions (as tests/test_swizzle_search.py does).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246432252 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/949#issuecomment-7246432252). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:00:43Z. --- ### Native Windows 11 Verification (`e61aadda9f`) Verified `e61aadda9f79c0d594ec289aafdfd108ccae4ca4` merged cleanly onto `origin/main` (`c7753ed98a56677f10e34078b37eab0540e190ec`, `git merge-tree --write-tree` `rc=0`) on native **Windows 11 (`26200`)** across both standard-library-only Python (`3.12.10`) and `numpy 1.26.4` Python: - **Red (`origin/main` `c7753ed98a`)**: `SwizzleSearchWithoutNumpyTest` (`FAILED (errors=1)`) and `TexModeProbeWithoutNumpyTest` (`FAILED (failures=2)`) failed with `rc=1` and a `ModuleNotFoundError: No module named 'numpy'` traceback before CLI argument validation. - **Green (`origin/main + e61aadda9f`)**: - `tests/test_swizzle_search.py`: passed under both stdlib-only Python and `numpy 1.26.4` (`rc=0`, single-line `ERROR: swizzle_search.py needs numpy (python -m pip install numpy)` with `rc=2` when `numpy` is absent, and usage errors reported before checking `numpy`). - `tests/test_tex_mode_probe.py`: **`39/39 OK`** under `numpy 1.26.4` (`TexModeProbeWithoutNumpyTest` confirmed `rc=2` and single-line `ERROR: tex_mode_probe.py needs numpy (python -m pip install numpy)`). - **Non-blocking test note**: In `tests/test_tex_mode_probe.py`, module-level `setUpModule()` (`line 43`) and `pytestmark` (`line 36`) skip the **entire** test module when the outer test runner itself lacks `numpy` (`python -I tests/test_tex_mode_probe.py` under stdlib-only Python prints `Ran 0 tests in 0.000s / OK (skipped=1)`), so `TexModeProbeWithoutNumpyTest` is skipped in CI's stdlib-only job unless the skip decorator is scoped to the `numpy`-requiring test class/functions (as `tests/test_swizzle_search.py` does). AI-assisted.
OreoFR commented 2026-11-29 01:31:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:31:25Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 4 failures (SwizzleSearchWithoutNumpyTest.test_missing_file_is_a_usage_error_without_numpy, SwizzleSearchWithoutNumpyTest.test_missing_numpy_is_one_error_line, TexModeProbeWithoutNumpyTest::test_missing_numpy_is_one_error_line, TexModeProbeWithoutNumpyTest::test_unreadable_index_is_a_usage_error_without_numpy) / green 30 OK + 52 passed.

  • PR head e61aadda9. tests/test_swizzle_search.py run with unittest (python -I tests/test_swizzle_search.py) using a venv python with numpy/Pillow; tests/test_tex_mode_probe.py run with python -m pytest in a venv built from tests/requirements.txt (pytest 9.2.0, numpy 2.5.5, Pillow 13.0.0). Both from the repository root.
  • Red (main + only this PR's test files): test_swizzle_search.py 30 run, 2 failures, 0 skips; test_tex_mode_probe.py 2 failed / 50 passed. All four fail with AssertionError: 1 != 2: the tool dies with a traceback (ModuleNotFoundError: import of numpy halted) instead of exiting 2. MEASURED, failing test(s) alone 3 runs, 3/3 fail.
  • Green (main + git merge --no-ff of this PR, no conflict): test_swizzle_search.py 30 run, OK, 0 skips; test_tex_mode_probe.py 52 passed. MEASURED, the same test(s) alone 3/3 pass.
  • Skips: none with the venv.
  • Verdict: READY.

Red = main + only the test files from this PR (git checkout pr-949 -- tests/test_swizzle_search.py tests/test_tex_mode_probe.py); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched.

AI-assisted: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248837447 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/949#issuecomment-7248837447). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:31:25Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 4 failures (`SwizzleSearchWithoutNumpyTest.test_missing_file_is_a_usage_error_without_numpy`, `SwizzleSearchWithoutNumpyTest.test_missing_numpy_is_one_error_line`, `TexModeProbeWithoutNumpyTest::test_missing_numpy_is_one_error_line`, `TexModeProbeWithoutNumpyTest::test_unreadable_index_is_a_usage_error_without_numpy`) / green 30 OK + 52 passed. - PR head e61aadda9. `tests/test_swizzle_search.py` run with unittest (`python -I tests/test_swizzle_search.py`) using a venv python with numpy/Pillow; `tests/test_tex_mode_probe.py` run with `python -m pytest` in a venv built from `tests/requirements.txt` (pytest 9.2.0, numpy 2.5.5, Pillow 13.0.0). Both from the repository root. - Red (main + only this PR's test files): `test_swizzle_search.py` 30 run, 2 failures, 0 skips; `test_tex_mode_probe.py` 2 failed / 50 passed. All four fail with `AssertionError: 1 != 2`: the tool dies with a traceback (`ModuleNotFoundError: import of numpy halted`) instead of exiting 2. MEASURED, failing test(s) alone 3 runs, 3/3 fail. - Green (main + `git merge --no-ff` of this PR, no conflict): `test_swizzle_search.py` 30 run, OK, 0 skips; `test_tex_mode_probe.py` 52 passed. MEASURED, the same test(s) alone 3/3 pass. - Skips: none with the venv. - Verdict: READY. Red = main + only the test files from this PR (`git checkout pr-949 -- tests/test_swizzle_search.py tests/test_tex_mode_probe.py`); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched. AI-assisted: Claude Code (Claude Opus 5.5).
MoonEyes commented 2026-11-29 01:35:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T01:35:39Z.


Merged after OreoFR's red/green check (check) (macOS 27.2.1, Apple M5, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto main d8c10dd5e without conflict, and its test file(s) (tests/test_swizzle_search.py, tests/test_tex_mode_probe.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248885779 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/949#issuecomment-7248885779). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T01:35:39Z. --- Merged after **OreoFR**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/949#issuecomment-7248837447)) (macOS 27.2.1, Apple M5, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto `main` d8c10dd5e without conflict, and its test file(s) (`tests/test_swizzle_search.py`, `tests/test_tex_mode_probe.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!949
No description provided.