Make `testium lsp` (and the testium_assist editor extension that spawns it)
work from every distribution channel: source, wheel, PyInstaller, Flatpak,
AppImage.
Two enablers:
1. Declarative ACTIONS registry. The TestItemActions parents (console, plot,
json_rpc) now declare their nested actions as a class attribute
`ACTIONS = {yaml_key: class}`, mirroring PARAMS. The base __init__ seeds
action_classes from type(self).ACTIONS; register_actions() is kept only as
an imperative escape hatch. lsp/schema.py reads ACTIONS directly, dropping
the inspect.getsource/AST walk that returned no actions in a frozen
PyInstaller build (no .py source on disk).
2. pygls bundled per channel. Kept as the pyproject [lsp] extra (lean
`pip install testium`), layered into each full-app channel:
- build_env.sh installs pygls into test/tmp/.venv (source run + PyInstaller
build env)
- AppImage installs the wheel as `…whl[lsp]`
- Flatpak adds a python3-lsp network-pip module (matches the manifest's
global --share=network)
- PyInstaller .spec collect_submodules(pygls/lsprotocol) + hiddenimports for
the lazily-imported lsp/lsp.server/lsp.schema
test/validation/lsp_smoke.py (run by run.sh before the suite) enforces both
per channel: `<channel> schema` must keep console/plot/json_rpc actions and
`<channel> lsp` must answer an initialize request without reporting pygls
missing. Verified for source mode; the other channels need a rebuild to verify.
DESIGN.md updated (declarative section + new "Language server across channels"
subsection + Recent fixes).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
app-id: org.testium.Testium
|
|
runtime: org.kde.Platform
|
|
runtime-version: '6.10'
|
|
|
|
sdk: org.kde.Sdk
|
|
base: io.qt.PySide.BaseApp
|
|
base-version: '6.10' # Doit correspondre au runtime
|
|
command: testium
|
|
|
|
finish-args:
|
|
- --share=ipc
|
|
- --socket=fallback-x11
|
|
- --socket=wayland
|
|
- --device=dri
|
|
- --share=network
|
|
- --filesystem=home
|
|
- --filesystem=/tmp
|
|
- --filesystem=host-os
|
|
# Allow flatpak-spawn --host to launch host binaries (Python, Lua, git…)
|
|
# outside the sandbox. Required because the sandbox glibc/ABI is
|
|
# incompatible with arbitrary host shared libraries — we route py_func and
|
|
# lua_func through the host instead.
|
|
- --talk-name=org.freedesktop.Flatpak
|
|
|
|
build-options:
|
|
build-args:
|
|
- "--share=network"
|
|
|
|
modules:
|
|
- python3-requirements.json
|
|
|
|
# Language-server deps for `testium lsp` (pygls + lsprotocol + cattrs + attrs
|
|
# + typing_extensions). Installed from PyPI at build time — the build already
|
|
# runs with --share=network (see build-options). The core runtime deps stay
|
|
# offline-pinned in python3-requirements.json; these are pure-python wheels,
|
|
# hence --only-binary=:all: (no compilation, deterministic).
|
|
- name: python3-lsp
|
|
buildsystem: simple
|
|
build-options:
|
|
build-args:
|
|
- --share=network
|
|
build-commands:
|
|
- pip3 install --prefix=${FLATPAK_DEST} --only-binary=:all: "pygls>=1.3"
|
|
|
|
# 1. Dépendances Python tierces (HORS PySide6)
|
|
# Utilisez flatpak-pip-generator pour vos autres libs (ex: pyserial, requests, etc.)
|
|
# - name: python3-requirements
|
|
# buildsystem: simple
|
|
# build-options:
|
|
# build-args:
|
|
# - --share=network
|
|
# build-commands:
|
|
# # --only-binary=:all: empêche la compilation et force le téléchargement des .whl
|
|
# - pip3 install --prefix=/app --only-binary=:all: -r requirements.txt
|
|
# sources:
|
|
# - type: file
|
|
# path: requirements.txt
|
|
|
|
# 2. Votre application (Code source dans ../../src)
|
|
- name: testium-app
|
|
buildsystem: simple
|
|
sources:
|
|
- type: dir
|
|
path: ../../src
|
|
- type: file
|
|
path: org.testium.Testium.desktop
|
|
- type: file
|
|
path: org.testium.Testium-mime.xml
|
|
- type: file
|
|
path: ../../package/testium.png
|
|
build-commands:
|
|
# Code source
|
|
- mkdir -p /app/lib
|
|
- cp -r testium /app/lib/
|
|
- cp VERSION /app/lib/testium/VERSION
|
|
|
|
# Launcher exécutable
|
|
- mkdir -p /app/bin
|
|
- |
|
|
cat <<EOF > /app/bin/testium
|
|
#!/bin/sh
|
|
export TESTIUM_VERSION="\$(cat /app/lib/testium/VERSION 2>/dev/null || echo unknown)"
|
|
export PYTHONPATH="/app/lib/testium:/usr/lib/sdk/pyside6/lib/python3.13/site-packages:\$PYTHONPATH"
|
|
# Expose host binaries (git, python3, lua, …) for subprocess lookups.
|
|
# PATH is appended (not prepended) so the main process keeps the sandbox python3.
|
|
export PATH="\$PATH:/run/host/usr/local/bin:/run/host/usr/bin:/run/host/bin"
|
|
export GIT_PYTHON_GIT_EXECUTABLE="/run/host/usr/bin/git"
|
|
exec /usr/bin/python3 /app/lib/testium "\$@"
|
|
EOF
|
|
- chmod +x /app/bin/testium
|
|
|
|
# Icône
|
|
- mkdir -p /app/share/icons/hicolor/256x256/apps
|
|
- cp testium.png /app/share/icons/hicolor/256x256/apps/org.testium.Testium.png
|
|
|
|
# Entrée menu
|
|
- mkdir -p /app/share/applications
|
|
- cp org.testium.Testium.desktop /app/share/applications/
|
|
|
|
# Type MIME pour .tum
|
|
- mkdir -p /app/share/mime/packages
|
|
- cp org.testium.Testium-mime.xml /app/share/mime/packages/
|