v0.5.0 — Big cleanup: modular refactor + smaller wheel
Internal overhaul — no user-facing feature changes. If v0.4.0 works for you, v0.5.0 works the same, just lighter and cleaner under the hood.
The numbers
| Metric | v0.4.0 | v0.5.0 | Delta |
|---|---|---|---|
| `app.py` lines | 6044 | 4232 | −1812 (−30%) |
| Python modules | 1 monolith | 6 focused modules | +5 |
| Wheel size | 2.5 MB | 1.6 MB | −36% |
| E2E assertions | 22 | 48 | +26 |
| Dead code removed | — | ~800 lines | — |
Highlights
- 📉 Wheel size −36% — removed the legacy `cute_orange_cat/` sprite directory (2.1 MB of 68×68 sprites that were shipped in every release since v0.1.0 but have been unreachable at runtime since the v0.3.0 catset migration). Deleted the obsolete `MANIFEST.in` that was keeping them in the distribution.
- 🧩 Modular architecture — `catai_linux/app.py` split from 6044 lines into 6 focused modules: `app.py`, `chat_backend.py`, `voice.py`, `drawing.py`, `x11_helpers.py`, `l10n.py`. Smaller files, easier to navigate, easier to test, lazy imports for optional features.
- 🗑 Dead code purge: −800 lines — `ChatBubbleController` class (150 L, old Gtk.Window bubble replaced by Cairo canvas rendering in v0.3.x), the whole legacy color-tinting system (`CatColorDef`, `CAT_COLORS`, `tint_sprite`, HSB conversion helpers, disk cache), 6 unreachable `CatState` enum members (`DRINKING`, `PLAYING_BALL`, `BUTTERFLY`, `SCRATCHING_TREE`, `PEEING`, `POOPING`) plus their 7 drawing helpers, and all the legacy `add_cat` / `remove_cat` / `rename_cat` management code that had been superseded by the catset-based flow.
- ⚡ Perf — cached Pango layout across render ticks in `_position_chat_entry()` (was re-allocating surface + context + layout + font description every frame when a chat bubble was visible — ~0.5–1 ms/frame saved). Dirty-key cache for `_update_input_regions()` skips the expensive `cairo.Region` rebuild on frames where no cat has moved (the common idle case — ~0.5 ms saved per skipped frame).
- 🔨 Code quality — `_handle_test_cmd()` (197 lines, 19 if/elif branches) refactored into a dispatch dict of 21 small `cmd*` handler methods. Added `_get_cat_at_idx()` to deduplicate index parsing. Type hints on all public APIs of the new modules.
- 🧪 Test coverage — E2E test suite extended from 22 assertions across 13 scenarios to 48 assertions across 15 scenarios. New coverage: 8 easter eggs (`nyan`, `matrix`, `apocalypse`, `shake`, `hide_seek`, `boss_fight`, `beam`, `meow_party`), all 3 love encounter outcomes (LOVE → birth, SURPRISED, ANGRY → drama), and a dedicated `kitten_count` probe that verifies births actually happen. The T1 / T9 window-detection tests that previously used fragile `xdotool --class` searches now query the Python side directly via the `status` / `settings_state` socket commands.
- 🧹 Housekeeping — `.gitignore` now excludes raw sprite sources (`catset_assets/`, `kittens_assets/`). Removed obsolete `scripts/generate_sprites.py`, `scripts/catai_sprites.ipynb`, `docs/feature_kittens.md`, and empty `scripts/references/` / `scripts/sd_workflows/` directories.
Install
```bash
pip install --upgrade catai-linux
Optional: adds ~100 MB of deps (faster-whisper + CTranslate2) for voice chat
pip install --upgrade 'catai-linux[voice]'
```
The new wheel is 1.1 MB compressed (was 1.7 MB), saving ~600 KB of disk per install and ~36% of bandwidth.