Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
a47e05e
test: add initial GUI test
jcharkow Nov 13, 2024
97a4126
add test_file_upload
jcharkow Dec 6, 2024
a188904
add vim tmp files to .gitignore
jcharkow Dec 6, 2024
87e82c5
progress add view tests
jcharkow Dec 6, 2024
b035ac1
Merge branch 'main' into add_tests
jcharkow Dec 6, 2024
99c30a6
add more specific tests for run_workflow
jcharkow Dec 6, 2024
e1cc1db
add ci test with gh actions
jcharkow Dec 6, 2024
31f9a55
fix ci file
jcharkow Dec 11, 2024
bfaa0d4
add pytest to ci file
jcharkow Dec 11, 2024
c320944
add docker compose to template
t0mdavid-m Jan 2, 2025
f32dbd2
newGUID build full app
Arslan-Siraj Jan 2, 2025
45b6e1b
newGUID build with embeddable pyth
Arslan-Siraj Jan 2, 2025
7cd0a41
Merge pull request #125 from t0mdavid-m/add_docker_compose
t0mdavid-m Jan 2, 2025
749584a
Add info for processor architectures.
t0mdavid-m Jan 5, 2025
3b26eaf
Fix typo
t0mdavid-m Jan 5, 2025
b50a587
Merge pull request #126 from Arslan-Siraj/development-wix
t0mdavid-m Jan 15, 2025
dfdd384
test: update run workflow test
jcharkow Jan 22, 2025
db3be5b
test: add comment to spectrum visualization
jcharkow Jan 22, 2025
86f01df
test: try to add spectrum plot test
jcharkow Jan 22, 2025
57a4343
Merge branch 'main' into add_tests
jcharkow Jan 22, 2025
fc80ccd
test: fix bugs
jcharkow Jan 22, 2025
548feaa
add citation section in readme
t0mdavid-m Jan 30, 2025
ca1771f
update citations in parameter summary
t0mdavid-m Jan 30, 2025
de51dd9
temp switcheroo
t0mdavid-m Feb 14, 2025
5104123
fix mamba env
t0mdavid-m Feb 14, 2025
346c934
temp switcheroo 2
t0mdavid-m Feb 14, 2025
d701e1e
Merge pull request #134 from OpenMS/fix_dockerfile_simple
t0mdavid-m Feb 15, 2025
98f0d9f
drop spectra without peaks in data viewer
axelwalter Feb 19, 2025
14308e7
Add workspace management features and enable workspace setting
definitelynotchirag Feb 28, 2025
a1df75c
Refactor workspace checks to simplify conditionals and improve readab…
definitelynotchirag Feb 28, 2025
c17cc66
Merge pull request #94 from jcharkow/add_tests
jcharkow Mar 3, 2025
452c572
Merge pull request #131 from t0mdavid-m/update_citations
jcharkow Mar 3, 2025
362adef
Merge branch 'main' into main
definitelynotchirag Mar 3, 2025
33aa04c
Added installer as a release asset #139
Mar 4, 2025
dc3d146
docker files updated
Mar 4, 2025
3535efd
Adding open ms installation via conda
subCode321 Mar 4, 2025
7e5fbb2
Rename workspace setting key to "enable_workspaces"
definitelynotchirag Mar 4, 2025
7afb63a
Merge branch 'main' of https://github.com/definitelynotchirag/streaml…
definitelynotchirag Mar 4, 2025
431c6e9
fix pyopenms_viz version
jcharkow Mar 4, 2025
f49eaf1
Merge branch 'main' of github.com:OpenMS/streamlit-template
jcharkow Mar 4, 2025
d8e94cd
Update pyopenms_viz to 1.0.0 and fix breaking changes
achalbajpai Mar 4, 2025
19f131c
remove python setup and replace with conda
subCode321 Mar 4, 2025
fa5b563
activate conda env
subCode321 Mar 4, 2025
db30548
fix installation
subCode321 Mar 4, 2025
ca182a0
fix pyopenms version attempt to get tests to pass
jcharkow Mar 4, 2025
1a630bf
Merge pull request #145 from subCode321/install-openms
jcharkow Mar 4, 2025
64acec6
Merge upstream/main and resolve conflicts, keeping pyopenms_viz==1.0.0
achalbajpai Mar 4, 2025
7771337
add installer to release docker files updated
Mar 4, 2025
76b5d2d
add installer to release docker files updation
Mar 4, 2025
f64a8bb
Merge pull request #148 from achalbajpai/main
jcharkow Mar 4, 2025
9f370f6
Update app name and version display from settings
asterisk-ragavan Mar 5, 2025
c3b82b0
Merge pull request #136 from definitelynotchirag/main
t0mdavid-m Mar 5, 2025
9d816ec
Merge pull request #135 from OpenMS/axelwalter-patch-1
t0mdavid-m Mar 5, 2025
c00fa41
Updated the f string with str() function to display the app name
asterisk-ragavan Mar 5, 2025
49fa2d0
Center text in the UI to display version .
asterisk-ragavan Mar 5, 2025
5c17a4b
Configure_maximum_file_upload_size
ChandraDevs1 Mar 5, 2025
9495ee2
Add configurable file upload size via settings.json and CLI
ChandraDevs1 Mar 5, 2025
e91f7c7
Validate upload size is positive
ChandraDevs1 Mar 5, 2025
f6c383b
added maxUploadSize-value
ChandraDevs1 Mar 6, 2025
01854e0
Add script to run Streamlit app with logging and error handling
ChandraDevs1 Mar 6, 2025
6161dbc
implementated all the comments
ChandraDevs1 Mar 6, 2025
c5c184d
fix the merge issue
ChandraDevs1 Mar 6, 2025
e80292d
Update config.toml
ChandraDevs1 Mar 6, 2025
6b12493
updated the version display style as mentioned.
asterisk-ragavan Mar 6, 2025
21c82ff
remove V from version box
t0mdavid-m Mar 6, 2025
d65c9c9
Merge pull request #150 from asterisk-ragavan/main
t0mdavid-m Mar 6, 2025
7933bc9
maxUploadSize updated
ChandraDevs1 Mar 6, 2025
397e361
Add workspaces directory configuration to settings and update workspa…
definitelynotchirag Mar 6, 2025
f3cd0d8
updated files for adding installer to release
Mar 6, 2025
a6d8ba7
version updated
Mar 6, 2025
3659310
Merge branch 'main' into add-installer-to-release
Srajald Mar 6, 2025
768d258
Update settings.json
Srajald Mar 6, 2025
e8c14e7
Updated the release
Srajald Mar 6, 2025
f459e66
updated doc for local mode
ChandraDevs1 Mar 7, 2025
e7ff3db
apply temp fix for windows ci
t0mdavid-m Mar 7, 2025
2b2661f
checkout file instead of cherry picking
t0mdavid-m Mar 7, 2025
c13685d
fix typo
t0mdavid-m Mar 7, 2025
75f027a
add origin
t0mdavid-m Mar 7, 2025
a181b73
Merge remote-tracking branch 'origin/main' into fix_windows_builds
t0mdavid-m Mar 7, 2025
1c67d5f
also overwrite cipackage
t0mdavid-m Mar 7, 2025
85fc9c3
Merge pull request #161 from t0mdavid-m/fix_windows_builds
t0mdavid-m Mar 7, 2025
c03f4e6
Merge remote-tracking branch 'origin/main' into pr-149
t0mdavid-m Mar 7, 2025
7189314
Update user guide and settings to specify workspace directory in loca…
definitelynotchirag Mar 7, 2025
75fa783
Merge pull request #149 from Srajald/add-installer-to-release
t0mdavid-m Mar 7, 2025
f94ecff
additional teste
Mar 7, 2025
d8bc532
updated timeout
subCode321 Mar 8, 2025
e3857b8
Revert "updated timeout"
subCode321 Mar 8, 2025
15e5a13
updated timeout
subCode321 Mar 8, 2025
7183499
Merge pull request #164 from subCode321/update-timeout
t0mdavid-m Mar 8, 2025
2b6cb9a
test cases added
Mar 10, 2025
7fa851f
test cases improved
Mar 10, 2025
df9aab5
test cases edited
Mar 10, 2025
160ad96
invalid test case added
Mar 10, 2025
a2070ea
more functionality added
Mar 10, 2025
b4209d7
more tests added
Mar 10, 2025
63ad905
Delete testfile.mzML
Srajald Mar 10, 2025
5af2fd7
remove logging
ChandraDevs1 Mar 11, 2025
ed8abcd
Merge branch 'main' into feat/workspace_dir
t0mdavid-m Mar 12, 2025
e3f2fd1
add hint for parent directory
t0mdavid-m Mar 12, 2025
84c6e29
fix linting
t0mdavid-m Mar 12, 2025
c78b10e
Merge pull request #159 from definitelynotchirag/feat/workspace_dir
t0mdavid-m Mar 12, 2025
c3a0b2b
Add CPU visualizer
subCode321 Mar 12, 2025
09ce809
Add cpu vizualizer section
subCode321 Mar 12, 2025
58de157
fix typo
t0mdavid-m Mar 12, 2025
66f1943
move resource utilization section below settings
subCode321 Mar 12, 2025
5c9c8fa
Merge branch 'cpu-visualiser' of github.com-subcode:subCode321/stream…
subCode321 Mar 12, 2025
125871d
test cases added
Mar 12, 2025
1f76990
Merge branch 'additional-tests' of https://github.com/Srajald/streaml…
Mar 12, 2025
94bc3a7
updated
Mar 12, 2025
a509a08
Merge branch 'main' into additional-tests
Srajald Mar 12, 2025
edb7fcc
workspace directory rectified
Mar 12, 2025
a6c7e29
added warning
subCode321 Mar 13, 2025
4e67b8c
fixed minor typo
subCode321 Mar 13, 2025
2b0ef60
Merge pull request #179 from subCode321/fix-button
t0mdavid-m Mar 13, 2025
887157c
Merge pull request #175 from subCode321/cpu-visualiser
t0mdavid-m Mar 13, 2025
cc582b4
Update run_app.py
ChandraDevs1 Mar 13, 2025
1d07663
Merge branch 'main' into Configure-size-upload-limit
ChandraDevs1 Mar 13, 2025
8b4f8b0
Update run_app.py
ChandraDevs1 Mar 13, 2025
d3a80d6
Updated logo reference to use new SVG logo
achalbajpai Mar 13, 2025
8c743c8
Added new OpenMS logo
achalbajpai Mar 13, 2025
3e21099
Updated logo reference in quickstart.py
achalbajpai Mar 13, 2025
1619a14
Merge pull request #170 from achalbajpai/update-openms-logo
jcharkow Mar 13, 2025
aa98c1c
docs: update Windows executable documentation with MajorUpgrade element
achalbajpai Mar 13, 2025
9dc5e33
test cases updated
Mar 14, 2025
2a1a7e5
Merge branch 'main' into additional-tests
Srajald Mar 14, 2025
3e0c71f
feat: automatically load example data in pyOpenMS workflow
achalbajpai Mar 15, 2025
3206617
fix: increase timeout for test launch function test to 30 seconds
achalbajpai Mar 15, 2025
5c8bd14
invalid cases removed
Mar 16, 2025
15a680b
added some code refining
Mar 16, 2025
5fb4b22
Update win_exe_with_embed_py.md
Arslan-Siraj Mar 17, 2025
2d8323c
added doc for packaging with WiX:: Merge pull request #153 from achal…
Arslan-Siraj Mar 17, 2025
30feb90
Clear captcha textbox if user enters wrong captcha
jisnoo123 Mar 17, 2025
c04a45a
Merge pull request #1 from jisnoo123/jisnoo123-patch-1
jisnoo123 Mar 17, 2025
cf5cd82
Add Linux pip install guide
jisnoo123 Mar 17, 2025
d722bb8
easy to read doc
jisnoo123 Mar 17, 2025
cbe9ed9
test: Increase timeout for raw_data_viewer tests and improve formatting
Mar 18, 2025
edbdb16
Delete content/simple_workflow.py
Srajald Mar 18, 2025
b12a3b2
replaced the changes
Mar 18, 2025
9a2d063
Merge branch 'additional-tests' of https://github.com/Srajald/streaml…
Mar 18, 2025
7a9daa7
Placed guidelines for new python env above the existing one
jisnoo123 Mar 18, 2025
1e788c5
Place guide for new Python env above existing
jisnoo123 Mar 18, 2025
a2441d2
add new python env guide above the existing one
jisnoo123 Mar 18, 2025
51a01fd
Merge pull request #186 from achalbajpai/test-timeout-fix
jcharkow Mar 18, 2025
81d599e
Merge pull request #167 from Srajald/additional-tests
jcharkow Mar 18, 2025
0c5fdbb
Merge pull request #156 from ChandraDevs1/Configure-size-upload-limit
jcharkow Mar 19, 2025
78c4178
update : remove example data tab and associated code
achalbajpai Mar 19, 2025
d5756dc
Merge pull request #189 from jisnoo123/main
t0mdavid-m Mar 19, 2025
92a6979
Merge pull request #185 from achalbajpai/upstream-fresh-branch
t0mdavid-m Mar 19, 2025
6a7766a
fix: Prevent Streamlit email prompt on first run by providing credent…
achalbajpai Mar 21, 2025
f5be3ef
Feature: dependabot (#214)
jcharkow Mar 29, 2025
692c6db
Update new logo build icon and page svg (#206)
ketan1406 Mar 29, 2025
b2786f9
fix : OpenMS Executable Release Artifact Upload Issue (#208)
achalbajpai Mar 29, 2025
3352c27
Fixed return type of get_parameters_from_json (#221)
ZenMachina16 Apr 9, 2025
c1c8b9e
Fix/dependabot (#220)
jcharkow Apr 17, 2025
175e027
deps: bump captcha from 0.5.0 to 0.7.1 (#219)
dependabot[bot] Apr 17, 2025
65c152b
deps: bump pyopenms from 3.2.0 to 3.3.0 (#215)
dependabot[bot] Apr 17, 2025
f8a9cb4
Add comprehensive tests for TOPP workflow parameter page (#209)
blenbot Apr 17, 2025
5f126f7
Update Licence (#249)
t0mdavid-m May 29, 2025
0fa6250
Fix Failing Tests (#250)
t0mdavid-m May 29, 2025
57fccde
Update Dockerfile for pyopenms-viz (#251)
Arslan-Siraj May 31, 2025
2993a48
Update README.md
Arslan-Siraj Jul 31, 2025
ff0f4ea
Update README.md
Arslan-Siraj Jul 31, 2025
27bdb85
add docs, to run the app
Arslan-Siraj Jul 31, 2025
7d12753
Update README.md
Arslan-Siraj Jul 31, 2025
3ec2995
Update README.md
Arslan-Siraj Jul 31, 2025
49c8785
Update README.md
Arslan-Siraj Jul 31, 2025
98c2920
Update README.md
Arslan-Siraj Jul 31, 2025
6d91278
Update README.md for docker
Arslan-Siraj Jul 31, 2025
c5b0758
Update README.md
Arslan-Siraj Jul 31, 2025
56e2232
add info about both dockerfiles
t0mdavid-m Jul 31, 2025
e326c4b
update docs in template
t0mdavid-m Jul 31, 2025
a0f46b8
Pin autowrap version <0.23.0
poshul Aug 1, 2025
c716217
Merge pull request #267 from Arslan-Siraj/main
Arslan-Siraj Aug 1, 2025
470a747
Update docker-compose.yml to remove deprecated version (#270)
poshul Aug 1, 2025
3c76e97
update to OpenMS 3.4 (#268)
t0mdavid-m Aug 1, 2025
3bc48a5
Hackathon (#269)
timosachsenberg Aug 5, 2025
7bd64e4
Update README.md
t0mdavid-m Aug 11, 2025
8ff1d3f
copy utils to production environments
t0mdavid-m Aug 21, 2025
951c90c
increment version number
t0mdavid-m Aug 21, 2025
05ffefa
Upgrade Streamlit to 1.49 (#278)
t0mdavid-m Sep 2, 2025
3b8c415
Merge remote-tracking branch 'template/main' into merge_template
t0mdavid-m Sep 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/dependabot.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ workspaces-flashtaggerviewer
**/__pycache__
.DS_Store
*-embed-amd64
get-pip.py
run_app.bat
python*
gdpr_consent/node_modules/
*~


2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This software is released under a three-clause BSD license:
* Neither the name of any author or any participating institution
may be used to endorse or promote products derived from this software
without specific prior written permission.
For a full list of authors, refer to the file AUTHORS.
For a full list of authors, refer to the git contributions.
--------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
}

pg = st.navigation(pages, expanded=True)
pg.run()
pg.run()
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
openms-streamlit-template:
build:
Expand Down
148 changes: 138 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,140 @@
# the requirements.txt file is intended for deployment on streamlit cloud and if the simple container is built
# note that it is much more restricted in terms of installing third-parties / etc.
# preferably use the batteries included or simple docker file for local hosting
streamlit==1.43.0
numpy==1.26.4 # pandas and numpy are dependencies of pyopenms, however, pyopenms needs numpy<=1.26.4
plotly==5.22.0
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
altair==5.5.0
# via streamlit
attrs==25.3.0
# via
# jsonschema
# referencing
blinker==1.9.0
# via streamlit
cachetools==5.5.2
# via streamlit
captcha==0.7.1
pyopenms>=3.2.0
pyarrow<16
streamlit-js-eval
# via src (pyproject.toml)
certifi==2025.1.31
# via requests
charset-normalizer==3.4.1
# via requests
click==8.1.8
# via streamlit
contourpy==1.3.1
# via matplotlib
cycler==0.12.1
# via matplotlib
fonttools==4.56.0
# via matplotlib
gitdb==4.0.12
# via gitpython
gitpython==3.1.44
# via streamlit
idna==3.10
# via requests
jinja2==3.1.6
# via
# altair
# pydeck
jsonschema==4.23.0
# via altair
jsonschema-specifications==2024.10.1
# via jsonschema
kiwisolver==1.4.8
# via matplotlib
markupsafe==3.0.2
# via jinja2
matplotlib==3.10.1
# via pyopenms
narwhals==1.32.0
# via altair
numpy==1.26.4
# via
# contourpy
# matplotlib
# pandas
# pydeck
# pyopenms
# src (pyproject.toml)
# streamlit
packaging==24.2
# via
# altair
# matplotlib
# plotly
# streamlit
pandas==2.2.3
# via
# pyopenms
# pyopenms-viz
# streamlit
pillow==11.1.0
# via
# captcha
# matplotlib
# streamlit
plotly==5.22.0
# via src (pyproject.toml)
protobuf==5.29.4
# via streamlit
Comment on lines +80 to +81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security: bump protobuf to a patched version.
protobuf==5.29.4 is vulnerable to DoS; patched versions are 4.25.8, 5.29.5, or 6.31.1. Recommend 5.29.5 to stay on the same major/minor.

Apply:

-protobuf==5.29.4
+protobuf==5.29.5

Refs: GitHub Advisory GHSA-8qvm-5x2c-j2w7 (fixed in 5.29.5). (github.com, advisories.gitlab.com)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
protobuf==5.29.4
# via streamlit
protobuf==5.29.5
# via streamlit
🧰 Tools
🪛 OSV Scanner (2.1.0)

[HIGH] 80-80: protobuf 5.29.4: protobuf-python has a potential Denial of Service issue

(GHSA-8qvm-5x2c-j2w7)

🤖 Prompt for AI Agents
In requirements.txt around lines 80-81, protobuf==5.29.4 is vulnerable and
should be bumped to the patched release; update the pin to protobuf==5.29.5,
then regenerate any dependency lockfiles or virtualenvs (e.g., pip-compile or
poetry lock) and run the test suite / CI to ensure nothing breaks from the
patch.

psutil==7.0.0
# via src (pyproject.toml)
pyarrow==19.0.1
# via streamlit
pydeck==0.9.1
# via streamlit
pyopenms==3.3.0
# via src (pyproject.toml)
pyopenms-viz==1.0.0
# via src (pyproject.toml)
pyparsing==3.2.3
# via matplotlib
python-dateutil==2.9.0.post0
# via
# matplotlib
# pandas
pytz==2025.2
# via pandas
referencing==0.36.2
# via
# jsonschema
# jsonschema-specifications
requests==2.32.3
# via streamlit
rpds-py==0.24.0
# via
# jsonschema
# referencing
six==1.17.0
# via python-dateutil
smmap==5.0.2
# via gitdb
streamlit==1.49.0
# via
# src (pyproject.toml)
# streamlit-js-eval
streamlit-js-eval==0.1.7
# via src (pyproject.toml)
tenacity==9.0.0
# via
# plotly
# streamlit
toml==0.10.2
# via streamlit
tornado==6.4.2
# via streamlit
Comment on lines +126 to +127
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security: upgrade Tornado to 6.5.0+.
tornado==6.4.2 is affected by excessive-logging DoS; patched in 6.5.0.

Apply:

-tornado==6.4.2
+tornado==6.5.0

Refs: GHSA-7cx3-6m66-7c5m (patched in 6.5.0). (github.com)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tornado==6.4.2
# via streamlit
tornado==6.5.0
# via streamlit
🧰 Tools
🪛 OSV Scanner (2.1.0)

[HIGH] 126-126: tornado 6.4.2: Tornado vulnerable to excessive logging caused by malformed multipart form data

(GHSA-7cx3-6m66-7c5m)

🤖 Prompt for AI Agents
In requirements.txt around lines 126-127, tornado is pinned to 6.4.2 which is
vulnerable; update the tornado requirement to at least 6.5.0 (e.g., change the
pin to tornado==6.5.0 or use a safe range like tornado>=6.5.0,<7.0) to include
the patch for GHSA-7cx3-6m66-7c5m, then regenerate any lock/compiled
requirements (pip-tools/poetry lock) and run the test suite and CI to ensure
Streamlit and other deps remain compatible; if any conflicts arise, adjust the
constraint to the minimal compatible upper bound and document the change in the
dependency/changelog.

typing-extensions==4.13.0
# via
# altair
# referencing
# streamlit
tzdata==2025.2
# via pandas
urllib3==2.3.0
# via requests
watchdog==6.0.0
# via streamlit
xlsxwriter
scipy>=1.15
psutil
29 changes: 19 additions & 10 deletions src/common/captcha_.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
from pathlib import Path
import streamlit as st
import streamlit.components.v1 as st_components
from streamlit.source_util import page_icon_and_name, calc_md5, get_pages, _on_pages_changed

from streamlit.source_util import page_icon_and_name
from captcha.image import ImageCaptcha
from pathlib import Path

import hashlib
import random
import string
import os

def calc_md5(string : str):
return hashlib.md5(string.encode()).hexdigest()

def get_pages():
return st.runtime.get_pages()

def set_pages(pages : dict):
st.runtime.set_pages(pages)

def delete_all_pages(main_script_path_str: str) -> None:
"""
Expand All @@ -22,7 +31,7 @@ def delete_all_pages(main_script_path_str: str) -> None:

"""
# Get all pages from the app's configuration
current_pages = get_pages(main_script_path_str)
current_pages = get_pages()

# Create a list to store keys pages to delete
keys_to_delete = []
Expand All @@ -37,7 +46,7 @@ def delete_all_pages(main_script_path_str: str) -> None:
del current_pages[key]

# Refresh the pages configuration
_on_pages_changed.send()
set_pages(current_pages)


def delete_page(main_script_path_str: str, page_name: str) -> None:
Expand All @@ -52,15 +61,15 @@ def delete_page(main_script_path_str: str, page_name: str) -> None:
None
"""
# Get all pages
current_pages = get_pages(main_script_path_str)
current_pages = get_pages()

# Iterate over all pages and delete the desired page if found
for key, value in current_pages.items():
if value["page_name"] == page_name:
del current_pages[key]

# Refresh the pages configuration
Comment on lines 67 to 71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Bug: deleting from dict while iterating raises RuntimeError.
del current_pages[key] during iteration can fail. Collect keys first, then delete.

-    for key, value in current_pages.items():
-        if value["page_name"] == page_name:
-            del current_pages[key]
+    keys_to_delete = [k for k, v in list(current_pages.items()) if v.get("page_name") == page_name]
+    for k in keys_to_delete:
+        current_pages.pop(k, None)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for key, value in current_pages.items():
if value["page_name"] == page_name:
del current_pages[key]
# Refresh the pages configuration
keys_to_delete = [k for k, v in list(current_pages.items()) if v.get("page_name") == page_name]
for k in keys_to_delete:
current_pages.pop(k, None)
# Refresh the pages configuration
🤖 Prompt for AI Agents
In src/common/captcha_.py around lines 67 to 71, the code deletes entries from
current_pages while iterating over it which can raise a RuntimeError; collect
the keys to remove first (e.g., build a list of keys where value["page_name"] ==
page_name) and then iterate over that list to delete them from current_pages, or
replace current_pages with a filtered dict comprehension that excludes matching
entries, ensuring you do not mutate the dict while iterating.

_on_pages_changed.send()
set_pages(current_pages)


def restore_all_pages(main_script_path_str: str) -> None:
Expand All @@ -74,7 +83,7 @@ def restore_all_pages(main_script_path_str: str) -> None:
None
"""
# Get all pages
pages = get_pages(main_script_path_str)
pages = get_pages()

# Obtain the path to the main script
main_script_path = Path(main_script_path_str)
Expand Down Expand Up @@ -126,7 +135,7 @@ def restore_all_pages(main_script_path_str: str) -> None:
}

# Refresh the page configuration
_on_pages_changed.send()
set_pages(pages)


def add_page(main_script_path_str: str, page_name: str) -> None:
Expand All @@ -141,7 +150,7 @@ def add_page(main_script_path_str: str, page_name: str) -> None:
None
"""
# Get all pages
pages = get_pages(main_script_path_str)
pages = get_pages()

# Obtain the path to the main script
main_script_path = Path(main_script_path_str)
Expand All @@ -168,7 +177,7 @@ def add_page(main_script_path_str: str, page_name: str) -> None:
}

# Refresh the page configuration
_on_pages_changed.send()
set_pages(pages)


length_captcha = 5
Expand Down
46 changes: 21 additions & 25 deletions src/common/common.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import json
import os
import shutil
import sys
import uuid
import json
import time
import psutil
import shutil

import pandas as pd
import streamlit as st

from typing import Any
from pathlib import Path
from streamlit.components.v1 import html

import streamlit as st
import pandas as pd
import psutil

try:
from tkinter import Tk, filedialog

Expand Down Expand Up @@ -340,30 +341,25 @@ def render_sidebar(page: str = "") -> None:
# The main page has workspace switcher
# Display workspace switcher if workspace is enabled in local mode
if st.session_state.settings["enable_workspaces"]:
with st.expander("🖥️ **Workspaces**"):
# Workspaces directory specified in the settings.json
if (
st.session_state.settings["workspaces_dir"]
and st.session_state.location == "local"
):
workspaces_dir = Path(
st.session_state.settings["workspaces_dir"],
"workspaces-" + st.session_state.settings["repository-name"],
)
else:
workspaces_dir = ".."
# Online: show current workspace name in info text and option to change to other existing workspace
if st.session_state.location == "local":
# Workspaces directory specified in the settings.json
if (
st.session_state.settings["workspaces_dir"]
and st.session_state.location == "local"
):
workspaces_dir = Path(
st.session_state.settings["workspaces_dir"],
"workspaces-" + st.session_state.settings["repository-name"],
)
else:
workspaces_dir = ".."
# Online: show current workspace name in info text and option to change to other existing workspace
Comment on lines +344 to +355
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Bug: workspaces_dir may be a str, causing AttributeError on iterdir().

When settings["workspaces_dir"] is falsy, workspaces_dir is ".." (str). You then call workspaces_dir.iterdir(), which will crash.

Apply this diff:

-            else:
-                workspaces_dir = ".."
+            else:
+                workspaces_dir = Path("..")
+            # Normalize and ensure it exists (local-only UI)
+            workspaces_dir = workspaces_dir.resolve()
+            workspaces_dir.mkdir(parents=True, exist_ok=True)

Optional: add a guard before using options to handle an empty directory.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Workspaces directory specified in the settings.json
if (
st.session_state.settings["workspaces_dir"]
and st.session_state.location == "local"
):
workspaces_dir = Path(
st.session_state.settings["workspaces_dir"],
"workspaces-" + st.session_state.settings["repository-name"],
)
else:
workspaces_dir = ".."
# Online: show current workspace name in info text and option to change to other existing workspace
# Workspaces directory specified in the settings.json
if (
st.session_state.settings["workspaces_dir"]
and st.session_state.location == "local"
):
workspaces_dir = Path(
st.session_state.settings["workspaces_dir"],
"workspaces-" + st.session_state.settings["repository-name"],
)
else:
workspaces_dir = Path("..")
# Normalize and ensure it exists (local-only UI)
workspaces_dir = workspaces_dir.resolve()
workspaces_dir.mkdir(parents=True, exist_ok=True)
# Online: show current workspace name in info text and option to change to other existing workspace
🤖 Prompt for AI Agents
In src/common/common.py around lines 344 to 355, workspaces_dir is sometimes set
to the string ".." which will raise AttributeError when you later call
workspaces_dir.iterdir(); change the fallback to wrap it in Path(...) so
workspaces_dir is always a pathlib.Path (e.g., Path("..")), and before iterating
or listing options check workspaces_dir.exists() and workspaces_dir.is_dir() and
handle the empty/non-existent directory case (skip iteration and/or provide an
empty options list) to avoid exceptions.

if st.session_state.location == "local":
with st.expander("🖥️ **Workspaces**"):
# Define callback function to change workspace
def change_workspace():
for key in params.keys():
if key in ['controllo']:
continue
if key in st.session_state.keys():
del st.session_state[key]
st.session_state.workspace = Path(
workspaces_dir, st.session_state["chosen-workspace"]
)
st.query_params.workspace = st.session_state["chosen-workspace"]

# Get all available workspaces as options
Expand Down
Loading
Loading