-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
56 lines (43 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
SHELL := /bin/bash
PYTHON_VERSION := 3.12
VENV_PATH := .venv
SITE_PREFIX := $(or $(SITE_PREFIX), /)
.PHONY: setup
setup:
python3 -m venv $(VENV_PATH)
$(VENV_PATH)/bin/pip install --upgrade pip setuptools wheel build
.PHONY: install
install:
$(VENV_PATH)/bin/pip install .
.PHONY: install-extras
install-extras:
$(VENV_PATH)/bin/pip install .[jupyterlite]
.PHONY: build-docs
build-docs:
source $(VENV_PATH)/bin/activate && $(MAKE) -C docs html
.PHONY: build-playground
build-playground: install-extras wheel
source $(VENV_PATH)/bin/activate && $(MAKE) build-playground-without-venv
.PHONY: build-playground-without-venv
build-playground-without-venv: check-jq
cd playground && rm -fr pypi/* && cp -v ../dist/*.whl pypi/ && jupyter lite build && \
WHL_FILE=$$(ls pypi | grep .whl) && \
jq '.["jupyter-config-data"]["litePluginSettings"]["@jupyterlite/pyodide-kernel-extension:kernel"].pyodideUrl = "https://koxudaxi.github.io/pyodide/tag-strings-rebase/pyodide.js"' dist/jupyter-lite.json | \
jq '.["jupyter-config-data"]["litePluginSettings"]["@jupyterlite/pyodide-kernel-extension:kernel"]["loadPyodideOptions"]["packages"] = ["$(SITE_PREFIX)pypi/'$$WHL_FILE'"]' > temp.json && mv temp.json dist/jupyter-lite.json
.PHONY: wheel
wheel: clean-wheel
$(VENV_PATH)/bin/python -m build
.PHONY: clean-wheel
clean-wheel:
rm -rf dist
.PHONY: clean-playground
clean-playground:
rm -rf playground/dist
.PHONY: run-playground
run-playground:
source $(VENV_PATH)/bin/activate && cd playground/dist && python -m http.server 8000
.PHONY: check-jq
check-jq:
which jq || (echo "jq is not installed. Please install jq to continue." && exit 1)
.PHONY: all
all: setup install install-extras build-docs build-playground