-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (81 loc) · 2.86 KB
/
Makefile
File metadata and controls
99 lines (81 loc) · 2.86 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
# Default target: show all available targets
.PHONY: help
help:
@echo "Available targets:"
@awk '/^[a-zA-Z0-9_\-]+:/ && !/^\./ {print " " $$1}' $(MAKEFILE_LIST) | sed 's/://'
.DEFAULT_GOAL := help
.PHONY: prek-install
prek-install:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.3.5/prek-installer.sh | sh
.PHONY: fmt
fmt:
uv run python -m ruff format
uv run python -m ruff check . --fix
.PHONY: mypy
mypy:
uv run python -m mypy --config-file pyproject.toml \
src/ \
examples/basics/hello.py \
examples/basics/hello_v2.py
.PHONY: uvlock
uvlock:
bash maint_tools/uvlock.sh
.PHONY: lint
lint-fix:
uv run python -m ruff check . --fix
.PHONY: dist
dist: clean
# export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_FLYTE=0.0.1b0 to build with specific version
uv run python -m build --wheel --installer uv
.PHONY: clean-plugins
clean-plugins:
rm -f dist/flyteplugins_*.whl
rm -rf plugins/**/dist/
rm -rf plugins/**/build/
.PHONY: dist-plugins
dist-plugins: clean-plugins
# set FLYTE_PLUGIN_DIST to the directory of a specific plugin to build
for plugin in $${FLYTE_PLUGIN_DIST:-plugins/*}; do \
if [ -d "$$plugin" ]; then \
uv run python -m build --wheel --installer uv --outdir ./dist "$$plugin"; \
fi \
done
dist-all: dist dist-plugins
.PHONY: clean
clean:
rm -rf dist/
rm -rf plugins/**/dist/
rm -rf build/
rm -rf plugins/**/build/
rm -rf src/flyte.egg-info
.PHONY: update-import-profile
update-import-profile:
PYTHONPROFILEIMPORTTIME=1 python -c 'import flyte' 2&> import_profiles/flyte_importtime.txt
.PHONY: check-import-profile
check-import-profile:
@echo "Checking import profile..."
PYTHONPROFILEIMPORTTIME=1 python -c 'import flyte' 2&> updated_flyte_importtime.txt
awk '{print $$NF}' import_profiles/flyte_importtime.txt > import_profiles/filtered_flyte_importtime.txt
awk '{print $$NF}' updated_flyte_importtime.txt > updated_filtered_flyte_importtime.txt
diff import_profiles/filtered_flyte_importtime.txt updated_filtered_flyte_importtime.txt || (echo "Import profile mismatch!" && exit 1)
rm -f updated_flyte_importtime.txt updated_filtered_flyte_importtime.txt
.PHONY: unit_test
unit_test: ## Test the code with pytest
@echo "🚀 Testing code: Running unit tests..."
@uv run python -m pytest -k "not integration and not sandbox" tests
# Test plugins with pytest
# Usage:
# To run all plugin tests: `make unit_test_plugins`
# To run a specific plugin test: `FLYTE_PLUGIN=plugins/openai make unit_test_plugins`
.PHONY: unit_test_plugins
unit_test_plugins:
@for plugin in $${FLYTE_PLUGIN:-plugins/*}; do \
if [ -d "$$plugin/tests" ]; then \
echo "🚀 Testing plugin: $$plugin..."; \
cd "$$plugin" && uv run python -m pytest tests/ && cd ../..; \
fi \
done
.PHONY: cli-docs-gen
cli-docs-gen: ## Generate CLI documentation
@echo "📖 Generating CLI documentation..."
@uv run flyte gen docs --type markdown