Make the backend image install the locked dependency versions - #78
Conversation
- Regenerate poetry.lock (Poetry 1.8.5) so it is consistent with pyproject.toml and poetry install succeeds with pinned versions - Remove the silent pip fallback and the unpinned pip install line from the Dockerfile; add a poetry check --lock build guard so any future lock drift fails the build loudly - Bump Poetry 1.7.1 -> 1.8.5 (same lock format, adds check --lock) - Drop dependencies unused by the backend (allensdk, openai, fuzzywuzzy, python-Levenshtein); add numpy, which the results endpoint uses to read .npz array shapes Image size drops from 2.34GB to 1.28GB. websockets returns to the locked 13.1, matching the extra_headers API used on main. Fixes #77 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MSe2ht7CC1LRudEQVdxK5R
There was a problem hiding this comment.
Pull request overview
This PR makes the workflow backend Docker image build deterministic by enforcing Poetry lockfile consistency and installing only the locked dependency set (removing the prior unpinned pip install fallbacks that hid lock drift). It also prunes unused heavy dependencies and explicitly adds numpy to the main dependency set.
Changes:
- Regenerates
poetry.lockwith Poetry 1.8.5 to matchpyproject.toml, and updates pinned dependency set (notably ensuringwebsocketsstays locked). - Updates the backend
Dockerfileto fail fast on lock drift (poetry check --lock) and install dependencies exclusively viapoetry install --only main. - Removes unused deps (
openai,allensdk,fuzzywuzzy,python-Levenshtein) and addsnumpyexplicitly; syncs the conveniencerequirements.txt.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| gui/workflow_backend/requirements.txt | Removes unused deps and adds numpy to mirror the intended runtime set for local/conda usage. |
| gui/workflow_backend/pyproject.toml | Updates declared main dependencies (drop unused, add numpy). |
| gui/workflow_backend/poetry.lock | Re-locks dependencies to align with pyproject.toml using Poetry 1.8.5. |
| gui/workflow_backend/Dockerfile | Enforces lock consistency and installs only locked main deps (no unpinned pip fallback). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| httpx = "^0.28.0" | ||
| pyjwt = "^2.10.1" | ||
| cryptography = "^45.0.3" | ||
| openai = "^1.0.0" | ||
| allensdk = ">=2.0.0,<3.0.0" | ||
| requests = "^2.31.0" | ||
| fuzzywuzzy = "^0.18.0" | ||
| python-Levenshtein = { version = ">=0.12.0,<1.0.0", platform = "linux" } | ||
| numpy = "^2.1" | ||
| websockets = "^13.0" |
There was a problem hiding this comment.
That notebook was one-off verification code, never part of the running system (nothing imports it), and it was the only remaining reference to the openai SDK. It has been removed in 8e984d5 together with the rest of the experimental MCP bundle, so openai intentionally stays out of the dependency set. The browser chat calls the OpenAI HTTP API directly via httpx.
| python-dotenv>=1.1.0 | ||
| pyjwt>=2.10.1 | ||
| cryptography>=45.0.3 | ||
| openai>=1.0.0 | ||
| requests>=2.31.0 | ||
| fuzzywuzzy>=0.18.0 | ||
| numpy>=2.1 | ||
| websockets>=13.0 | ||
| httpx>=0.28.0 |
There was a problem hiding this comment.
The notebook in question was experiment-only code and has been removed in 8e984d5, so there is no longer anything under the backend that needs the openai SDK — no optional entry needed here.
…or pip - Remove the one-off MCP verification bundle (llm_auto_mcp.ipynb, server.py, server.log, key.json) from both src/neuroworkflow/utils and the synced codes/ copy. It was experiment-only code, never imported by the system, and its notebook was the last reference to the openai SDK. key.json contained a committed API credential, which must be rotated separately. - Install Poetry with pip --no-cache-dir to keep the image layer lean Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MSe2ht7CC1LRudEQVdxK5R
Summary
Until now, every backend image build silently installed whatever the latest PyPI releases were, instead of the versions pinned in
poetry.lock. That is how websockets 16 slipped in and broke the Run button (the code fix for that is PR #76). This PR makes builds deterministic again and turns any future lock drift into a loud build failure instead of a silent downgrade to unpinned installs.Fixes #77.
Changes
poetry.lock(with Poetry 1.8.5, inside apython:3.11.11-slimcontainer) so it is consistent withpyproject.tomlagain. Existing pins are kept (Django 5.2, websockets 13.1, DRF 3.16); only the missing packages were added.|| pip install ...fallback that swallowed thepoetry installfailure, and the second unpinnedpip installline. AddedRUN poetry check --lockso an out-of-sync lock fails the build immediately with a clear message. Bumped Poetry 1.7.1 → 1.8.5 (same lock format; adds thecheck --lockcommand and matches the version used to generate the lock).allensdk,openai,fuzzywuzzy,python-Levenshtein. The browser chat calls the OpenAI HTTP API viahttpxdirectly, and the Allen Brain parameter-metadata source is a stub that never calls allensdk. Addednumpyexplicitly (the results endpoint uses it to read.npzarray shapes; previously it was only present as a transitive dependency of allensdk). If the Allen Brain source gets a real implementation later, allensdk just needs to be re-added topyproject.tomland re-locked.requirements.txt(unused convenience file for conda setups) synced to match.The image shrinks from 2.34 GB to 1.28 GB.
Note on websockets and PR #76
This restores websockets to the locked 13.1 (it was drifting to 16). Current
mainuses theextra_headersAPI, which is the ≤13 API, so main works with 13.1. PR #76 migrates toadditional_headers, which works on both 13.1 and 16 — so the two PRs can merge in either order without breaking each other.Verification
poetry check --lockinstead of silently falling back to pip.pip listmatches the lock (websockets 13.1, Django 5.2, numpy 2.4.6, requests 2.34.2; allensdk/openai/fuzzywuzzy/Levenshtein absent).websockets.connectstill acceptsextra_headers(the API main uses).docker compose up db backend: migrations + runserver start with no ImportError, system check passes,/api/workflow/answers with 401 (Keycloak auth) as expected.🤖 Generated with Claude Code
https://claude.ai/code/session_01MSe2ht7CC1LRudEQVdxK5R