Skip to content

Upgrade Streamlit to 1.62 - #134

Merged
mounacheikho-cmd merged 2 commits into
mainfrom
streamlit-1.62-upgrade
Sep 3, 2026
Merged

Upgrade Streamlit to 1.62 #134
mounacheikho-cmd merged 2 commits into
mainfrom
streamlit-1.62-upgrade

Conversation

@mounacheikho-cmd

Copy link
Copy Markdown
Collaborator

Summary

This PR upgrades Streamlit from 1.54.0 to 1.62.0 and updates the dependencies required by the new version.

It also updates the Streamlit tests for a path-resolution change in AppTest.from_file() and enables CORS in both Streamlit configurations.

Why this upgrade was needed

We wanted to move to the latest Streamlit release instead of staying on 1.54.0.

Streamlit 1.62 has different Python and server dependency requirements. Keeping the previous versions caused dependency incompatibilities and test failures.

The existing configuration also explicitly disabled CORS. Streamlit warned that this allowed cross-origin WebSocket connections. This PR enables CORS so untrusted origins are rejected.

Dependency changes

Dependency Previous New
streamlit 1.54.0 1.62.0
uvicorn 0.27.1 0.52.4
itsdangerous Not pinned 2.2.0
watchdog Not pinned 6.0.0
Python 3.8+ 3.10+

The existing Starlette version already satisfies Streamlit 1.62, so it did not need another update.

Test failure after the upgrade

After upgrading Streamlit, the Streamlit AppTest tests could no longer find the application file.

The tests previously used:

AppTest.from_file("report_analyst/streamlit_app.py")

Streamlit 1.62 resolves this relative path from the calling test file. That caused it to look for the application under the tests directory instead of the repository root.

Each affected test now builds an absolute path from its own location:

APP_PATH = Path(__file__).resolve().parents[1] / "report_analyst" / "streamlit_app.py"

This path is based on the repository structure. It does not contain a username, machine-specific directory, or CI-specific path.

The affected tests now use:

AppTest.from_file(APP_PATH)

The touched tests also received small lint cleanups.

CORS change

Both Streamlit configuration files previously contained:

enableCORS = false

They now contain:

nableCORS = true

XSRF protection remains enabled:

enableXsrfProtection = true

If a deployment intentionally embeds this Streamlit application from another origin, that origin will need to be explicitly allowed through the deployment configuration.

Validation

  • pip install -r requirements.txt completed successfully.
  • Full test suite: 476 passed, 9 skipped.
  • Ruff passed for all changed Python files.
  • Black passed for all changed Python files.
  • git diff --check passed.
  • Streamlit started successfully with the updated dependencies and configuration.
  • A WebSocket request using an untrusted origin was rejected with HTTP 403.
  • The regular HTTP response did not contain a wildcard Access-Control-Allow-Origin header.

Comment thread .streamlit/config.toml
Comment thread tests/test_streamlit_app_file_selection.py Outdated

@suung suung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

very nice

@mounacheikho-cmd
mounacheikho-cmd merged commit 666eb85 into main Sep 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants