Skip to content

Desktop app for Windows, macOS and Linux (D5) - #53

Merged
NCCU-Schultz-Lab merged 5 commits into
mainfrom
claude/d5-desktop
Nov 6, 2026
Merged

NCCU-Schultz-Lab merged 5 commits into
mainfrom
claude/d5-desktop

Conversation

@NCCU-Schultz-Lab

@NCCU-Schultz-Lab NCCU-Schultz-Lab commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

This adds EaglePlot as a desktop program (roadmap D5.1 and D5.3). It's the same app as the browser version, packaged with @stlite/desktop into Electron. Python (Pyodide) and every package are bundled, so it needs no Python install and no network, and no admin rights to install.

What's added

  • packaging/desktop/:
    • package.json and lockfile: @stlite/desktop 0.105.1 (Streamlit 1.65 and Pyodide 314.0.3, the same as the browser build), Electron 45.0.0 and electron-builder 26.18.0.
    • App identity: "EaglePlot", app ID edu.nccu.schultzlab.eagleplot.
    • Installers:
      • Windows: per-user NSIS .exe
      • macOS: .dmg for arm64 and x64, ad-hoc signed so it runs on Apple Silicon
      • Linux: AppImage
    • Icon: made from the logo.
    • build_desktop.py: stages eagleplot/ and .streamlit/, runs npm ci, dumps Pyodide and the packages, opens https links in the system browser, then runs electron-builder. --pyodide-source builds against a local Pyodide; --dir builds an unpacked app only.
    • README.md: building, the pins, what differs from the browser version, and what users see when they first open an unsigned build.
  • .github/workflows/desktop-builds.yml:
    • Builds on windows-2025, macos-15 and ubuntu-24.04.
    • Triggers: a published release (installers attached to it), manual runs, and PRs that touch the desktop build.
    • Installers are uploaded as artifacts.
    • On Linux it also launches the built app and runs the smoke test. This needs one AppArmor setting relaxed, because Ubuntu 24.04 otherwise blocks Electron's sandbox.
  • scripts/desktop/smoke.js (Playwright, driving Electron):
    • start-up, and that the app is recognised as the desktop build
    • Home → Quick Plot shows a plot
    • a PNG download arrives (caught in Electron's main process)
    • settings survive a restart
    • an https link goes to shell.openExternal
    • no network requests

App changes

  • Desktop detection: runtime recognises the desktop build from Electron (process.versions.electron), because @stlite/desktop can't pass environment variables to Python.
  • Desktop capabilities:
    • Settings persist: config.json lives in the user's app-data folder, mounted at /home/pyodide/.eagleplot.
    • Folder import is off until D5.2, which maps typed paths onto mounted folders.
    • No NIST fetch: Pyodide's requests support needs the browser's XMLHttpRequest, which Node lacks, so the page links out instead.
    • No deferred package loading: everything is bundled.
  • New on_click_downloads capability. On desktop, stlite's own page sends st.download_button(data=callable) to https://stlite.invalid, where it fails. figures.LAZY_DOWNLOAD honours this capability, so desktop downloads are prepared in advance and go through Python.
  • External links: @stlite/desktop blocks every new window. build_desktop.py patches its Electron main process so that http(s) links open in the system browser. If a future @stlite/desktop changes that code, the build stops and says so, and a test covers it.

Tested

  • Built here: an unpacked Linux app, about 365 MB installed (Electron ~270 MB, plus a 95 MB app archive with Pyodide and all packages).
  • Smoke test, run as a non-root user under Xvfb: passes.
    • ready in about 12 s, and the same after a restart
    • the link went to the system browser
    • the app was recognised as the desktop build
    • a plot appeared in 2 s
    • a 300 dpi PNG download arrived (176 KB)
    • settings persisted across the restart
    • no network requests
  • Tests:
    • New tests/test_desktop_build.py: the link patch, and the build stopping when that code changes; desktop packages ⊇ the browser build's; version pins and Pyodide 314.0.3; the mounts.
    • Updated runtime tests: Electron detection, the desktop profile, and the desktop settings folder.
  • Full suite: Python 3.9 gives 1272 passed. ruff check and format are clean.

This PR's CI run is the first real Windows and macOS build.

Not in this PR

  • D5.2, folder import on desktop: mapping typed paths onto mounted folders.
  • D5.4, signing: an owner decision.
  • D5.5, auto-update.

🤖 Generated with Claude Code

- packaging/desktop: package.json (@stlite/desktop 0.105.1, Electron
  45.0.0, electron-builder 26.18.0; app id edu.nccu.schultzlab.eagleplot;
  per-user NSIS, ad-hoc-signed dmg, AppImage), lockfile, icon, and
  build_desktop.py (stage the app, npm ci, dump, open https links in the
  system browser, electron-builder).
- runtime: recognise the desktop build from Electron (stlite can't pass
  environment variables); desktop capabilities: settings persist in the
  app-data folder, folder import off until D5.2, no NIST fetch, no
  deferred package loads.
- scripts/desktop/smoke.js: launches the built app (not yet passing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…top (D5, WIP)

- .github/workflows/desktop-builds.yml: Windows (NSIS), macOS (dmg x64 +
  arm64), Linux (AppImage) on releases (attached), by hand, and on PRs that
  touch the desktop build; Linux also launches the app and runs the smoke
  test (AppArmor userns restriction lifted for Electron's sandbox).
- runtime: on_click_downloads capability, off on desktop: stlite's own
  page sends st.download_button(data=callable) to https://stlite.invalid,
  where it fails; figures.LAZY_DOWNLOAD honours it, so desktop downloads
  are prepared in advance and go through the kernel.
- packaging/desktop/README.md (build, pins, unsigned first launch),
  tests/test_desktop_build.py (link patch, package list, pins, mounts),
  scripts/desktop/smoke.js (download caught in Electron's main process),
  Linux executable 'eagleplot', CHANGELOG.

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

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

Streamlit 1.65 checks each download button's URL at stlite's placeholder
origin; it can't resolve and nothing depends on it (the download goes
through Python). Locally (non-root, Xvfb): ready in ~12 s, link to the
system browser, desktop build recognised, plot in 2 s, PNG download
arrives, settings persist across a restart, no network requests.

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

On Windows the desktop config path prints with backslashes, so compare Path objects.
On the slower CI runner the Settings page wasn't rendered when its text was read:
wait for the Save defaults button and the expected text first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NCCU-Schultz-Lab
NCCU-Schultz-Lab merged commit c675f0a into main Nov 6, 2026
12 checks passed
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.

2 participants