Skip to content

Commit 7245ca0

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents a13eac0 + de0458a commit 7245ca0

24 files changed

+3988
-166
lines changed

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,30 @@ jobs:
235235
cp $PYTHON_DIR/DLLs/tcl86t.dll $EMBED_DIR/
236236
cp $PYTHON_DIR/DLLs/tk86t.dll $EMBED_DIR/
237237
238-
- name: Install pip
239-
run: |
240-
curl -O https://bootstrap.pypa.io/get-pip.py
241-
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
242-
rm get-pip.py
243-
244238
- name: Uncomment 'import site' in python311._pth file
245239
run: |
246240
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
247241
248242
- name: Install Required Packages
249-
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements.txt --no-warn-script-location
243+
# Use system Python (which has development headers) to compile packages,
244+
# installing into the embeddable Python's site-packages directory.
245+
# The embeddable Python lacks Python.h headers needed for native extensions.
246+
run: python -m pip install -r requirements.txt --target python-${{ env.PYTHON_VERSION }}/Lib/site-packages --upgrade --no-warn-script-location
247+
248+
- name: Clean up unnecessary Python files
249+
shell: pwsh
250+
run: |
251+
$sitePkgs = "py/Lib/site-packages"
252+
253+
# Remove __pycache__ directories
254+
Get-ChildItem -Path $sitePkgs -Recurse -Directory -Filter "__pycache__" | Remove-Item -Recurse -Force
255+
256+
# Remove test directories
257+
Get-ChildItem -Path $sitePkgs -Recurse -Directory | Where-Object { $_.Name -match "^tests?$" } | Remove-Item -Recurse -Force
258+
259+
# Count remaining files
260+
$count = (Get-ChildItem -Path $sitePkgs -Recurse -File).Count
261+
Write-Host "Remaining files in site-packages: $count"
250262
251263
- name: Set to offline deployment
252264
run: |
@@ -357,7 +369,7 @@ jobs:
357369
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
358370
<Product Id="*" Name="${{ env.APP_NAME }}" Language="1033" Version="1.0.0.0" Codepage="1252" Manufacturer="OpenMS Developer Team" UpgradeCode="${{ env.APP_UpgradeCode }}">
359371
<Package Id="*" InstallerVersion="300" Compressed="yes" InstallPrivileges="elevated" Platform="x64" />
360-
<Media Id="1" Cabinet="streamlit.cab" EmbedCab="yes" />
372+
<MediaTemplate EmbedCab="yes" MaximumUncompressedMediaSize="200" CabinetTemplate="data{0}.cab" />
361373
362374
<!-- Folder structure -->
363375
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

.github/workflows/test-win-exe-w-embed-py.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,31 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
1919

20+
- name: Set up Python (regular distribution)
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version
24+
2025
- name: Download python embeddable version
2126
run: |
2227
mkdir python-${{ env.PYTHON_VERSION }}
2328
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
2429
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
2530
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
2631
27-
- name: Install pip
28-
run: |
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
32-
3332
- name: Uncomment 'import site' in python311._pth file
3433
run: |
3534
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
36-
35+
3736
- name: Print content of python311._pth file
3837
run: |
3938
cat python-${{ env.PYTHON_VERSION }}/python311._pth
4039
4140
- name: Install Required Packages
42-
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install -r requirements.txt --no-warn-script-location
41+
# Use system Python (which has development headers) to compile packages,
42+
# installing into the embeddable Python's site-packages directory.
43+
# The embeddable Python lacks Python.h headers needed for native extensions.
44+
run: python -m pip install -r requirements.txt --target python-${{ env.PYTHON_VERSION }}/Lib/site-packages --upgrade --no-warn-script-location
4345

4446
- name: Create .bat file
4547
run: |

.github/workflows/test-win-exe-w-pyinstaller.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ jobs:
6868
6969
- name: Copy everything to dist directory
7070
shell: bash
71-
run: |
71+
run: |
7272
cp -r .streamlit dist/.streamlit
7373
cp -r content dist/content
7474
cp -r src dist/src
7575
cp -r example-data dist/example-data
7676
cp -r assets dist/assets
7777
cp app.py dist/
78+
cp presets.json dist/
7879
7980
- name: Modify .spec file
8081
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ python*
1111
**/__pycache__/
1212
gdpr_consent/node_modules/
1313
*~
14+
.streamlit/secrets.toml

.streamlit/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ gatherUsageStats = false
55
developmentMode = false
66

77
[server]
8+
address = "0.0.0.0"
89
maxUploadSize = 200 #MB
910
port = 8501 # should be same as configured in deployment repo
11+
address = "0.0.0.0"
12+
enableCORS = false
13+
enableXsrfProtection = false
14+
1015

1116
[theme]
1217
# The preset Streamlit theme that your custom theme inherits from. One of "light" or "dark".

