Skip to content

Two network reads run unshimmed under Pyodide: inequality.md imports pyodide_http but never patches, short_path.md has no shim at all #59

Description

@mmcky

Found while auditing every static data read across the lecture series for QuantEcon/data-lectures#65. Both are live on main today and neither depends on that work — they are ordinary defects in this repo.

Under Pyodide, urllib and requests do not reach the network. pyodide_http.patch_all() is what redirects them through the browser's fetch API, which is why every other data-reading lecture here calls it. These two lectures do not.

1. inequality.md imports the shim and never calls it

Line 96 has import pyodide_http, and patch_all() appears nowhere in the file. The import is doing nothing.

The read that needs it is at line 251, df = pd.read_csv(url), against the SCF extract named at line 250. So the lecture looks shimmed, is not, and the import is exactly the kind of thing a reader would assume is load-bearing.

2. short_path.md has no shim at all

Lines 274-277 do a bare import requests followed by requests.get(file_url) against graph.txt, with no pyodide_http import anywhere in the file.

Fix

Add pyodide_http.patch_all() to inequality.md before the read at line 251, and add both the import and the call to short_path.md before line 277 — matching the pattern already used in long_run_growth.md and french_rev.md.

Worth knowing

inequality.md:250 reads via media.githubusercontent.com from high_dim_data. That is the LFS media endpoint, and the six high_dim_data datasets have since been folded into data-lectures, so this read is also a migration target. It is a separate change from the shim fix and should not be bundled with it — the shim fix is a one-line correction that can land immediately.

If the qeld package proceeds as planned in QuantEcon/data-lectures#65, importing it will install the shim automatically and both call sites lose the boilerplate. That is some way off, and these should be fixed now regardless.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions