Skip to content

Remove Mu leftovers: dead code, unused deps and images, obsolete translations - #40

Merged
evangress merged 22 commits into
masterfrom
cleanup/mu-leftovers
Nov 8, 2026
Merged

evangress merged 22 commits into
masterfrom
cleanup/mu-leftovers

Conversation

@evangress

Copy link
Copy Markdown

The cleanup half of the Windows review. Stacked on #39, so the diff shows only this work; GitHub retargets it to master when #39 merges and its branch is deleted. Each commit covers one topic, and nothing here should change what learners see.

What's removed or moved

  • The micro:bit special case in Check moves out of the core. mu/logic.py hard-coded a list of micro:bit names to expand from microbit import *, even though the core mustn't name plugin modes. A mode can now declare an optional star_imports (module → the names its import * brings in), and the micro:bit plugin declares its own list. It's documented in modes.md and plugins.md. Because it's an optional member, the API stays at 0.5.
  • Dead code from removed modes:
    • MicroPythonREPLConnection.execute/send_commands, with their raw-mode constants (Pyboard/ESP "run on device")
    • the remove_fs hook and its plugin error guard (the file-system pane is gone)
    • the unused device_list argument of AdminDialog.setup/Window.show_admin
    • PythonProcessPane._del_, a typo for __del__ that was never called
    • EditorPane.find_next_match, which only its own test used
    • a commented-out block in restore_session
  • Dependencies: nudatus (micro:bit minifier) and semver were installed with every Nu (PyPI and Briefcase) but never imported. The empty mu/contrib package is gone too, and uv.lock is relocked.
  • Images: css.png/.svg (a Web mode button) and 35 PNGs that their same-named SVG always overrides (about 380 KB). checked.png stays because the stylesheets use it. I checked every toolbar icon in Python 3, Pygame Zero, and the day and night themes in the running app.
  • Repo:
    • the unused .github/codeql/codeql-config.yml
    • utils/flask_api.py and flask.json
    • the "Making of Mu" make video target and utils/avatar.py
    • gh_downloads.py now counts Nu's releases
    • the Makefile, make.py, the utils README and the CI step name now say Nu
  • Translations: removed about 1,600 obsolete #~ entries across the 14 catalogues, many for removed modes. They were never compiled into the .mo files. Babel confirms each catalogue's live messages are unchanged. make translate_begin now passes --ignore-obsolete, and utils/recover_renamed_translations.py reads history from git, so it doesn't need them.
  • CLAUDE.md (test baseline, the star_imports/ensure_workspace_assets notes) and CHANGES.md (a Removed section) are updated.

Kept on purpose

  • The venv_path session key: documented as still honoured in docs/design/settings-and-sessions.md.
  • docs/swag, docs/logo_design and docs/icon_brief: kept as Mu's design archive (docs/copyright.md).
  • mu_code, mu_venv, the data folder, the Briefcase app key mu / org.kovir.mu: renaming these would need a migration for existing installs, and the maintainer decided to keep them.

Testing

Windows 11, Python 3.13, with --all-extras: 1778 passed, 20 skipped (two runs). ruff check and ruff format --check are clean, and mkdocs build --strict passes. I also ran Nu from this branch and confirmed every toolbar and mode-picker icon renders.

🤖 Generated with Claude Code

evangress and others added 18 commits November 8, 2026 11:44
The splash still read "Mu: a Python editor" / codewith.mu with the Mu
logo, the old Mu icon.svg won over the Nu icon.png (load_icon prefers
SVG), and the Mode button showed the Mu logo while the mode picker
told learners to click "the Mode button containing Nu's logo".