.streamlit/secrets.toml.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Streamlit Secrets Configuration
2+
# Copy this file to secrets.toml and fill in your values.
3+
# IMPORTANT: Never commit secrets.toml to version control!
4+
5+
[admin]
6+
# Password required to save workspaces as demo workspaces (online mode only)
7+
# Set a strong, unique password here
8+
password = "your-secure-admin-password-here"

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ COPY utils/ /app/utils
7373
COPY app.py /app/app.py
7474
COPY settings.json /app/settings.json
7575
COPY default-parameters.json /app/default-parameters.json
76+
COPY presets.json /app/presets.json
7677

7778
# For streamlit configuration
78-
COPY .streamlit/config.toml /app/.streamlit/config.toml
79-
79+
COPY .streamlit/ /app/.streamlit/
8080
COPY clean-up-workspaces.py /app/clean-up-workspaces.py
8181

8282
# add cron job to the crontab
@@ -114,13 +114,13 @@ if [ "$SERVER_COUNT" -gt 1 ]; then\n\
114114
\n\
115115
# Write nginx config\n\
116116
mkdir -p /etc/nginx\n\
117-
echo -e "worker_processes auto;\\npid /run/nginx.pid;\\n\\nevents {\\n worker_connections 1024;\\n}\\n\\nhttp {\\n client_max_body_size 0;\\n\\n map \\$cookie_stroute \\$route_key {\\n \\x22\\x22 \\$request_id;\\n default \\$cookie_stroute;\\n }\\n\\n upstream streamlit_backend {\\n hash \\$route_key consistent;\\n${UPSTREAM_SERVERS} }\\n\\n map \\$http_upgrade \\$connection_upgrade {\\n default upgrade;\\n \\x27\\x27 close;\\n }\\n\\n server {\\n listen 8501;\\n\\n location / {\\n proxy_pass http://streamlit_backend;\\n proxy_http_version 1.1;\\n proxy_set_header Upgrade \\$http_upgrade;\\n proxy_set_header Connection \\$connection_upgrade;\\n proxy_set_header Host \\$host;\\n proxy_set_header X-Real-IP \\$remote_addr;\\n proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;\\n proxy_set_header X-Forwarded-Proto \\$scheme;\\n proxy_read_timeout 86400;\\n proxy_send_timeout 86400;\\n proxy_buffering off;\\n add_header Set-Cookie \\x22stroute=\\$route_key; Path=/; HttpOnly; SameSite=Lax\\x22 always;\\n }\\n }\\n}" > /etc/nginx/nginx.conf\n\
117+
echo -e "worker_processes auto;\\npid /run/nginx.pid;\\n\\nevents {\\n worker_connections 1024;\\n}\\n\\nhttp {\\n client_max_body_size 0;\\n\\n map \\$cookie_stroute \\$route_key {\\n \\x22\\x22 \\$request_id;\\n default \\$cookie_stroute;\\n }\\n\\n upstream streamlit_backend {\\n hash \\$route_key consistent;\\n${UPSTREAM_SERVERS} }\\n\\n map \\$http_upgrade \\$connection_upgrade {\\n default upgrade;\\n \\x27\\x27 close;\\n }\\n\\n server {\\n listen 0.0.0.0:8501;\\n\\n location / {\\n proxy_pass http://streamlit_backend;\\n proxy_http_version 1.1;\\n proxy_set_header Upgrade \\$http_upgrade;\\n proxy_set_header Connection \\$connection_upgrade;\\n proxy_set_header Host \\$host;\\n proxy_set_header X-Real-IP \\$remote_addr;\\n proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;\\n proxy_set_header X-Forwarded-Proto \\$scheme;\\n proxy_read_timeout 86400;\\n proxy_send_timeout 86400;\\n proxy_buffering off;\\n add_header Set-Cookie \\x22stroute=\\$route_key; Path=/; HttpOnly; SameSite=Lax\\x22 always;\\n }\\n }\\n}" > /etc/nginx/nginx.conf\n\
118118
\n\
119-
# Start Streamlit instances on internal ports (localhost only)\n\
119+
# Start Streamlit instances on internal ports\n\
120120
for i in $(seq 0 $((SERVER_COUNT - 1))); do\n\
121121
PORT=$((BASE_PORT + i))\n\
122122
echo "Starting Streamlit instance on port $PORT..."\n\
123-
streamlit run app.py --server.port $PORT --server.address 127.0.0.1 &\n\
123+
streamlit run app.py --server.port $PORT --server.address 0.0.0.0 &\n\
124124
done\n\
125125
\n\
126126
sleep 2\n\
@@ -129,7 +129,7 @@ if [ "$SERVER_COUNT" -gt 1 ]; then\n\
129129
else\n\
130130
# Single instance mode (default) - run Streamlit directly on port 8501\n\
131131
echo "Starting Streamlit app..."\n\
132-
exec streamlit run app.py\n\
132+
exec streamlit run app.py --server.address 0.0.0.0\n\
133133
fi\n\
134134
' > /app/entrypoint.sh
135135
# make the script executable

0 commit comments

Comments
 (0)