security(deps): drop jupyter from three python packages — 166 alerts, 540 to 374 - #2019
Merged
Conversation
Removes 166 Dependabot alerts, measured rather than estimated: 540 -> 374.
jupyter/jupyterlab was declared in [tool.poetry.dependencies] -- a runtime dependency
-- in pythonData, python-restclient and pythonCopasiOpt/vcell-opt. It pulled the whole
notebook stack into all three lock files, and those packages carry many CVEs each
(mistune 41 alerts, tornado 39, jupyterlab 19, jupyter-server 16, nbconvert 9).
Nothing imports it. There is no 'import jupyter', 'from jupyter', 'import IPython' or
'import notebook' in any .py in the repo. What exists is three example notebooks, one
per package, which is presumably why it was added -- but anyone opening a .ipynb
already has their own Jupyter, and an example needing a kernel does not make the
kernel a runtime dependency of the library.
Removed rather than moved to a dev group. A dev group would have been the wrong fix
for the stated goal: poetry locks all groups, and Dependabot alerts on locked dev
dependencies too (pytest already appears twice in the current 540 with
scope=development). Moving it would have relabelled ~164 alerts runtime ->
development without removing one. Only deletion drops them from the lock.
Measured per file, comparing against master:
pythonData 122 -> 34 locked packages, 87 -> 21 alerts
python-restclient 129 -> 43 locked packages, 73 -> 20 alerts
vcell-opt 117 -> 34 locked packages, 68 -> 21 alerts
Verified:
- no source in any of the three imports any of the 257 dropped packages
- poetry install + pytest green in all three: 168, 8 and 4 tests
- re-locked with plain 'poetry lock', which in Poetry 2.x does not update packages
already present, so nothing else moved version
python-restclient/pyproject.toml is safe to hand-edit despite being a generated
project: pyproject.toml is listed in its .openapi-generator-ignore, so the generator
does not overwrite it. That was the open question in #2016 and it is now answered.
Note vcell-opt needs 'poetry env use 3.10' as docs/BUILDING.md says; its lock pins
matplotlib 3.6.2, which has no wheels for 3.12 and fails to build there. That is
pre-existing and identical on master.
Refs #2016
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018kr8SbzXtwW3gMVUgMfDDt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes 166 Dependabot alerts — measured against
master, not estimated. 540 → 374.From #2016.
jupyter/jupyterlabwas declared in[tool.poetry.dependencies]— a runtimedependency — in three packages, pulling the entire notebook stack into all three lock files:
Nothing imports it. No
import jupyter,from jupyter,import IPython, orimport notebookin any
.pyin the repo. What exists is three example notebooks, one per package — presumably thereason it was added. But anyone opening a
.ipynbalready has their own Jupyter, and an exampleneeding a kernel does not make the kernel a runtime dependency of the library.
Why removed, not moved to a dev group
A dev group was the original plan and it would not have worked. Poetry locks all groups, and
Dependabot alerts on locked dev dependencies too —
pytestalready appears twice in the current540 with
scope=development. Moving Jupyter would have relabelled ~164 alertsruntime→developmentwithout removing a single one.Only deletion drops them from the lock file. (My original estimate in #2016 attached the
"540 → ~370" figure to the dev-group option; that was wrong, and the number turns out to be right
only for removal.)
Measured, per file
pythonDatapython-restclientvcell-opt257 packages leave the three lock files.
Verification
distribution-vs-import name differences (
pillow→PIL,beautifulsoup4→bs4, …). This was thereal risk:
requests,urllib3andcertifiwere reachingpythonDatatransitively throughJupyter.
poetry install+pytestgreen in all three — 168, 8 and 4 tests.poetry lock, which in Poetry 2.x does not update packages alreadypresent, so nothing else changed version.
Two notes for reviewers
python-restclient/pyproject.tomlis safe to hand-edit despite being a generated project —pyproject.tomlis listed in its.openapi-generator-ignore, so the generator does not overwriteit. That was the open question flagged in #2016 and it is now answered; the change will not revert
on the next client regeneration.
vcell-optneedspoetry env use 3.10(asdocs/BUILDING.mdsays). Its lock pinsmatplotlib 3.6.2, which has no wheels for Python 3.12 and fails to build there. This ispre-existing — the pin is byte-identical on
master— but it will bite anyone testing this PR witha default 3.12 interpreter, as it briefly bit me.
Refs #2016
🤖 Generated with Claude Code
https://claude.ai/code/session_018kr8SbzXtwW3gMVUgMfDDt