Skip to content

build(backend-py): Upgrade to Flask 3 and Werkzeug 3 - #76

Merged
mrduncan merged 2 commits into
mainfrom
mattduncan/ie-93-flask-3
Oct 28, 2026
Merged

mrduncan merged 2 commits into
mainfrom
mattduncan/ie-93-flask-3

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Upgrades the Python backend's web framework stack. No application code changes.

Refs IE-93.

Changes

backend-py/requirements.txt:

Package Before After Why
Flask 2.0.3 3.1.3 framework upgrade
Werkzeug 2.0.3 3.1.9 framework upgrade
Flask-Cors 3.0.10 6.0.5 framework upgrade
click 8.0.4 8.5.0 Flask 3.1 requires >=8.1.3
itsdangerous 2.1.0 2.2.0 Flask 3.1 requires >=2.2.0
MarkupSafe 2.1.0 3.0.4 Flask/Werkzeug require >=2.1.1
blinker — 1.9.0 new Flask 3 dependency
Flask-SQLAlchemy 2.5.1 removed not imported anywhere; 2.5.1 doesn't support Flask 3
black 22.1.0 removed not imported by the app; CI runs black through pre-commit, which installs its own pinned copy. 22.1.0 fails to start with click 8.1+, and every black release before 26.10.1 has a high-severity advisory (GHSA-cg8m-r9f2-5wm2)
mypy-extensions, pathspec, platformdirs pinned removed only required by black

backend-py/Dockerfile: CMD ["flask", "run"] → CMD ["flask", "run", "--reload"].

Flask 2.3 stopped reading FLASK_ENV, so FLASK_ENV=development in .env no longer turns on the reloader (or the Werkzeug debugger). --reload keeps reload-on-change for the bind-mounted src/ directory. Debug mode stays off. The app's own FLASK_ENV checks (e.g. FLASK_ENV == "test") are unaffected.

Audit

pip-audit -r backend-py/requirements.txt:

  • main: 24 advisories in Werkzeug (12), Flask-Cors (5), black (4), Flask (2), pytest (1)
  • this branch: 1 advisory, in pytest

All Flask, Werkzeug and Flask-Cors advisories are resolved, and black is no longer in requirements.txt.

Verification

In a Python 3.13 container:

  • pip check: no broken requirements
  • pytest: 56 passed (same as main)
  • docker compose up backend-py: starts, GET /api/items/ returns 200, reports Debug mode: off, and reloads after editing a file in src/
  • CORS: a request with Origin gets Access-Control-Allow-Origin, and a preflight OPTIONS returns 200 with the allow headers

--

View Junior Session [Sentry]

Upgrade Flask 2.0.3 -> 3.1.3, Werkzeug 2.0.3 -> 3.1.9 and Flask-Cors
3.0.10 -> 6.0.5, along with the pins Flask 3 requires (click,
itsdangerous, MarkupSafe, and the new blinker dependency).

Remove Flask-SQLAlchemy, which is not imported anywhere and whose
pinned 2.5.1 release does not support Flask 3. Bump black to 22.6.0
(the version pre-commit already uses) because black 22.1.0 fails to
start with click 8.1+.

Flask 2.3 stopped reading FLASK_ENV, so the dev server no longer
enables the reloader from .env. Pass --reload in the Dockerfile so
the bind-mounted src/ still reloads on change; debug mode stays off.

Refs IE-93

Co-Authored-By: Matt Duncan <[email protected]>
@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

IE-93

Every black release before 26.10.1 is covered by GHSA-cg8m-r9f2-5wm2
(high), which fails dependency-review when the pin changes. Black is
not imported by the app and CI runs it through pre-commit, which
installs its own pinned copy, so remove it along with the pins only it
needed (mypy-extensions, pathspec, platformdirs).

Refs IE-93
@mrduncan
mrduncan marked this pull request as ready for review October 28, 2026 21:49
@mrduncan
mrduncan merged commit a86a404 into main Oct 28, 2026
14 checks passed
@mrduncan
mrduncan deleted the mattduncan/ie-93-flask-3 branch October 28, 2026 21:49
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.

1 participant