Files
testium/package/appimage/AppImageBuilder.yml
François 8ab53f470d lsp: declarative action registry + cross-channel language server
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>
2026-05-29 23:17:59 +02:00

89 lines
2.9 KiB
YAML

# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1
script:
- echo "APP_VERSION={{APP_VERSION}}" >> $BUILDER_ENV
- rm -rf AppDir | true
# Make usr and icons dirs
- mkdir -p AppDir/usr/lib/python
- mkdir -p AppDir/usr/share/icons
- mkdir -p AppDir/usr/bin
# Copy the icon
- cp ../testium.png AppDir/usr/share/icons/
AppDir:
path: AppDir/
app_info:
id: testium
name: Testium
icon: testium
version: "{{APP_VERSION}}"
exec: usr/bin/python3
exec_args: -m testium $@
runtime:
env:
TESTIUM_VERSION: '{{APP_VERSION}}'
PYTHONPATH: $APPDIR/usr/lib/python3.11/site-packages:$APPDIR/usr/lib/python3.11
path_mappings:
- /usr/share/matplotlib/mpl-data/matplotlibrc:$APPDIR/etc/matplotlibrc
apt:
arch: [amd64]
allow_unauthenticated: true
sources:
- sourceline: deb http://ftp.fr.debian.org/debian bookworm main non-free contrib
- sourceline: deb http://security.debian.org/debian-security bookworm-security
main contrib non-free
- sourceline: deb http://ftp.fr.debian.org/debian bookworm-updates main contrib
non-free
include:
- libxcb-cursor0
- python3
- python3-distutils
- python3-pkg-resources
exclude: []
files:
include: []
exclude:
- usr/share/man
- usr/share/doc/*/README.*
- usr/share/doc/*/changelog.*
- usr/share/doc/*/NEWS.*
- usr/share/doc/*/TODO.*
after_bundle: |
# Set python 3.11 env
export PYTHONHOME=$TARGET_APPDIR/usr
export PYTHONPATH=$TARGET_APPDIR/usr/lib/python3.11/site-packages:$TARGET_APPDIR/usr/lib/python3.11
export PATH=$TARGET_APPDIR/usr/bin:$PATH
# Set python 3.11 as default
ln -fs python3.11 $TARGET_APPDIR/usr/bin/python3
# Bootstrap pip into the AppDir Python
if [ ! -f "get-pip.py" ]; then curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py; fi
python3.11 get-pip.py --break-system-packages
# Install application dependencies in AppDir
python3.11 -m pip install --break-system-packages --upgrade --isolated --no-input --ignore-installed --prefix=$TARGET_APPDIR/usr -r ../../src/requirements.txt
export PIP_CONFIG_FILE=$HOME/.pip/pip.conf
# Install the wheel with the [lsp] extra so `testium lsp` (pygls) works
# from the AppImage. The extra pulls pygls/lsprotocol/cattrs/attrs from
# the index (network is available at build time, see get-pip above).
python3.11 -m pip install --break-system-packages --upgrade --isolated --no-input --ignore-installed --prefix=$TARGET_APPDIR/usr "../../src/dist/testium-{{APP_VERSION}}-py3-none-any.whl[lsp]"
AppImage:
arch: x86_64
update-information: guess