Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (109 loc) · 4.56 KB
/
Copy pathMakefile
File metadata and controls
126 lines (109 loc) · 4.56 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
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.PHONY: help bootstrap format lint knip typecheck test test-application build docs-examples docs-build docs-serve check package
.PHONY: _anti-slop-check
FORMAT_PATHS := \
.pnpmfile.mjs \
.github \
apps \
development_docs \
docs \
examples \
packages \
scripts \
skills \
AGENTS.md \
CLAUDE.md \
CONTRIBUTING.md \
README.md \
SECURITY.md \
knip.jsonc \
package.json \
plugin.json \
pnpm-workspace.yaml \
pyproject.toml \
tsconfig.base.json \
vite.config.ts
LINT_PATHS := .pnpmfile.mjs apps examples packages vite.config.ts
PYTHON_PATHS := packages/python scripts skills
PYTEST_WORKERS ?= 4
APPLICATION_UV_FLAGS ?=
DIST_DIR := $(CURDIR)/dist
PYTHON_DIST_DIR := $(DIST_DIR)/python
NPM_DIST_DIR := $(DIST_DIR)/npm
PNPM_BIN := $(CURDIR)/node_modules/.bin
export PATH := $(PNPM_BIN):$(PATH)
# The local wrapper selects pnpm's managed Node runtime. A nested `pnpm exec`
# exposes a relative Node shim that child tools cannot use.
VP := $(PNPM_BIN)/vp
help: ## List development targets.
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z0-9_-]+:.*## / {printf " %-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
format: ## Format Python, TypeScript, and documentation source.
$(VP) fmt $(FORMAT_PATHS)
uv run ruff format $(PYTHON_PATHS)
bootstrap: ## Install the locked Python and TypeScript workspaces.
uv sync --all-packages --all-groups --all-extras --locked
pnpm install --frozen-lockfile
_anti-slop-check:
node --test tools/oxlint/anti-slop/test/*.test.ts tools/oxlint/anti-slop/test/compatibility/*.test.ts
tsc -p tools/oxlint/anti-slop/tsconfig.json --noEmit
lint: _anti-slop-check ## Check Python and TypeScript source.
$(VP) lint --deny-warnings $(LINT_PATHS)
uv run ruff check $(PYTHON_PATHS)
@$(MAKE) --no-print-directory knip
knip: ## Check unused JavaScript and TypeScript files, exports, and dependencies.
pnpm knip
typecheck: ## Type-check every Python and TypeScript package.
$(VP) run -r typecheck
uv run --group test ty check packages/python
test: ## Run Python, browser core, loader, skill, and example tests.
$(VP) run -r test
uv run --group test --all-extras pytest -q -n $(PYTEST_WORKERS) --dist worksteal \
--max-worker-restart=0 \
-m "not serial and not application" \
packages/python/tests
uv run --group test --all-extras pytest -q -m serial packages/python/tests
@$(MAKE) --no-print-directory test-application
test-application: ## Run deterministic notebook build, reuse, and capture contracts.
uv run $(APPLICATION_UV_FLAGS) --group test --all-extras \
pytest -q -m application packages/python/tests
build: ## Build Python, npm, docs, and example packages.
@$(MAKE) --no-print-directory docs-examples
$(VP) run -r build
test -s apps/docs/.vitepress/dist/llms.txt
test -s apps/docs/.vitepress/dist/llms-full.txt
test -s apps/docs/.vitepress/dist/sitemap.xml
uv build --package marimo-export --clear --no-sources
package: ## Build and verify Python and npm release artifacts.
rm -rf "$(DIST_DIR)"
mkdir -p "$(PYTHON_DIST_DIR)/from-sdist" "$(NPM_DIST_DIR)"
pnpm --filter @marimo-team/portable-json test:package
pnpm --filter @marimo-team/marimo-export test:package
@set -eu; \
version=$$(node -p 'JSON.parse(require("fs").readFileSync("packages/browser/package.json", "utf8")).version'); \
(cd packages/browser && pnpm --config.ignore-scripts=true pack \
--out "$(NPM_DIST_DIR)/marimo-team-marimo-export-$$version.tgz")
uv build --package marimo-export --out-dir "$(PYTHON_DIST_DIR)" --no-sources
uvx twine check "$(PYTHON_DIST_DIR)"/*.whl "$(PYTHON_DIST_DIR)"/*.tar.gz
uv build --wheel "$(PYTHON_DIST_DIR)"/*.tar.gz \
--out-dir "$(PYTHON_DIST_DIR)/from-sdist"
./scripts/verify-dist.sh
docs-build: docs-examples ## Build the public documentation site.
pnpm --filter @marimo-team/marimo-export-docs build
test -s apps/docs/.vitepress/dist/llms.txt
test -s apps/docs/.vitepress/dist/llms-full.txt
test -s apps/docs/.vitepress/dist/sitemap.xml
docs-examples: ## Build static applications for the documentation site.
pnpm --filter @marimo-team/marimo-export-docs examples:build
docs-serve: ## Serve public documentation through Portless.
BASE_PATH= $(VP) run --filter @marimo-team/marimo-export-docs dev
check: ## Run the complete local quality gate.
$(VP) fmt --check $(FORMAT_PATHS)
uv run ruff format --check $(PYTHON_PATHS)
@$(MAKE) --no-print-directory lint
@$(MAKE) --no-print-directory typecheck
@$(MAKE) --no-print-directory test
@$(MAKE) --no-print-directory docs-examples
$(VP) run --filter './apps/**' --filter './examples/**' --fail-if-no-match build
@$(MAKE) --no-print-directory package