diff --git a/app.py b/app.py
index 2f863cde..4952a8c8 100644
--- a/app.py
+++ b/app.py
@@ -1,11 +1,16 @@
import streamlit as st
from pathlib import Path
+import json
# For some reason the windows version only works if this is imported here
import pyopenms
+if "settings" not in st.session_state:
+ with open("settings.json", "r") as f:
+ st.session_state.settings = json.load(f)
+
if __name__ == '__main__':
pages = {
- "OpenMS Web App" : [
+ str(st.session_state.settings["app-name"]) : [
st.Page(Path("content", "quickstart.py"), title="Quickstart", icon="👋"),
st.Page(Path("content", "documentation.py"), title="Documentation", icon="📖"),
],
diff --git a/docs/win_exe_with_embed_py.md b/docs/win_exe_with_embed_py.md
index 6db6ceae..35719958 100644
--- a/docs/win_exe_with_embed_py.md
+++ b/docs/win_exe_with_embed_py.md
@@ -7,51 +7,51 @@ Here's a step-by-step guide:
1. Download a suitable Python embeddable version. For example, let's download Python 3.11.9:
- ```bash
- # use curl command or manually download
- curl -O https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip
- ```
+ ```bash
+ # use curl command or manually download
+ curl -O https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip
+ ```
2. Extract the downloaded zip file:
- ```bash
- mkdir python-3.11.9
+ ```bash
+ mkdir python-3.11.9
- unzip python-3.11.9-embed-amd64.zip -d python-3.11.9
+ unzip python-3.11.9-embed-amd64.zip -d python-3.11.9
- rm python-3.11.9-embed-amd64.zip
- ```
+ rm python-3.11.9-embed-amd64.zip
+ ```
### Install pip
1. Download `get-pip.py`:
- ```bash
- # use curl command or manually download
- curl -O https://bootstrap.pypa.io/get-pip.py
- ```
+ ```bash
+ # use curl command or manually download
+ curl -O https://bootstrap.pypa.io/get-pip.py
+ ```
2. Install pip:
- ```bash
- ./python-3.11.9/python get-pip.py --no-warn-script-location
+ ```bash
+ ./python-3.11.9/python get-pip.py --no-warn-script-location
- # no need anymore get-pip.py
- rm get-pip.py
- ```
+ # no need anymore get-pip.py
+ rm get-pip.py
+ ```
### Configure Python Environment
1. Uncomment 'import site' in the `._pth` file:
- ```bash
- # Uncomment to run site.main() automatically
- # Remove hash from python-3.11.9/python311._pth file
- import site
+ ```bash
+ # Uncomment to run site.main() automatically
+ # Remove hash from python-3.11.9/python311._pth file
+ import site
- # Or use command
- sed -i '/^\s*#\s*import\s\+site/s/^#//' python-3.11.9/python311._pth
- ```
+ # Or use command
+ sed -i '/^\s*#\s*import\s\+site/s/^#//' python-3.11.9/python311._pth
+ ```
### Install Required Packages
@@ -65,45 +65,212 @@ Install all required packages from `requirements.txt`:
1. Test by running app
- ```batch
- .\python-3.11.9\python -m streamlit run app.py
- ```
+ ```batch
+ .\python-3.11.9\python -m streamlit run app.py
+ ```
2. Create a Clickable Shortcut
- Create a `run_app.bat` file to make running the app easier:
-
- ```batch
- echo @echo off > run_app.bat
- echo .\\python-3.11.9\\python -m streamlit run app.py >> run_app.bat
- ```
+ Create a `run_app.bat` file to make running the app easier:
+
+ ```batch
+ echo @echo off > run_app.bat
+ echo .\\python-3.11.9\\python -m streamlit run app.py >> run_app.bat
+ ```
### Create one executable folder
1. Create a folder for your Streamlit app:
- ```bash
- mkdir ../streamlit_exe
- ```
+ ```bash
+ mkdir ../streamlit_exe
+ ```
2. Copy environment and app files:
- ```bash
- # move Python environment folder
- mv python-3.11.9 ../streamlit_exe
+ ```bash
+ # move Python environment folder
+ mv python-3.11.9 ../streamlit_exe
+
+ # move run_app.bat file
+ mv run_app.bat ../streamlit_exe
- # move run_app.bat file
- mv run_app.bat ../streamlit_exe
+ # copy streamlit app files
+ cp -r src pages .streamlit assets example-data ../streamlit_exe
+ cp app.py ../streamlit_exe
+ ```
- # copy streamlit app files
- cp -r src pages .streamlit assets example-data ../streamlit_exe
- cp app.py ../streamlit_exe
- ```
-
#### 🚀 After successfully completing all these steps, the Streamlit app will be available by running the run_app.bat file.
:pencil: You can still change the configuration of Streamlit app with .streamlit/config.toml file, e.g., provide a different port, change upload size, etc.
## Build executable in github action automatically
+
Automate the process of building executables for your project with the GitHub action example [Test streamlit executable for Windows with embeddable python](https://github.com/OpenMS/streamlit-template/blob/main/.github/workflows/test-win-exe-w-embed-py.yaml)
+
+## Create MSI Installer using WiX Toolset
+
+After creating your executable folder, you can package it into an MSI installer using WiX Toolset. Here's how:
+
+### 1. Set Environment Variables
+
+Set these variables for consistent naming throughout the process:
+
+```batch
+APP_NAME=OpenMS-StreamlitTemplateApp
+APP_UpgradeCode=4abc2e23-3ba5-40e4-95c9-09e6cb8ecaeb
+```
+
+To create a new GUID for your application's UpgradeCode, you can use:
+
+- PowerShell: `[guid]::NewGuid().ToString()`
+- Online GUID generator: https://www.guidgen.com/
+- Windows Command Prompt: `powershell -Command "[guid]::NewGuid().ToString()"`
+
+### 2. Install WiX Toolset
+
+1. Download WiX Toolset binaries:
+ ```batch
+ curl -LO https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip
+ unzip wix311-binaries.zip -d wix
+ ```
+
+### 3. Prepare Installation Files
+
+1. Create a SourceDir structure:
+
+ ```batch
+ mkdir SourceDir
+ move streamlit_exe\* SourceDir
+ ```
+
+2. Create Readme.txt:
+
+ ```batch
+ # Create a Readme.txt file in the SourceDir folder with instructions
+ # for launching the application
+ ```
+
+3. Add necessary assets:
+ - Copy license file: `copy assets\openms_license.rtf SourceDir\`
+ - Copy app icon: `copy assets\openms.ico SourceDir\`
+ - Create success message script:
+ ```vbscript
+ ' ShowSuccessMessage.vbs
+ MsgBox "The " & "%APP_NAME%" & " application is successfully installed.", vbInformation, "Installation Complete"
+ ```
+
+### 4. Generate WiX Source Files
+
+1. Generate component list from your files:
+
+ ```batch
+ wix\heat.exe dir SourceDir -gg -sfrag -sreg -srd -template component -cg StreamlitExeFiles -dr AppSubFolder -out streamlit_exe_files.wxs
+ ```
+
+2. Create main WiX configuration file (streamlit_exe.wxs):
+
+ ```xml
+
+