Skip to content

Commit 2501d06

Browse files
authored
Add eudsl-python-extras packages to Wasm playgrounds (#266)
This is a follow-up PR of #264. We try to add eudsl-python-extras packages to these two Wasm playgrounds. Currently the released packages of eudsl-python-extras are sdist which is not quite compatible to `pyodide.loadPackage` and `piplite`, so we first pack it as a wheel package via `pip wheel`, and then pack these wheel packages into the playgrounds. In JupyterLite, we can install the package via: ```python import piplite await piplite.install("eudsl-python-extras") ``` Preview changes at: - https://llvm.github.io/eudsl/jupyter/ - https://llvm.github.io/eudsl/console/
1 parent 25d7a3c commit 2501d06

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

.github/workflows/deploy_pip_page.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,25 @@ jobs:
4646
sed -i.bak 's/\/llvm\/eudsl/https:\/\/github.com\/llvm\/eudsl/g' index.html
4747
mkdir -p page && mv index.html page
4848
49+
- name: Setup Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: '3.12'
53+
4954
- name: Fetch latest WASM wheel
5055
run: |
5156
pip download mlir-python-bindings --plat pyodide_2024_0_wasm32 --no-deps --python-version 3.12 -f https://llvm.github.io/eudsl
5257
echo "MLIR_PYTHON_WHEEL_NAME=$(ls mlir_python_bindings*)" >> $GITHUB_ENV
58+
pip wheel eudsl-python-extras -f https://llvm.github.io/eudsl --no-deps -w .
59+
echo "EUDSL_PYTHON_EXTRAS_WHEEL_NAME=$(ls eudsl_python_extras*)" >> $GITHUB_ENV
5360
5461
- name: Create WASM console page
5562
run: |
5663
mkdir -p page/console
5764
5865
cp pages/console/index.html page/console/index.html
5966
cp $MLIR_PYTHON_WHEEL_NAME page/console/mlir_python_bindings-0.0.1-cp312-cp312-pyodide_2024_0_wasm32.whl
60-
61-
- name: Setup Python
62-
uses: actions/setup-python@v5
63-
with:
64-
python-version: '3.12'
67+
cp $EUDSL_PYTHON_EXTRAS_WHEEL_NAME page/console/eudsl_python_extras-0.0.1-py3-none-any.whl
6568
6669
- name: Create WASM jupyterlite page
6770
run: |
@@ -71,7 +74,8 @@ jobs:
7174
jupyter lite build \
7275
--contents pages/jupyter/contents \
7376
--output-dir page/jupyter \
74-
--piplite-wheels $MLIR_PYTHON_WHEEL_NAME
77+
--piplite-wheels $MLIR_PYTHON_WHEEL_NAME \
78+
--piplite-wheels $EUDSL_PYTHON_EXTRAS_WHEEL_NAME
7579
7680
- name: Show directory structure
7781
run: |

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ Currently, there are five components:
3333

3434
## Wasm Playground
3535

36-
We currently provide two online playgrounds where you can try out the WebAssembly version of the MLIR Python bindings directly in your browser:
36+
We currently provide two online playgrounds where you can try out the WebAssembly version of mlir-python-bindings and eudsl-python-extras directly in your browser:
3737

3838
* https://llvm.github.io/eudsl/jupyter/ – A JupyterLite instance with a Pyodide kernel. You can install the MLIR Python bindings with: `await piplite.install("mlir-python-bindings")`.
3939

40-
* https://llvm.github.io/eudsl/console/ – A Pyodide-based REPL with `mlir-python-bindings` preloaded. Just run: `from mlir.ir import *` to start coding.
40+
* https://llvm.github.io/eudsl/console/ – A Pyodide-based REPL with `mlir-python-bindings` and `eudsl-python-extras` preloaded. Just run: `from mlir.ir import *` to start coding.
4141

4242
## Getting started
4343

pages/console/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@
108108
},
109109
});
110110

111-
// load mlir-python-bindings wheel package
111+
// load additional wheel package
112+
await pyodide.loadPackage("numpy");
112113
await pyodide.loadPackage("mlir_python_bindings-0.0.1-cp312-cp312-pyodide_2024_0_wasm32.whl");
114+
await pyodide.loadPackage("eudsl_python_extras-0.0.1-py3-none-any.whl");
113115

114116
let { repr_shorten, BANNER, PyodideConsole } =
115117
pyodide.pyimport("pyodide.console");

0 commit comments

Comments
 (0)