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

Open
opened 2026-11-26 20:19:42 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/949
Author: @barkodr
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/numpy-missing-message


📝 Commits (1)

  • e61aadd swizzle_search, tex_mode_probe: say numpy is missing in one line, as tile_probe does

📊 Changes

4 files changed (+79 additions, -4 deletions)

View changed files

📝 tests/test_swizzle_search.py (+30 -0)
📝 tests/test_tex_mode_probe.py (+32 -0)
📝 tools/swizzle_search.py (+7 -1)
📝 tools/tex_mode_probe.py (+10 -3)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/949 **Author:** [@barkodr](https://github.com/barkodr) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/numpy-missing-message` --- ### 📝 Commits (1) - [`e61aadd`](https://github.com/ubiquitarianism/leonida/commit/e61aadda9f79c0d594ec289aafdfd108ccae4ca4) swizzle_search, tex_mode_probe: say numpy is missing in one line, as tile_probe does ### 📊 Changes **4 files changed** (+79 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_swizzle_search.py` (+30 -0) 📝 `tests/test_tex_mode_probe.py` (+32 -0) 📝 `tools/swizzle_search.py` (+7 -1) 📝 `tools/tex_mode_probe.py` (+10 -3) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#987
No description provided.