🖥️ Pyxel Contribution: JSON Schema Generator on Windows
Summary: Makes tox -e json_schema complete on Windows, with output identical to the committed schema.
URL:
https://gitlab.com/esa/pyxel/-/merge_requests/1249
✨ Overview
tox -e json_schema could not complete on Windows. Both writers opened their file in text
mode without an encoding, so they fell back to the locale codepage, and the first non-ASCII
character in a model docstring stopped the run:
UnicodeEncodeError: 'charmap' codec can't encode character '\u03b1' That character is the alpha in the cosmix particle type description.
🔧 Technical Changes
auto_generated.pyandpyxel_schema.jsonare written as UTF-8.- The schema writer pins
newline='\n'. Without it, text mode on Windows writes CRLF, so regenerating the committed file rewrote all 8557 of its lines and buried the real change in the diff. - A leftover
print("Do nothing"), which fired for every annotated unit on every run, is removed.
Related to #985,
since tox -e json_schema is the command it documents.
🧪 Validation
- ✅ With both changes,
pyxel/static/pyxel_schema.jsonregenerates on Windows byte for byte identical to the committed file, so no regenerated schema is included.
🦕 Authored by: Doby Baxter
🌌 Contribution for: ESA Pyxel Project