Skip to content

Commit

Permalink
chore(docs): clean up current pyodide build
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 20, 2024
1 parent 6042bf4 commit b8fdf65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
9 changes: 6 additions & 3 deletions docs/tutorials/browser/repl.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ from urllib.parse import urlencode
lines = """
%pip install numpy pandas tzdata
import pyodide_js, pathlib, js
await pyodide_js.loadPackage("https://storage.googleapis.com/ibis-wasm-wheels/pyarrow-16.0.0.dev2661%2Bg9bddb87fd-cp311-cp311-emscripten_3_1_46_wasm32.whl")
pathlib.Path("penguins.csv").write_text(await (await js.fetch("https://storage.googleapis.com/ibis-tutorial-data/penguins.csv")).text())
del pyodide_js, pathlib, js
wheel_url = "https://storage.googleapis.com/ibis-wasm-wheels/pyarrow-17.0.0-cp311-cp311-emscripten_3_1_46_wasm32.whl"
await pyodide_js.loadPackage(wheel_url)
penguins_csv_url = "https://storage.googleapis.com/ibis-tutorial-data/penguins.csv"
penguins_text = await (await js.fetch(penguins_csv_url)).text()
pathlib.Path("penguins.csv").write_text(penguins_text)
del pyodide_js, pathlib, js, wheel_url, penguins_csv_url, penguins_text
%clear
%pip install 'ibis-framework[duckdb]'
from ibis.interactive import *
Expand Down
23 changes: 6 additions & 17 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -249,33 +249,22 @@ docs-api-preview:
docs-deploy:
quarto publish --no-prompt --no-browser --no-render netlify docs

# build an ibis_framework wheel that works with pyodide
build-ibis-for-pyodide:
# build jupyterlite repl
build-jupyterlite:
#!/usr/bin/env bash
set -euo pipefail
# TODO(cpcloud): remove when:
# 1. pyarrow release contains pyodide
# 2. ibis supports this version of pyarrow
# build an ibis wheel
rm -rf dist/
poetry add 'pyarrow>=10.0.1' --allow-prereleases
poetry build --format wheel
git checkout poetry.lock pyproject.toml
jq '{"PipliteAddon": {"piplite_urls": [$ibis, $duckdb]}}' -nM \
--arg ibis dist/*.whl \
--arg duckdb "https://duckdb.github.io/duckdb-pyodide/wheels/duckdb-1.0.0-cp311-cp311-emscripten_3_1_46_wasm32.whl" \
> docs/jupyter_lite_config.json

# build the jupyterlite deployment
build-jupyterlite: build-ibis-for-pyodide
#!/usr/bin/env bash
set -euo pipefail

mkdir -p docs/_output/jupyterlite

jupyter lite build \
--debug \
--no-libarchive \
--config docs/jupyter_lite_config.json \
--piplite-wheels dist/*.whl \
--piplite-wheels "https://duckdb.github.io/duckdb-pyodide/wheels/duckdb-1.1.0-cp311-cp311-emscripten_3_1_46_wasm32.whl" \
--apps repl \
--no-unused-shared-packages \
--output-dir docs/_output/jupyterlite
Expand Down

0 comments on commit b8fdf65

Please sign in to comment.