-
Notifications
You must be signed in to change notification settings - Fork 970
Expand file tree
/
Copy pathMakefile
More file actions
170 lines (139 loc) · 4.46 KB
/
Makefile
File metadata and controls
170 lines (139 loc) · 4.46 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Makefile for marimo - Development and build tasks
# Prerequisites:
# - uv: for Python dependency management, testing, and building
# - pnpm: for frontend development
# - Node.js: for frontend development
.PHONY: help
# 📖 Show available commands
help:
@printf "\nMarimo Development Commands:\n\n"
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{printf " \033[36m%-20s\033[0m %s\n", substr($$1,1,index($$1,":")-1),c}1{c=0}' $(MAKEFILE_LIST)
@printf "\nRun 'make check-prereqs' and 'make install-all' to get started!\n\n"
###############
# Setup Tasks #
###############
.PHONY: install-all
# 🚀 First-time setup: Install all dependencies (frontend & Python)
install-all: fe py
.PHONY: check-prereqs
# ✓ Check if all required tools are installed
check-prereqs:
@command -v pnpm >/dev/null 2>&1 || { echo "pnpm is required. See https://pnpm.io/installation"; exit 1; }
@pnpm -v | grep -vq "^[0-8]\." || { echo "pnpm v9+ is required. Current version: $(shell pnpm -v)"; exit 1; }
@command -v uv >/dev/null 2>&1 || { echo "uv is required. See https://docs.astral.sh/uv/getting-started/installation/"; exit 1; }
@command -v node >/dev/null 2>&1 || { echo "Node.js is required. See https://nodejs.org/en/download/"; exit 1; }
@node -v | grep -q "v2[0-9]" || { echo "Node.js v20+ is required. Current version: $(shell node -v)"; exit 1; }
@echo "✅ All prerequisites are installed!"
.PHONY: py
# 🐍 Install Python dependencies in editable mode
py:
@command -v uv >/dev/null 2>&1 || { echo "uv is required. See https://docs.astral.sh/uv/getting-started/installation/"; exit 1; }
uv pip install --group=dev -e .
######################
# Development Tasks #
######################
.PHONY: fe
# 🔧 Build frontend assets
fe: marimo/_static marimo/_lsp
# 🔧 Install/build frontend if anything under frontend/
marimo/_static: $(shell find frontend/src) $(wildcard frontend/*)
./scripts/buildfrontend.sh
# 🔧 Install/build lsp if anything in lsp/ has changed
marimo/_lsp: $(shell find packages/lsp)
./scripts/buildlsp.sh
.PHONY: dev
dev: fe-codegen
@echo "Starting development servers..."
@# Start both processes, with marimo in background
@(trap 'kill %1; exit' INT; \
uv run marimo edit --no-token --headless /tmp --port 2718 & \
pnpm dev)
dev-sandbox:
@echo "Starting development servers..."
@# Start both processes, with marimo in background
@(trap 'kill %1; exit' INT; \
uv run marimo edit /tmp/notebook.py --no-token --headless --sandbox & \
pnpm dev)
#############
# Testing #
#############
.PHONY: test
# 🧪 Run all tests (frontend, Python, end-to-end)
test: fe-test py-test e2e
.PHONY: check
# 🧹 Run all checks
check: fe-check py-check
.PHONY: fe-check
# 🧹 Check frontend (lint, typecheck)
fe-check: fe-lint fe-typecheck
.PHONY: fe-test
# 🧪 Test frontend
fe-test:
CI=true pnpm turbo --filter @marimo-team/frontend test -- --run
.PHONY: e2e
# 🧪 Test end-to-end
e2e:
cd frontend; pnpm playwright install; pnpm playwright test
.PHONY: fe-lint
# 🧹 Lint frontend
fe-lint:
cd frontend/src && uv run typos && cd - && pnpm --filter @marimo-team/frontend lint
.PHONY: fe-typecheck
# 🔍 Typecheck frontend
fe-typecheck:
pnpm turbo --filter @marimo-team/frontend typecheck
.PHONY: fe-codegen
# 🔄 Generate frontend API
fe-codegen:
uv run --python=3.12 ./marimo development openapi > packages/openapi/api.yaml
pnpm run codegen
pnpm format packages/openapi/
.PHONY: py-check
# 🔍 Typecheck, lint, format python
py-check:
./scripts/pycheck.sh
.PHONY: typos
# 🔍 Check for typos
typos:
uv run typos
.PHONY: py-test
# 🧪 Test python
py-test:
uv run typos
./scripts/pytest.sh --optional $(ARGS)
.PHONY: py-test-narwhals
# 🧪 Test narwhals-related tests (used externally by narwhals repo)
py-test-narwhals:
uv run --group test pytest \
tests/_data/ \
tests/_plugins/ui/_impl/ \
tests/_utils/test_narwhals_utils.py
.PHONY: py-snapshots
# 📸 Update snapshots
py-snapshots:
uv run --group test pytest \
tests/_server/templates/test_templates.py \
tests/_server/api/endpoints/test_export.py \
tests/test_api.py
##############
# Packaging #
##############
.PHONY: wheel
# 📦 Build wheel
wheel:
uv build
#################
# Documentation #
#################
.PHONY: docs
# 📚 Build docs
docs:
uv run --group docs mkdocs build
.PHONY: docs-serve
# 📚 Serve docs
docs-serve:
uv run --group docs mkdocs serve --clean
.PHONY: storybook
# 🧩 Start Storybook for UI development
storybook:
pnpm --filter @marimo-team/frontend storybook