Skip to content

MAINT: drop pip installs that no lecture uses#803

Open
mmcky wants to merge 2 commits into
mainfrom
chore/drop-unused-pip-installs
Open

MAINT: drop pip installs that no lecture uses#803
mmcky wants to merge 2 commits into
mainfrom
chore/drop-unused-pip-installs

Conversation

@mmcky

@mmcky mmcky commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #802. Stacked on that branch, so this diff shows only the cleanup; GitHub will retarget it to main once #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.

Lecture Removed Why it is safe
input_output.md quantecon The lecture uses only quantecon_book_networks; there is no qe. call anywhere in the file
input_output.md pandas-datareader Never imported or referenced
networks.md pandas-datareader Never imported or referenced

pandas_datareader is 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. quantecon is imported by eigen_II, markov_chains_I, markov_chains_II and networks, each of which installs it itself once #802 lands. And neither package is a declared dependency of quantecon-book-networks==1.6, whose requires_dist is numpy, scipy, pandas, matplotlib, networkx, wbgapi — so nothing acquires them transitively either.

xlrd in inflation_history.md looks like a fourth case and is deliberately left in place: it is never imported, but pd.read_excel needs it as the engine for that lecture's .xls dataset. The other three lectures reading spreadsheets (french_rev, long_run_growth, prob_dist) read .xlsx, which uses openpyxl from the Anaconda distribution.

Merge order

This must land after #802. input_output.md sits at TOC position 77, immediately before networks at 79 — so until networks.md installs its own quantecon, removing input_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

mmcky and others added 2 commits July 24, 2026 13:34
`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>
Copilot AI review requested due to automatic review settings July 24, 2026 03:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-datareader install from lectures/networks.md (no usage in the lecture).
  • Remove quantecon and pandas-datareader installs from lectures/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.

Base automatically changed from fix/networks-install-quantecon to main July 24, 2026 03:44
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 24, 2026 03:49 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request July 24, 2026 03:49 Inactive
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