Skip to content

Commit e93a569

Browse files
authored
Merge branch 'axelwalter:main' into Abzer-branch
2 parents ea6ce8d + 89e743b commit e93a569

6 files changed

+46
-136
lines changed

.github/workflows/build-windows-executable-app.yaml

+36-54
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches: [ "main" ]
55
pull_request:
66
branches: [ "main" ]
7+
workflow_dispatch:
78

89
jobs:
910
build-executable:
@@ -14,71 +15,52 @@ jobs:
1415

1516
steps:
1617
- name: Checkout
17-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1819

19-
- name: Set up Python
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: ${{ env.PYTHON_VERSION }}
23-
24-
- name: Setup virtual environment
25-
shell: cmd
20+
- name: Setup python embeddable version
2621
run: |
27-
python -m venv myenv
28-
29-
call myenv\Scripts\activate.bat
22+
mkdir python-${{ env.PYTHON_VERSION }}
23+
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
24+
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
25+
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
3026
31-
pip install -r requirements.txt
32-
33-
pip install pyinstaller
34-
35-
- name: Write function to cli.py
36-
shell: bash
27+
- name: Install pip
3728
run: |
38-
dir D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages
39-
head -n -2 D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages/streamlit/web/cli.py > temp_cli.py
40-
41-
cat << EOF >> temp_cli.py
42-
def _main_run_clExplicit(file, command_line, args=[], flag_options=[]):
43-
main._is_running_with_streamlit = True
44-
bootstrap.run(file, command_line, args, flag_options)
29+
curl -O https://bootstrap.pypa.io/get-pip.py
30+
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
31+
rm get-pip.py
4532
46-
47-
if __name__ == "__main__":
48-
main()
49-
EOF
50-
51-
mv temp_cli.py D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages/streamlit/web/cli.py
52-
53-
- name: Compile app with pyinstaller
54-
shell: cmd
33+
- name: Uncomment 'import site' in python311._pth file
5534
run: |
56-
call myenv\Scripts\activate.bat
57-
pyinstaller --onefile --additional-hooks-dir ./hooks run.py --clean
35+
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
5836
37+
- name: Install Required Packages
38+
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements-windows.txt --no-warn-script-location
5939

60-
- name: Copy everything to dist directory
40+
- name: Create FBmn-STATS-GUIde.bat file
6141
run: |
62-
cp -r .streamlit dist/.streamlit
63-
cp -r pages dist/pages
64-
cp -r src dist/src
65-
cp -r assets dist/assets
66-
cp -r example-data dist/example-data
67-
cp Statistics_for_Metabolomics.py dist/
68-
69-
- name: Modify .spec file
70-
shell: bash
42+
echo '@echo off' > FBmn-STATS-GUIde.bat
43+
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run Statistics_for_Metabolomics.py' >> FBmn-STATS-GUIde.bat
44+
45+
- name: Create All-in-one executable folder
7146
run: |
72-
cp run_app_temp.spec run_app.spec
73-
74-
- name: Make executable
75-
shell: cmd
47+
mkdir streamlit_exe
48+
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
49+
mv FBmn-STATS-GUIde.bat streamlit_exe
50+
cp -r src streamlit_exe
51+
cp -r pages streamlit_exe
52+
cp -r assets streamlit_exe
53+
cp -r example-data streamlit_exe
54+
cp -r .streamlit streamlit_exe
55+
cp Statistics_for_Metabolomics.py streamlit_exe
56+
57+
58+
- name: Compress streamlit_exe folder to FBmn-STATS-GUIde.zip
7659
run: |
77-
call myenv\Scripts\activate.bat
78-
pyinstaller run_app.spec --clean
60+
7z a FBmn-STATS-GUIde.zip ./streamlit_exe/* -r
7961
8062
- name: Upload artifact
81-
uses: actions/upload-artifact@v3
63+
uses: actions/upload-artifact@v4
8264
with:
83-
name: FBMN-Stats-App
84-
path: dist
65+
name: FBmn-STATS-GUIde
66+
path: FBmn-STATS-GUIde.zip

hooks/hook-streamlit.py

-15
This file was deleted.

requirements-windows.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
streamlit
2+
numpy
3+
pandas
4+
plotly
5+
pingouin
6+
kaleido
7+
openpyxl
8+
scikit-posthocs
9+
git+https://github.com/Wang-Bioinformatics-Lab/GNPSDataPackage.git

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
streamlit==1.29.0
1+
streamlit==1.35.0
22
numpy==1.24.4
33
pandas==2.2.2
44
plotly==5.21.0

run.py

-7
This file was deleted.

run_app_temp.spec

-59
This file was deleted.

0 commit comments

Comments
 (0)