Skip to content

hansen_singleton_1983: build-time pd.read_csv of a vendored CSV over a raw-GitHub URL flakes on HTTP 429 #102

Description

@mmcky

Surfaced during a QuantEcon/actions container-validation run (test-containers-lectures.yml building this repo).

What happened

lectures/hansen_singleton_1983.md failed to execute:

nbclient.exceptions.CellExecutionError: ...
HTTPError: HTTP Error 429: Too Many Requests

The failing (hidden) cell fetches the dataset over the network:

DATA_URL = (
    "https://github.com/QuantEcon/lecture-python.myst/raw/refs/heads/main/"
    "lectures/_static/lecture_specific/hansen_singleton_1983/"
    "hansen_singleton_1983_data.csv"
)
_data = pd.read_csv(DATA_URL, index_col=0, parse_dates=True)

Root cause

That CSV is already vendored in this repo at lectures/_static/lecture_specific/hansen_singleton_1983/hansen_singleton_1983_data.csv, yet the notebook reads it back over HTTP from github.com/.../raw/.... Under CI load (the container-test matrix builds several repos from GitHub's shared runner IP ranges) raw-GitHub rate-limits the request with HTTP 429 and the build fails. It's non-deterministic — the same notebook passed on the other container in the same run (network luck).

Suggested fix

Read the local checked-out copy instead of the remote URL — the file is already on disk during the build, which removes the network dependency and the flake entirely:

_data = pd.read_csv(
    "_static/lecture_specific/hansen_singleton_1983/hansen_singleton_1983_data.csv",
    index_col=0, parse_dates=True,
)

(Confirm the relative path against the notebook's execution CWD / whatever local-data convention the repo already uses.)

Note

lectures/hansen_singleton_1982.md has a parallel _static/lecture_specific/hansen_singleton_1982/ dataset and very likely uses the same raw-GitHub fetch — worth fixing both together.

Context: observed during the Anaconda 2026.06 container migration in QuantEcon/actions; this is not a migration/pandas-3.0 issue — purely the remote fetch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions