summaryrefslogtreecommitdiff
path: root/docs/building.md
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2026-08-01 19:06:36 -0600
committerChristian Kolset <christian.kolset@gmail.com>2026-08-01 19:06:36 -0600
commit0aa59c13af65beeae104662593b21ba4d8a37789 (patch)
tree17a1e6bd92a3a236bef0bca2e11ca7a875ba6caa /docs/building.md
parentbfbdd0c19910f464e779fa64cc0ec8590f8e37c1 (diff)
Rename LabDAQ → LabUI and overhaul plugin system
Branding: - Rename app, window title, file extension (.labdaq → .labui), user data dirs (~/.labui/), spec file (labdaq.spec → labui.spec), and APP_NAME throughout all source, docs, and config files Plugin system: - Plugins no longer bundled in the PyInstaller build — installed at runtime by users via Settings → Plugins → Install Plugin (zip) - PluginManager now takes user_dir + extra_scan_dirs; user plugins live in ~/.labui/plugins/, dev scan additionally covers project plugins/ - install_from_zip / uninstall / is_user_installed added to PluginManager - vendor/ dir inside plugin zips: prepended to sys.path at load time so plugins can ship their own deps without requiring pip on end-user machine - source_url field in manifest.json: shown as Download button in the missing-plugins dialog when a profile requires an absent plugin - Frozen-app pip install now targets ~/.labui/plugin_packages/ using a real system Python (sys.executable is the exe in frozen builds) Profile loading: - Profile now stores plugins_manifest snapshot (id, name, version, source_url) alongside plugins_enabled - On load, missing or dep-broken plugins trigger MissingPluginsDialog before the rest of the profile is applied; user can install from zip or download via source_url in-dialog, or cancel the load - Plugin reconciliation only enables installed plugins — missing ones are not written to enabled.json UI: - Version label added to status bar (bottom-right, muted colour) - Settings → Plugins tab: Install Plugin… button, per-plugin Remove button for user-installed plugins, live list refresh after install/remove Docs: - New docs/building.md covers the full release pipeline - docs/plugin-development.md updated for new install flow, vendoring, source_url, profile behaviour, and distribution instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'docs/building.md')
-rw-r--r--docs/building.md113
1 files changed, 113 insertions, 0 deletions
diff --git a/docs/building.md b/docs/building.md
new file mode 100644
index 0000000..e20bcd3
--- /dev/null
+++ b/docs/building.md
@@ -0,0 +1,113 @@
+# Building LabUI from Source
+
+Produces a standalone `dist/LabUI/` directory (onedir, not onefile — required for tufup's per-file update patching).
+
+## Prerequisites
+
+Python 3.10+ and the dev requirements:
+
+```bash
+pip install -r requirements.txt
+pip install -r requirements-dev.txt
+```
+
+`requirements-dev.txt` adds PyInstaller and tufup on top of the runtime deps.
+
+## First-time setup — TUF repository
+
+Skip this if the `scripts/release/keystore/` directory already exists (i.e. someone else on the team has already initialised the repo and shared the keystore out-of-band).
+
+```bash
+python scripts/release/repo_init.py
+```
+
+This generates:
+
+- `scripts/release/keystore/` — private + public keys for the TUF root/targets/snapshot/timestamp roles. **Back this up somewhere private outside the repo. Losing the root key means existing installs can never receive trusted updates.**
+- `scripts/release/repository/` — initial signed TUF metadata, including `root.json`.
+
+After init, build once more so the freshly-generated `root.json` gets bundled into the app (the `.spec` file only includes it if it already exists):
+
+```bash
+pyinstaller labui.spec
+```
+
+## Building a release
+
+### 1. Bump the version
+
+Edit `core/version.py`:
+
+```python
+__version__ = "1.2.3"
+```
+
+This single value is read by the auto-updater at runtime (`core/updater.py`) and by the release script when signing the new target.
+
+### 2. Build the executable
+
+```bash
+pyinstaller labui.spec
+```
+
+Output: `dist/LabUI/LabUI` (Linux/macOS) or `dist/LabUI/LabUI.exe` (Windows).
+
+The build bundles:
+- `ui/style_dark.qss` and `ui/style_light.qss`
+- `scripts/release/repository/metadata/root.json` (if present — enables trusted updates on fresh installs)
+
+Plugins are **not bundled**. They are installed at runtime by the user via **Settings → Plugins → Install Plugin…**. Installed plugins and their enabled state live in `~/.labui/plugins/`. Plugin pip dependencies (for machines without Python) land in `~/.labui/plugin_packages/`, which is added to `sys.path` at startup.
+
+### 3. Sign the release target
+
+```bash
+python scripts/release/repo_release.py
+```
+
+Creates and signs `scripts/release/repository/targets/labui-<version>.tar.gz` and updates the TUF metadata files in `scripts/release/repository/metadata/`.
+
+### 4. Publish to GitHub
+
+Upload every file from `scripts/release/repository/metadata/` and `scripts/release/repository/targets/` to the GitHub Release tagged **`updates`** (fixed tag — not a version tag), replacing any same-named files already there.
+
+The app's updater always points at `.../releases/download/updates/`, so the tag must stay constant across versions.
+
+Optionally create a separate human-facing release with a changelog under a version tag (e.g. `v1.2.3`).
+
+### 5. Verify
+
+Launch a previous installed version → Settings → Check for Updates → confirm it finds and applies the new version.
+
+## Re-signing expired metadata
+
+TUF metadata expires even with no new release (`root`: 365 days, others: 90 days). If metadata goes stale before the next release, clients reject it. Re-sign:
+
+```bash
+python -m tufup sign snapshot scripts/release/keystore
+python -m tufup sign timestamp scripts/release/keystore
+```
+
+Run from the repo root. Re-upload the resulting files to the `updates` release.
+
+## What's bundled vs. external
+
+| Item | Bundled in exe? | Notes |
+|------|----------------|-------|
+| Python runtime | Yes | PyInstaller includes it |
+| PyQt6 / pyqtgraph / numpy | Yes | |
+| QSS theme files | Yes | copied from `ui/` |
+| Plugins | No | installed by users into `~/.labui/plugins/` at runtime |
+| Plugin pip deps | No | installed into `~/.labui/plugin_packages/` or vendored inside plugin zip |
+| `root.json` | Yes (if present) | TUF trust bootstrap |
+| `nidaqmx` | No | optional; NI runtime must be installed separately |
+| `opencv-python` | No | optional; only needed if a plugin requires it (vendor it in the plugin zip) |
+
+## Troubleshooting
+
+**`ModuleNotFoundError` at launch** — a hidden import PyInstaller missed. Add it to `hiddenimports` in `labui.spec` and rebuild.
+
+**Plugin not loading in built app** — plugins are not bundled; the user must install them via Settings → Plugins. If the plugin loads but fails silently, check that its `vendor/` folder contains all required packages, or that the user has pip-installed them (they land in `~/.labui/plugin_packages/`).
+
+**Plugin dependency not importable after pip install** — the user may need to restart the app so `~/.labui/plugin_packages/` is injected into `sys.path` (this happens in `main.py` at startup).
+
+**`root.json` not bundled** — run `repo_init.py` first (see First-time setup), then rebuild.