[Community Port] PsychoPy Studio on HarmonyOS — Initial Progress Update (v2026.1.2 based)

Hi everyone,

I’d like to share a personal project I’ve been working on: porting PsychoPy Studio to HarmonyOS PC and mobile devices. This is not an official PsychoPy port – just my own effort to bring the experiment-building experience to HarmonyOS devices.

Project repo: github.com/Aik358/psychopy-studio-harmonyos
Project page: Shown in Readme (outdated, waiting for update)

What is this?

PsychoPy-OH packages the Builder, Coder, and Runner as a native HarmonyOS HAP via the Electron-OH runtime (Chromium 132, Electron 34.8.4) with a full Python 3.12.8 backend bridged via WebSocket. The frontend is built with SvelteKit and rendered through ArkUI. The goal is to preserve the full PsychoPy API that researchers rely on while adding HarmonyOS-native capabilities. (It is currently synced against psychopy-lib v2026.1.2.)

How to Install

  1. Download the latest application package from the project homepage (now the 2026.1.2 branch)
  2. Install via DevEco Studio: Open DevEco Studio (a tool to develop and install unsigned HarmonyOS APPS; you can download it on the Huawei Developer Website), sign and use the “Build as HAP” feature to sideload the package onto your HarmonyOS device or emulator.
  3. (Sometimes the npx vite build is needed, you can refer details in "Build_on_harmony.md)

Architecture Overview

The project follows a four-layer architecture:

┌─────────────────────────────────────────┐
│         Application Layer               │
│  psychopy.builder · psychopy.coder      │
├─────────────────────────────────────────┤
│         PsychoPy Runtime                │
│  visual · core · data · event · sound   │
│  (pyglet → EGL, pygame → Oboe)          │
├─────────────────────────────────────────┤
│         Bridge Layer                    │
│  Electron 34.8.4 · Node.js · N-API      │
├─────────────────────────────────────────┤
│   HarmonyOS/OpenHarmony Native Layer    │
│  ArkUI · EGL · Oboe · HarmonyOS 5.0+    │
└─────────────────────────────────────────┘

Runtime Layer – Platform Backend Substitution

The PsychoPy runtime (psychopy.visual, psychopy.core, psychopy.data, psychopy.event, psychopy.sound) is fully preserved, with platform-specific backends replaced for HarmonyOS:

  • pygletEGL (OpenGL ES 3.2)

  • pygameOboe (audio)

  • serialOHOS USB HAL

Bridge Layer – IPC via WebSocket JSON-RPC

The bridge between the Electron frontend and the Python runtime is implemented via harmony-python.js (main process) with liaison_shim.py acting as a WebSocket JSON-RPC server. The v0.1.6 release activated 30+ Python IPC handlers.

Native Layer – Electron-OH Upgrade

The framework was upgraded from the 2025 baseline to Electron 34.8.4 (2026-06-26):

  • libelectron.so: ~153 MB → 159 MB

  • libadapter.so: ~1.5 MB → 5.2 MB

  • New adapters: EtsBridge, WebApp, NodeHandle, Popup, KVStore, CommandLine

  • libsndfile.so: previously missing (soft-fail) → bundled (v1.2.2)

Current Status — Core Pipeline: Fully Working

Feature Status
Python 3.12.8 WebSocket liaison Working
psychopy-lib 2026.1.2 full import Working
Builder (35 components) → writeScript → Run-in-Browser Working
PsychoJS ESM experiment execution Working
Auto pip-install for missing Python packages Working
File system access (Desktop / Documents / Downloads) Working
Python Terminal + diagnostics Working

Framework Upgrade

The port has been upgraded to Electron 34.8.4, with bundled native adapters including EtsBridge, WebApp, NodeHandle, Popup, KVStore, and CommandLine. libsndfile is now bundled (v1.2.2) instead of soft-failing.

UI & Localization

  • Full i18n framework (zh-CN + en-US) with menu / ribbon / dialog translation
  • Language switcher in the top navigation bar
  • Page zoom slider (50%–200%)
  • Tablet mode detection and banner (HarmonyOS devices without system Python)
  • Fixed view-switching bugs (removed full-reload fallback)

Disclaimer

Again, this is an independent, personal porting project. It is not affiliated with or endorsed by Open Science Tools or the official PsychoPy team. Use at your own discretion.

I’m sharing this in case anyone is curious about running PsychoPy on HarmonyOS tablets, or wants to contribute / discuss the technical approach. Happy to answer questions and hear feedback!