Skip to content

Commit

Permalink
Merge pull request #69 from t0mdavid-m/fix_windows_deployment
Browse files Browse the repository at this point in the history
fix folder names
  • Loading branch information
t0mdavid-m authored Nov 27, 2024
2 parents ff7f177 + b2d63bc commit c2ae3ec
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 14 deletions.
45 changes: 36 additions & 9 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ jobs:
build-openms:
runs-on: windows-latest

env:
OPENMS_VERSION: 3.0.0

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -157,7 +154,7 @@ jobs:
ENABLE_STYLE_TESTING: "OFF"
ENABLE_TOPP_TESTING: "ON"
ENABLE_CLASS_TESTING: "ON"
WITH_GUI: "ON"
WITH_GUI: "OFF"
ADDRESS_SANITIZER: "Off"
BUILD_TYPE: "Release"
OPENMP: "Off"
Expand Down Expand Up @@ -227,13 +224,35 @@ jobs:
cp -r openms-package/bin ../openms-bin
cp -r openms-package/share ../share
- name: Set up Python (regular distribution)
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version

- name: Setup python embeddable version
run: |
# Create a directory for the embeddable Python version
mkdir python-${{ env.PYTHON_VERSION }}
# Download and unzip the embeddable Python version
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
# Define paths for the regular Python distribution and the embeddable distribution
$PYTHON_DIR="${{ runner.tool_cache }}/Python/${{ env.PYTHON_VERSION }}/x64" # Path from actions/setup-python
$EMBED_DIR="python-${{ env.PYTHON_VERSION }}"
mkdir -p $EMBED_DIR/Lib/site-packages/tkinter
mkdir -p $EMBED_DIR/tcl
# Copy necessary Tkinter files from the regular Python distribution
cp -r $PYTHON_DIR/Lib/tkinter/* $EMBED_DIR/Lib/site-packages/tkinter/
cp -r $PYTHON_DIR/tcl/* $EMBED_DIR/tcl/
cp $PYTHON_DIR/DLLs/_tkinter.pyd $EMBED_DIR/
cp $PYTHON_DIR/DLLs/tcl86t.dll $EMBED_DIR/
cp $PYTHON_DIR/DLLs/tk86t.dll $EMBED_DIR/
- name: Install pip
run: |
curl -O https://bootstrap.pypa.io/get-pip.py
Expand All @@ -251,22 +270,30 @@ jobs:
run: |
echo '@echo off' > run_app.bat
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run app.py local' >> run_app.bat
- name: Set to offline deployment
run: |
$content = Get-Content -Raw settings.json | ConvertFrom-Json
$content.online_deployment = $false
$content | ConvertTo-Json -Depth 100 | Set-Content settings.json
- name: Create All-in-one executable folder
run: |
mkdir streamlit_exe
mkdir streamlit_exe/js-component
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
mv run_app.bat streamlit_exe
cp -r src streamlit_exe
cp -r pages streamlit_exe
cp -r content streamlit_exe
cp -r assets streamlit_exe
cp -r example-data streamlit_exe
cp -r .streamlit streamlit_exe
cp openms-bin/*.dll streamlit_exe
cp -r .streamlit streamlit_exe
cp -r share streamlit_exe/share
cp -r js-dist streamlit_exe/js-component/dist
cp -r js-component streamlit_exe/js-component
cp app.py streamlit_exe
cp settings.json streamlit_exe
cp default-parameters.json streamlit_exe
$files = $env:TOPP_TOOLS -split ' '
foreach ($file in $files) {
Expand Down
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import streamlit as st
from pathlib import Path
# For some reason the windows version only works if this is imported here
import pyopenms

if __name__ == '__main__':
pages = {
Expand Down
4 changes: 1 addition & 3 deletions src/common/captcha_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import os


consent_component = st_components.declare_component("gdpr_consent", path=Path("gdpr_consent"))


def delete_all_pages(main_script_path_str: str) -> None:
"""
Delete all pages except the main page from an app's configuration.
Expand Down Expand Up @@ -203,6 +200,7 @@ def captcha_control():
ga = st.session_state.settings['analytics']['google-analytics']['enabled']
pp = st.session_state.settings['analytics']['piwik-pro']['enabled']
if (ga or pp) and (st.session_state.tracking_consent is None):
consent_component = st_components.declare_component("gdpr_consent", path=Path("gdpr_consent"))
with st.spinner():
# Ask for consent
st.session_state.tracking_consent = consent_component(
Expand Down
2 changes: 0 additions & 2 deletions src/workflow/StreamlitUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,6 @@ def remove_full_paths(d: dict) -> dict:

for k, v in params.items():
# skip if v is a file path
if Path(str(v)).exists():
continue
if isinstance(v, dict):
topp[k] = v
elif ".py" in k:
Expand Down

0 comments on commit c2ae3ec

Please sign in to comment.