MAINT: drop pip installs that no lecture uses#803
Open
mmcky wants to merge 2 commits into
Open
Conversation
`lectures/networks.md` imports `quantecon` but its pip cell never installs it. The lecture builds today only because `markov_chains_I`, `markov_chains_II` and `eigen_II` appear earlier in the TOC and install `quantecon` into the same runner environment, so a full cold build satisfies the dependency by accident. That breaks as soon as the lecture executes on its own — the normal case with a warm `jupyter-cache`, where only the edited notebook is re-run. Observed in the Chinese edition, which carries the same gap as a faithful translation. Adds `quantecon` to the lecture's own pip cell and splits the cell to one package per line, matching `input_output.md` and the style guide. Closes #801 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Three installed packages are never imported or used: - `input_output.md` installs `quantecon` and `pandas-datareader`; the lecture only ever uses `quantecon_book_networks`, and has no `qe.` call anywhere. - `networks.md` installs `pandas-datareader` but never touches it. `pandas_datareader` is imported by exactly one lecture, `business_cycle.md`, which installs it itself. `quantecon` is imported by `eigen_II`, `markov_chains_I`, `markov_chains_II` and `networks`, each of which now installs it itself. Neither is a declared dependency of `quantecon-book-networks==1.6`, so nothing pulls them in transitively. `xlrd` in `inflation_history.md` is deliberately left alone: it is never imported but is required by `pd.read_excel` to read the lecture's `.xls` dataset. Builds on #802 — that PR makes `networks.md` install its own `quantecon`, without which removing `input_output.md`'s copy would reopen the same hole from the other end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR removes lecture-local !pip install lines for packages that are not imported or referenced by the affected lectures, reducing unnecessary downloads during builds while keeping each lecture’s install cell aligned with its actual runtime needs.
Changes:
- Remove
pandas-datareaderinstall fromlectures/networks.md(no usage in the lecture). - Remove
quanteconandpandas-datareaderinstalls fromlectures/input_output.md(no usage in the lecture).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lectures/networks.md | Drops an unused pandas-datareader install from the lecture’s setup cell. |
| lectures/input_output.md | Drops unused quantecon and pandas-datareader installs, leaving only the required quantecon_book_networks install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Follow-up to #802. Stacked on that branch, so this diff shows only the cleanup; GitHub will retarget it to
mainonce #802 merges.The audit behind #802 asked whether any lecture imports a non-Anaconda package it does not install. Exactly one did (
networks.md, fixed there). But the same audit run in reverse turns up the mirror-image case — packages installed that nothing uses.input_output.mdquanteconquantecon_book_networks; there is noqe.call anywhere in the fileinput_output.mdpandas-datareadernetworks.mdpandas-datareaderpandas_datareaderis imported by exactly one lecture in the repo —business_cycle.md— which installs it itself, at TOC position 12, well before either lecture touched here.quanteconis imported byeigen_II,markov_chains_I,markov_chains_IIandnetworks, each of which installs it itself once #802 lands. And neither package is a declared dependency ofquantecon-book-networks==1.6, whoserequires_distisnumpy, scipy, pandas, matplotlib, networkx, wbgapi— so nothing acquires them transitively either.xlrdininflation_history.mdlooks like a fourth case and is deliberately left in place: it is never imported, butpd.read_excelneeds it as the engine for that lecture's.xlsdataset. The other three lectures reading spreadsheets (french_rev,long_run_growth,prob_dist) read.xlsx, which usesopenpyxlfrom the Anaconda distribution.Merge order
This must land after #802.
input_output.mdsits at TOC position 77, immediately beforenetworksat 79 — so untilnetworks.mdinstalls its ownquantecon, removinginput_output.md's copy would reopen the same hole #802 closes, just from the other end.Effect
No behaviour change — three fewer package downloads per build, and each lecture's pip cell now states what that lecture actually needs. After both PRs, every lecture that imports a non-Anaconda package installs it, and no lecture installs one it does not use.
🤖 Generated with Claude Code