Skip to content

0.5.0

Latest

Choose a tag to compare

@dmccoystephenson dmccoystephenson released this 20 Nov 08:30
· 1 commit to main since this release
2bb6938

0.5.0

Upgrading from v0.4.2 needs no code or save changes. Existing games keep working, and saves made by v0.4.2 list and load as before. The release adds optional location pictures across the web front-ends and a small "← Arcade" link for games hosted on arcade. It also fixes a path-traversal bug in tak.web.serve: before this fix, a /web/../… URL could read any file under the served root. If you serve a Pyodide build with tak.web.serve, upgrade. A few inputs that used to slip through are now refused: non-finite numbers from promptForNumber, True/False in formatHour, and ids or keys with a trailing newline.

Changes

Pictures

  • BaseUserInterface.setPicture(key, alt) sets a picture that stays on every following screen until it is changed or cleared with None; picture() reads it back. Alt text is required, and keys are limited to [a-z0-9_-] (PICTURE_KEY_PATTERN). The console shows no picture, so a game that calls setPicture still plays as text. (#48, #63)
  • The server-backed web front-end serves pictures/<key>.png at /picture/<key>, with a cache header. The directory can be set with the new picturesDir argument on createUserInterface and WebUserInterface. Each screen carries only {key, alt}. (#48)
  • Under Pyodide, the Worker sends each picture's bytes to the page once, before the first screen that names it. TakBoot.start accepts a picturesDir setting. With an older game-worker.js the game plays on without pictures. (#48)

Arcade

  • On a top-level page on an arcade host, both the Pyodide and console runtimes add an "← Arcade" link back to the game's cabinet in the hall (hall.js, configurable with config.hallUrl). Nothing is loaded or drawn on any other host or inside a frame. (#54)
  • tak.arcade ids and run tags with a trailing newline are now rejected, matching arcade.js. (#61)

Web serving

  • tak.web.serve keeps every /web/ request inside web/, so .. paths now return 404, and HEAD follows the same routes as GET. (#64)
  • The server-backed page ignores a query string, so /?utm_source=… still reaches the game. (#69)
  • The Pyodide bridge ignores stray JSON on the input ring that is not an object. (#61)

Input and formatting

  • promptForNumber returns None for nan, infinity and overflowing input such as 1e999 on every front-end; the shared parsing is exposed as tak.ui.base.parseNumber. (#71)
  • formatHour(True) and formatHour(False) now raise ValueError instead of formatting as 1 AM and 12 AM. (#73)
  • The console header prints its chips on one line separated by |, wrapping only between chips when the terminal is too narrow. (#44)

Saves and progression

  • Only directories named exactly slot_N count as save slots. A zero-padded or non-ASCII-digit name is ignored instead of being listed as a slot it isn't, or crashing the save menu. (#70)
  • delete_save_slot returns False when the filesystem refuses the deletion, instead of raising. Browser storage is still flushed, and the save menu reports the failure. (#69)
  • A schema file that is not valid JSON now raises a json.JSONDecodeError that names the file. (#77)
  • Progression accepts a generator or other one-shot iterable of unlocks without ending up empty. (#75)

Version

v0.4.2 → 0.5.0 — MINOR. Mechanical floor from comparing the package's public surface and save paths: MINOR.
Judgment: The new capabilities (the optional sticky setPicture/picture contract, the /picture/ route and picturesDir, parseNumber, and the "← Arcade" hall link) are all additive. The behaviour changes are bug fixes inside existing contracts, not incompatible ones: promptForNumber refuses nan/infinity, formatHour refuses bools, arcade ids reject a trailing newline, delete_save_slot returns False instead of raising, and the schema JSONDecodeError keeps its type. Saves written by v0.4.2 always use canonical slot_N names, so they list and load unchanged; only a hand-made slot_01-style directory is no longer listed. Nothing a consumer would break on is outside what the mechanical check saw, so the floor of minor stands.

  • minor: public function/method added: tak.ui.base:BaseUserInterface.picture
  • minor: public function/method added: tak.ui.base:BaseUserInterface.setPicture
  • minor: public name added: tak.ui.base:PICTURE_KEY_PATTERN
  • minor: public function/method added: tak.ui.base:parseNumber
  • minor: public function/method added: tak.ui.pyodide:SharedArrayBufferBridge.postPicture
  • minor: public name added: tak.ui.web:DEFAULT_PICTURES_DIR
  • minor: public name added: tak.ui.web:PICTURE_ROUTE
  • minor: public function/method added: tak.ui.web:WebUserInterface.pictureBytes
  • minor: tak.ui.factory:createUserInterface(uiType, currentPrompt, header=…, title=…, tagline=…, tip=…, envPrefix=…, host=…, port=…) → (uiType, currentPrompt, header=…, title=…, tagline=…, tip=…, envPrefix=…, host=…, port=…, picturesDir=…): extended compatibly
  • minor: tak.ui.web:WebUserInterface.init(self, currentPrompt, header=…, title=…, tagline=…, tip=…, envPrefix=…, host=…, port=…, start_server=…, endedScreenTimeoutSeconds=…) → (self, currentPrompt, header=…, title=…, tagline=…, tip=…, envPrefix=…, host=…, port=…, start_server=…, endedScreenTimeoutSeconds=…, picturesDir=…): extended compatibly
  • minor: save path changed: src/tak/saves/manager.py
  • minor: save path changed: src/tak/saves/schema.py

Verification

Verified before publication; this tag points at the exact commit that was verified.

  • tests gate run: the library's own suite at this commit — Python 3.8: 383 passed in 36.87s; Python 3.12: 383 passed in 34.99s (8 assertions passed).
  • save-compatibility gate run: saves written by v0.4.2 and the curated fixture were read by this release twice with every file byte-identical, and a new save was added beside them without touching them (18 assertions passed).
  • consumers gate run: Tidewater (236 passed in 1.15s), Overwinter (199 passed in 1.28s), FishE (1148 passed in 65.24s (0:01:05)) — each one's own test suite, green on its current pin — passed with this release (12 assertions passed).

Install: pip install "tak @ git+https://github.com/Stephenson-Software/tak@v0.5.0". What the checks cover: python-release-gates.


drafted by Claude on behalf of Daniel Stephenson