-
Couldn't load subscription status.
- Fork 72
[SYNPY-1636] Synapse Desktop Client MVP using ElectronJS and the SynapsePythonClient #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BryanFauble
wants to merge
47
commits into
develop
Choose a base branch
from
synpy-1636-move-to-electron
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 36 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
3529562
Add build scripts for minimal Synapse CLI and interactive commands
BryanFauble 2a79688
Build a simple GUI application and add to the build process to publis…
BryanFauble c1895e4
Fix package installation command in build scripts for consistency
BryanFauble 24f45f7
Refactor build scripts to improve Windows compatibility and remove ex…
BryanFauble 72b3f8e
Remove uv command from build scripts and clean up Windows installatio…
BryanFauble f4acc79
Refactor build scripts to streamline dependency installation and impr…
BryanFauble 6a24763
Move build to top level
BryanFauble b4adef4
Set UV_SYSTEM_PYTHON environment variable for desktop client build
BryanFauble 6518746
Remove UV_SYSTEM_PYTHON environment variable and enable environment a…
BryanFauble 7abe4ce
Refactor Windows dependency uninstallation commands to remove redunda…
BryanFauble 673305b
Splitting logic into a MVC
BryanFauble 9bfa9d9
Detailed progress tracking
BryanFauble ade9d93
Test out bulk download/upload and icon branding
BryanFauble c598b48
Correction to logging and build processes
BryanFauble 19f89e6
Run precommit
BryanFauble f22936d
Change ico to icns for apple
BryanFauble 0e36433
Add missing tkinter imports for build process
BryanFauble 22e4b08
Cleaning up and simplifying code
BryanFauble 3f4e91f
Add user agent to Synapse client initialization
BryanFauble 7defa0d
pre-commit
BryanFauble fd32666
Re-enable all testing suite
BryanFauble a8e2f7f
Refactor UI update calls to use a minimal delay for thread-safe opera…
BryanFauble d4232ac
Update UI update calls to use zero delay for improved responsiveness
BryanFauble 04cfbe3
pre-commit
BryanFauble a6a9693
Migrate the UI and application to use ElectronJS
BryanFauble 8e0faa4
pre-commit all files
BryanFauble 2cfe72f
Update artifact upload paths for Electron builds to include all packa…
BryanFauble 0230ee4
Enhance Electron compatibility by setting up environment variables an…
BryanFauble aae27b0
pre-commit
BryanFauble d723472
Refactor build scripts to remove suffix handling for backend executab…
BryanFauble ec85ba1
Remove previous TKInter GUI
BryanFauble dffef12
Remove unused favicon files and update installation instructions for …
BryanFauble 292e605
Add utility modules for Synapse Desktop Client backend
BryanFauble d446e5a
run pre-commit
BryanFauble c3223a1
Potential fix for code scanning alert no. 26: Information exposure th…
BryanFauble e79d592
Remove debug logging for completion messages in WebSocket utilities
BryanFauble eb975f4
Update README with advanced development instructions and improve debu…
BryanFauble dccf763
Upsize icon and pre-commit
BryanFauble e8d6bdd
Refactor config and synapse services for improved type hinting and do…
BryanFauble 9eee46a
pre-commit
BryanFauble f5ddfb7
Enhance security configurations in SynapseElectronApp with CORS and g…
BryanFauble f16c36a
Merge branch 'develop' into synpy-1636-move-to-electron
BryanFauble 4410a14
Enhance build scripts for Synapse Desktop Client to support architect…
BryanFauble 4235378
Revert "Enhance build scripts for Synapse Desktop Client to support a…
BryanFauble 61d68d5
Refactor build configuration for Synapse Desktop Client to streamline…
BryanFauble 696de4b
Refactor upload file handling to improve folder structure and enhance…
BryanFauble dca8111
re-enable github tests
BryanFauble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,155 @@ | ||
| @echo off | ||
| REM Build script for Synapse Desktop Client (Electron + Python Backend) | ||
| REM This script creates a complete packaged application with both frontend and backend | ||
| REM Usage: build_electron_app.bat | ||
|
|
||
| echo Building Synapse Desktop Client (Electron + Python Backend)... | ||
|
|
||
| REM Ensure we're in the project root | ||
| cd /d "%~dp0" | ||
|
|
||
| REM Activate virtual environment if it exists | ||
| if exist ".venv\Scripts\activate.bat" ( | ||
| echo Activating virtual environment... | ||
| call .venv\Scripts\activate.bat | ||
| ) else ( | ||
| echo Warning: Virtual environment not found at .venv\Scripts\activate.bat | ||
| echo Continuing with system Python... | ||
| ) | ||
|
|
||
| REM Check required tools | ||
| echo Checking required tools... | ||
| where node >nul 2>nul | ||
| if %ERRORLEVEL% NEQ 0 ( | ||
| echo ERROR: Node.js is not installed or not in PATH | ||
| echo Please install Node.js from https://nodejs.org/ | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| where python >nul 2>nul | ||
| if %ERRORLEVEL% NEQ 0 ( | ||
| echo ERROR: Python is not installed or not in PATH | ||
| echo Please install Python from https://python.org/ | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Install Python dependencies with electron extras | ||
| if "%SKIP_DEPENDENCY_INSTALL%"=="1" ( | ||
| echo Skipping Python dependency installation (CI mode) | ||
| ) else ( | ||
| echo Installing Python dependencies... | ||
| where uv >nul 2>nul | ||
| if %ERRORLEVEL% EQU 0 ( | ||
| echo Using uv package manager... | ||
| uv pip install "pyinstaller>=6.14.0" "pyinstaller-hooks-contrib>=2024.0" | ||
| uv pip install -e .[electron] | ||
| ) else ( | ||
| echo Using pip package manager... | ||
| python -m pip install "pyinstaller>=6.14.0" "pyinstaller-hooks-contrib>=2024.0" | ||
| python -m pip install -e .[electron] | ||
| ) | ||
| if errorlevel 1 ( | ||
| echo ERROR: Failed to install Python dependencies | ||
| exit /b 1 | ||
| ) | ||
| ) | ||
|
|
||
| @REM REM Verify PyInstaller version | ||
| @REM echo Verifying PyInstaller installation... | ||
| @REM python -c "import pyinstaller; print('PyInstaller version:', pyinstaller.__version__)" | ||
| @REM if errorlevel 1 ( | ||
| @REM echo ERROR: PyInstaller not properly installed | ||
| @REM exit /b 1 | ||
| @REM ) | ||
|
|
||
| REM Build Python backend with PyInstaller | ||
| echo Building Python backend... | ||
| cd synapse-electron\backend | ||
|
|
||
| REM Clean previous builds | ||
| if exist dist rmdir /s /q dist | ||
| if exist build rmdir /s /q build | ||
| if exist *.spec del *.spec | ||
|
|
||
| REM Build using the same pattern as the working build | ||
| pyinstaller ^ | ||
| --onefile ^ | ||
| --name "synapse-backend" ^ | ||
| --collect-all=synapseclient ^ | ||
| --collect-all=fastapi ^ | ||
| --collect-all=uvicorn ^ | ||
| --collect-all=starlette ^ | ||
| --collect-all=pydantic ^ | ||
| --collect-all=websockets ^ | ||
| --paths "..\.." ^ | ||
| --paths "..\..\synapseclient" ^ | ||
| --console ^ | ||
| server.py | ||
|
|
||
| echo Checking if executable was created... | ||
| if not exist "dist\synapse-backend.exe" ( | ||
| echo ERROR: PyInstaller failed to create executable | ||
| echo Check the output above for errors | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if errorlevel 1 ( | ||
| echo ERROR: Python backend build failed | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| echo Python backend built successfully | ||
|
|
||
| REM Go back to electron directory | ||
| cd .. | ||
|
|
||
| @REM REM Install Node.js dependencies | ||
| @REM echo. | ||
| @REM echo ======================================== | ||
| @REM echo Installing Node.js dependencies... | ||
| @REM echo ======================================== | ||
| @REM echo DEBUG: About to run npm install | ||
| @REM npm install --verbose | ||
| @REM echo DEBUG: npm install command completed | ||
| @REM set NPM_INSTALL_EXIT=%ERRORLEVEL% | ||
| @REM echo DEBUG: npm install exit code: %NPM_INSTALL_EXIT% | ||
| @REM REM Check if node_modules exists to verify successful install | ||
| @REM if not exist "node_modules" ( | ||
| @REM echo ERROR: Failed to install Node.js dependencies - node_modules directory not found | ||
| @REM exit /b 1 | ||
| @REM ) | ||
| @REM echo DEBUG: Node.js dependencies installed successfully | ||
| @REM echo DEBUG: Continuing to Electron build step... | ||
|
|
||
| REM Build Electron application | ||
| echo. | ||
| echo ======================================== | ||
| echo Building Electron application... | ||
| echo ======================================== | ||
| echo DEBUG: About to run npm run dist | ||
| echo Running: npm run dist | ||
| npm run dist --verbose | ||
| if errorlevel 1 ( | ||
| echo ERROR: Electron build failed | ||
| echo Check the output above for details | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| echo. | ||
| echo Build complete! | ||
| echo. | ||
| echo Electron application packages are in: synapse-electron\dist\ | ||
| echo Python backend executable is in: synapse-electron\backend\dist\ | ||
|
|
||
| REM Show built files | ||
| echo Built files: | ||
| if exist dist ( | ||
| dir /b dist\*.exe 2>nul | ||
| dir /b dist\*.dmg 2>nul | ||
| dir /b dist\*.AppImage 2>nul | ||
| ) | ||
|
|
||
| echo. | ||
| echo SUCCESS: Synapse Desktop Client built! | ||
|
|
||
| pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Build script for Synapse Desktop Client (Electron + Python Backend) | ||
| # This script creates a complete packaged application with both frontend and backend | ||
| # Usage: ./build_electron_app.sh [platform] | ||
| # Platforms: linux, macos, all | ||
|
|
||
| set -e | ||
|
|
||
| # Default to current platform if no argument provided | ||
| TARGET_PLATFORM=${1:-"auto"} | ||
|
|
||
| echo "Building Synapse Desktop Client (Electron + Python Backend)..." | ||
|
|
||
| # Ensure we're in the project root | ||
| cd "$(dirname "$0")" | ||
|
|
||
| # Activate virtual environment if it exists | ||
| if [ -f ".venv/bin/activate" ]; then | ||
| echo "Activating virtual environment..." | ||
| source .venv/bin/activate | ||
| else | ||
| echo "Warning: Virtual environment not found at .venv/bin/activate" | ||
| echo "Continuing with system Python..." | ||
| fi | ||
|
|
||
| # Check required tools | ||
| echo "Checking required tools..." | ||
| if ! command -v node &> /dev/null; then | ||
| echo "ERROR: Node.js is not installed or not in PATH" | ||
| echo "Please install Node.js from https://nodejs.org/" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v python3 &> /dev/null; then | ||
| echo "ERROR: Python is not installed or not in PATH" | ||
| echo "Please install Python from https://python.org/" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Install Python dependencies with electron extras | ||
| if [ "$SKIP_DEPENDENCY_INSTALL" = "1" ]; then | ||
| echo "Skipping Python dependency installation (CI mode)" | ||
| else | ||
| echo "Installing Python dependencies..." | ||
| if command -v uv &> /dev/null; then | ||
| echo "Using uv package manager..." | ||
| uv pip install "pyinstaller>=6.14.0" "pyinstaller-hooks-contrib>=2024.0" | ||
| uv pip install -e ".[electron]" | ||
| else | ||
| echo "Using pip package manager..." | ||
| python3 -m pip install "pyinstaller>=6.14.0" "pyinstaller-hooks-contrib>=2024.0" | ||
| python3 -m pip install -e ".[electron]" | ||
| fi | ||
| fi | ||
|
|
||
| # Verify PyInstaller version | ||
| # echo "Verifying PyInstaller installation..." | ||
| # python3 -c "import PyInstaller; print('PyInstaller version:', PyInstaller.__version__)" | ||
| # if [ $? -ne 0 ]; then | ||
| # echo "ERROR: PyInstaller not properly installed" | ||
| # exit 1 | ||
| # fi | ||
|
|
||
| # Function to build Python backend for a specific platform | ||
| build_python_backend() { | ||
| local platform=$1 | ||
|
|
||
| echo "Building Python backend for $platform..." | ||
| cd synapse-electron/backend | ||
|
|
||
| # Clean previous builds | ||
| rm -rf dist/ build/ *.spec | ||
|
|
||
| # Create PyInstaller spec and build | ||
| pyinstaller \ | ||
| --onefile \ | ||
| --name "synapse-backend" \ | ||
| --collect-all=synapseclient \ | ||
| --collect-all=fastapi \ | ||
| --collect-all=uvicorn \ | ||
| --collect-all=starlette \ | ||
| --collect-all=pydantic \ | ||
| --collect-all=websockets \ | ||
| --paths "../.." \ | ||
| --paths "../../synapseclient" \ | ||
| --console \ | ||
| server.py | ||
|
|
||
| if [ ! -f "dist/synapse-backend" ]; then | ||
| echo "ERROR: Python backend build failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Python backend built successfully" | ||
| cd ../.. | ||
| } | ||
|
|
||
| # Function to build Electron app for a specific platform | ||
| build_electron_app() { | ||
| local platform=$1 | ||
|
|
||
| echo "Building Electron application for $platform..." | ||
| cd synapse-electron | ||
|
|
||
| # # Install Node.js dependencies | ||
| # echo "Installing Node.js dependencies..." | ||
| # npm install | ||
|
|
||
| # Set platform-specific build command | ||
| case "$platform" in | ||
| "linux") | ||
| npm run build -- --linux | ||
| ;; | ||
| "macos") | ||
| npm run build -- --mac | ||
| ;; | ||
| "windows") | ||
| npm run build -- --win | ||
| ;; | ||
| *) | ||
| npm run build | ||
| ;; | ||
| esac | ||
|
|
||
| cd .. | ||
| } | ||
|
|
||
| # Determine what to build | ||
| case "$TARGET_PLATFORM" in | ||
| "auto") | ||
| # Auto-detect current platform | ||
| if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
| build_python_backend "linux" | ||
| build_electron_app "linux" | ||
| elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
| build_python_backend "macos" | ||
| build_electron_app "macos" | ||
| else | ||
| echo "Unsupported platform: $OSTYPE" | ||
| echo "This script supports Linux and macOS platforms" | ||
| echo "Please specify platform: linux, macos, or all" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| "linux") | ||
| build_python_backend "linux" | ||
| build_electron_app "linux" | ||
| ;; | ||
| "macos") | ||
| build_python_backend "macos" | ||
| build_electron_app "macos" | ||
| ;; | ||
| "all") | ||
| echo "Building for all supported platforms..." | ||
| build_python_backend "linux" | ||
| build_python_backend "macos" | ||
| build_electron_app "linux" | ||
| build_electron_app "macos" | ||
| ;; | ||
| *) | ||
| echo "Unknown platform: $TARGET_PLATFORM" | ||
| echo "Available platforms: linux, macos, all" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "" | ||
| echo "Build(s) complete!" | ||
| echo "" | ||
| echo "Electron application packages are in: synapse-electron/dist/" | ||
| echo "Python backend executables are in: synapse-electron/backend/dist/" | ||
|
|
||
| echo "" | ||
| echo "Available packages:" | ||
| if [ -d "synapse-electron/dist" ]; then | ||
| ls -la synapse-electron/dist/ | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this app look like just within the terminal?
The reason I ask is because there is another use case for people that work in HPCs that may just want to easily install the CLI and work within the terminal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this will work within the terminal - It wasn't built to be able to work without a UI. I left this is for us to target later if it's something we want to build for this platform.
In an EC2 instance when I build with the shell script I get
Synapse Desktop Client-1.0.0.AppImageand running it fails with this error:I don't have an ubuntu instance set up with a GUI at the moment so I wasn't going to worry about it.
For the usecase of running this within HPCs and other terminals we may want to provide our CLI as a package that can be installed - Rather than this desktop application. Since the CLI will have commands meant to run in the terminal it'll lend itself much better to this usecase.