utils/make_artwork.py draws splash_screen.png, splash_fail.png and
modes.png from icon.png with Qt, so the art can be redrawn when the icon
changes. The Mu GIMP source and base image go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second launch used to log "Mu is already running" and exit with no
sign to the learner. Now it hands over through a QLocalServer: the
running Nu comes to the front and opens any files the second launch was
given (e.g. "Open with"). If the running Nu doesn't answer, a message
box says so instead of nothing happening.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A script that ended with an uncaught error under the debugger showed
"exit code: 0 status: 0". The runner now returns the exit code Python
would give (1 after an error, SystemExit's code otherwise) and mu_debug
exits with it. mu_debug also stops normcase'ing the script path, which
lower-cased it in the learner's tracebacks on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Python 3 mode runs scripts with -i, so a finished program sat at a bare
>>> prompt with the Stop button still showing, looking as if it were
still running. The output pane now notes, above that first prompt, that
the program has finished and the learner can explore it or click Stop.

Quit closed Nu (killing the program) without a word; it now asks first
while a program is still running (not when it's just waiting at >>>).

Also: Run no longer lower-cases the script's path (os.path.normcase),
so tracebacks show the path as the learner sees it on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ound

First start installed each bundled wheel with its own pip run (a pip-era
guard against pip's timeout), which took a couple of minutes. One offline
`uv pip install --no-index --no-deps` of all of them takes seconds.

safe_short_path turned the environment's paths into Windows 8.3 short
names (MU_VEN~1) to dodge a venv-launcher bug with spaces in paths
(cpython#90844), fixed before Python 3.11, Nu's minimum. It made the
Environment tab's copyable commands look broken; with it goes the
pywin32 dependency. The Environment tab also shows paths with one kind
of slash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The REPL greets the learner with the Python it runs instead of
  qtconsole's and IPython's banners (licence, "editing mode like vi or
  emacs" tips).
- Pane titles drop developer jargon: "Python REPL" and "Python
  Plotter", not "Python3 (Jupyter) REPL" / "Python3 data tuple
  Plotter".
- The debug inspector leaves out Python's own __dunder__ names
  (__file__, __name__, ...), showing just the learner's variables.
- A pane docked below the editor starts a third of the window high: with
  the REPL and plotter open the editor had shrunk to a couple of lines.
- Make a toolbar test independent of the fonts earlier tests leave set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to change it

The picker sorted modes alphabetically, so the opt-in BBC micro:bit came
first and Python 3, where most learners start, last. Python 3 now leads,
then the plugin modes by name, and the instructions are shorter.

The status bar's mode name ("Python 3") was meant to open the picker,
as in Mu, but StatusBar.connect_mode was never called. It's connected
now (click only: Ctrl+Shift+M stays with the Mode button), with a
tooltip and a pointing-hand cursor saying so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Windows 11 style drew a rounded focus frame in the empty part of
  the selected plugin's On column, like a second, broken checkbox. The
  themes now set outline: none on the list and tree views themselves
  (it was only on their items, which Qt doesn't read for this); the
  selected row's colour still shows where you are.
- The Current Log tab opened at the top of the file, the oldest entries;
  it now opens at the end, about what just happened.
- The log folder follows MU_DATA_DIR like the rest of Nu's data, so the
  tests and throwaway profiles never write to the real log.
- The second-launch tests wait for the outcome rather than a fixed time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every mode's ensure_workspace_assets ran at every start, so a learner
who only used Python 3 found Pygame Zero's fonts, images, music and
sounds folders in their mu_code. Now each mode's runs the first time
the mode is used in a session (including the one Nu starts in), into
the same workspace as before. The plugin docs say so; the API version
stays 0.5 (a 0.x bump would turn away every plugin for a timing change
no plugin can notice).

Also: an Unreleased section in CHANGES.md for this branch's changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check_flake expanded "from microbit import *" with a list of micro:bit
names hard-coded in mu/logic.py, though the core mustn't name plugin
modes. A mode can now declare star_imports (module -> the names its
import * brings in); Check expands any of those generically, and the
micro:bit plugin declares its own. Documented in modes.md and
plugins.md as an optional member, so the API version is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- MicroPythonREPLConnection.execute/send_commands (and the raw-mode
  constants only they used): the "run on device" plumbing of the
  removed Pyboard/ESP modes.
- The remove_fs hook in change_mode and the plugin error guard: no mode
  has had a file-system pane since the FileSystemPane went.
- AdminDialog.setup / Window.show_admin's device_list argument, which
  nothing read.
- PythonProcessPane._del_ (a never-called typo for __del__),
  EditorPane.find_next_match (used only by its own test) and a
  commented-out block in restore_session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nudatus minified scripts for Mu's micro:bit flashing; semver was only
named in a TODO. Neither is imported anywhere (core or plugins), but
both were installed with every Nu, from PyPI and in the installers'
Briefcase requires. mu/contrib has been empty since uflash, esptool and
microfs went.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- css.png/.svg: the removed Web mode's CSS button.
- 35 PNGs whose same-named SVG always wins (load_icon prefers the SVG),
  about 380 KB shipped in every install. checked.png stays: the themes'
  stylesheets name it.

docs/copyright.md: the Python logo is now just python.svg, and a note on
Nu's own artwork (the icon, and the splash screens and Mode button drawn
from it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…deo target

- .github/codeql/codeql-config.yml ("Mu CodeQL configuration", ignoring
  the long-gone esptool.py): no workflow used it.
- utils/flask_api.py and flask.json: built the removed Web mode's Flask
  API stubs.
- `make video` ("The Making of Mu") and utils/avatar.py, plus their
  clean-up steps.
- utils/gh_downloads.py counts Nu's releases (it still pointed at
  mu-editor/mu); the Makefile, make.py, the utils README and the CI step
  name say Nu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each mu.po carried about 100 obsolete (#~) entries (225 in French),
many for strings of Mu's removed modes ("Files on your micro:bit:",
"Minify Python code before flashing?", ESP and Web mode texts). They're
never compiled into the .mo files, so learners never saw them; they were
7,600 lines of noise for translators. Removed textually, leaving every
other byte alone; babel confirms each catalogue's live messages are
unchanged.

make translate_begin now passes --ignore-obsolete to pybabel update, so
they don't build up again (git keeps the history, which is what
utils/recover_renamed_translations.py reads), and the translation
extraction no longer lists the deleted mu/contrib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The "isn't responding" message box's QApplication now sets Nu's
  window icon, so the box carries Nu's icon.
- Nu closes its second-launch server at exit, next to releasing the
  single-instance lock.
- utils/make_artwork.py says which Qt platform drew the images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from ux/review-findings to master November 8, 2026 18:00
evangress and others added 4 commits November 8, 2026 13:00
Lost when master's squash-merged #39 was merged into this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evangress
evangress merged commit d6c9d5f into master Nov 8, 2026
12 checks passed
@evangress
evangress deleted the cleanup/mu-leftovers branch November 8, 2026 18:46
evangress added a commit that referenced this pull request Nov 10, 2026
2.0.0 was never tagged, so this week's changes (#39, #40) are part of it:
CHANGES.md files them under 2.0.0's Changed, Fixed (betas / older) and
For developers, and the Unreleased section goes.

TODO.md: a Windows review section (#37, #39, #40, what was kept on
purpose, and what's open: checking #39 on macOS/Linux and the
installers, and tagging v2.0.0), the new test baseline, and the notes
that still said the first-run install used pip and that unused icons
and translations were for a later sweep.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant