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

Open
github-bot wants to merge 1 commit from github-bot/gh-949 into main AGit
Owner

@⁠barkodr on GitHub · 2026-11-24 15:37 UTC · original
barkodr:fix/numpy-missing-message → main · +79 −4 · 4 files · 1 commits · open

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.
**@⁠barkodr** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/949) `barkodr:fix/numpy-missing-message` → `main` · +79 −4 · 4 files · 1 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:01 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 21:50 UTC · original

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

**@⁠PierreEbele** on GitHub · 2026-11-25 21:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/949#issuecomment-7175596729) 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
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/949/head:github-bot/gh-949'
git switch 'github-bot/gh-949'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-949'
git switch 'github-bot/gh-949'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-949'
git switch 'github-bot/gh-949'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-949'
git switch 'main'
git merge --squash 'github-bot/gh-949'
git switch 'main'
git merge --ff-only 'github-bot/gh-949'
git switch 'main'
git merge 'github-bot/gh-949'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.