Skip to content

Add local PyPI warehouse for piplite - #44

Open
mmcky wants to merge 3 commits into
mainfrom
local-pypi-warehouse
Open

Add local PyPI warehouse for piplite#44
mmcky wants to merge 3 commits into
mainfrom
local-pypi-warehouse

Conversation

@mmcky

@mmcky mmcky commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Summary

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.

What this does

  • build_pypi.py — Downloads 6 pure-Python wheels (~1.3 MB total) and generates a Warehouse-like all.json index that piplite understands
  • CI step — Runs after myst build --html to place the pypi/ directory into lectures/_build/html/pypi/

Packages included (for active lectures)

Package Used by
openpyxl long_run_growth, inflation_history, french_rev
xlrd inflation_history
requests french_rev
quantecon_wasm markov_chains_I, markov_chains_II, eigen_II, networks
quantecon-book-networks networks
pandas-datareader networks

Why

When JupyterLite starts, piplite tries to fetch <base-url>/pypi/all.json before 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:

  1. piplite fetches pypi/all.json — 200 OK
  2. Packages found in the index — served from local wheels (faster)
  3. Transitive dependencies not in the index — resolved via micropip CDN (transparent fallback)

Closes #42

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
@netlify

netlify Bot commented Mar 18, 2026

Copy link
Copy Markdown

Deploy Preview for beautiful-dodol-cb9543 ready!

Name Link
🔨 Latest commit dad0ea4
🔍 Latest deploy log https://app.netlify.com/projects/beautiful-dodol-cb9543/deploys/69ba11a3dbbf640008f54612
😎 Deploy Preview https://deploy-preview-44--beautiful-dodol-cb9543.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (dad0ea4)

✨ Browse the preview at the URL above.

@netlify

netlify Bot commented Jun 4, 2026

Copy link
Copy Markdown

Deploy Preview for beautiful-dodol-cb9543 ready!

Name Link
🔨 Latest commit c4fbd5f
🔍 Latest deploy log https://app.netlify.com/projects/beautiful-dodol-cb9543/deploys/6a225b849a8b570008f8c674
😎 Deploy Preview https://deploy-preview-44--beautiful-dodol-cb9543.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (3dda1d6)

✨ Browse the preview at the URL above.

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 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.py to download selected wheels and generate a Warehouse-like all.json index for piplite.
  • Updated the GitHub Actions workflow to run the warehouse build after myst build --html so the generated pypi/ 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.

Comment thread build_pypi.py
Comment on lines +44 to +50
subprocess.check_call([
sys.executable, "-m", "pip", "download",
"--no-deps",
"--only-binary=:all:",
"--dest", str(dest_dir),
*packages,
])
Comment thread build_pypi.py
Comment on lines +121 to +123
output_dir.mkdir(parents=True, exist_ok=True)

with tempfile.TemporaryDirectory() as tmpdir:
Comment thread build_pypi.py
Comment on lines +109 to +111
if normalized not in all_json:
all_json[normalized] = {"releases": {}}
all_json[normalized]["releases"][meta["version"]] = [release]
Comment thread .github/workflows/ci.yml
Comment on lines 70 to +72

- name: Build local PyPI warehouse for piplite
run: python build_pypi.py
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-44--beautiful-dodol-cb9543.netlify.app (c4fbd5f)

✨ Browse the preview at the URL above.

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.

piplite 404 warnings on pip install cells (missing local PyPI warehouse)

2 participants