Add local PyPI warehouse for piplite - #44
Conversation
Build a local pypi/ directory with pre-downloaded wheels and an all.json index so piplite resolves packages locally instead of hitting a 404 on the missing pypi/all.json endpoint. Packages included (for active lectures): openpyxl, requests, xlrd, quantecon_wasm, quantecon-book-networks, pandas-datareader This eliminates the red 404 warnings users see in the browser console when JupyterLite starts, and improves package load times by serving wheels directly from the site. Closes #42
✅ Deploy Preview for beautiful-dodol-cb9543 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
📖 Netlify Preview Ready! Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (dad0ea4) ✨ Browse the preview at the URL above. |
✅ Deploy Preview for beautiful-dodol-cb9543 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
📖 Netlify Preview Ready! Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (3dda1d6) ✨ Browse the preview at the URL above. |
There was a problem hiding this comment.
Pull request overview
This PR adds a local “PyPI warehouse” (pypi/ directory + all.json index) to the built site so JupyterLite/piplite can resolve a known set of lecture-required packages locally, eliminating the noisy pypi/all.json 404 warnings described in issue #42.
Changes:
- Added
build_pypi.pyto download selected wheels and generate a Warehouse-likeall.jsonindex for piplite. - Updated the GitHub Actions workflow to run the warehouse build after
myst build --htmlso the generatedpypi/is included in the uploaded site artifact.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
build_pypi.py |
New script that downloads wheels and generates a piplite-compatible all.json index under lectures/_build/html/pypi/. |
.github/workflows/ci.yml |
Runs build_pypi.py after the MyST HTML build so the site artifact contains /pypi/all.json and wheels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| subprocess.check_call([ | ||
| sys.executable, "-m", "pip", "download", | ||
| "--no-deps", | ||
| "--only-binary=:all:", | ||
| "--dest", str(dest_dir), | ||
| *packages, | ||
| ]) |
| output_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| with tempfile.TemporaryDirectory() as tmpdir: |
| if normalized not in all_json: | ||
| all_json[normalized] = {"releases": {}} | ||
| all_json[normalized]["releases"][meta["version"]] = [release] |
|
|
||
| - name: Build local PyPI warehouse for piplite | ||
| run: python build_pypi.py |
|
📖 Netlify Preview Ready! Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (c4fbd5f) ✨ Browse the preview at the URL above. |
Summary
Build a local
pypi/directory with pre-downloaded wheels and anall.jsonindex so piplite resolves packages locally instead of hitting a 404 on the missingpypi/all.jsonendpoint.What this does
build_pypi.py— Downloads 6 pure-Python wheels (~1.3 MB total) and generates a Warehouse-likeall.jsonindex that piplite understandsmyst build --htmlto place thepypi/directory intolectures/_build/html/pypi/Packages included (for active lectures)
openpyxlxlrdrequestsquantecon_wasmquantecon-book-networkspandas-datareaderWhy
When JupyterLite starts, piplite tries to fetch
<base-url>/pypi/all.jsonbefore falling back to the CDN. Without a local index this produces noisy red 404 errors in the browser console (see issue #42). With a local warehouse:pypi/all.json— 200 OKCloses #42