-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (119 loc) · 4.46 KB
/
Copy pathMakefile
File metadata and controls
142 lines (119 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
.PHONY: help clean check fix lint test init dev_setup setup_pre_commit rust-dev rust-user rust-status configure_gcp_registry_all
.DEFAULT_GOAL := help
help:
@echo "make clean"
@echo " Remove all temporary pyc/pycache files"
@echo "make check"
@echo " Run code style and linting (black, ruff) *without* changing files!"
@echo "make fix"
@echo " Run infra/pre-commit.py --fix on your modified files and re-stage them."
@echo "make lint"
@echo " Run infra/pre-commit.py --all-files (no auto-fixing)."
@echo "make test"
@echo " Run the safe tests affected by the current branch and working tree"
@echo "make init"
@echo " Init the repo for development"
@echo "make rust-dev"
@echo " Switch to dev mode (build dupekit from source)"
@echo "make rust-user"
@echo " Switch to user mode (install dupekit from pre-built wheel)"
@echo "make rust-status"
@echo " Show current Rust build mode"
@echo "make configure_gcp_registry_all"
@echo " Apply the 30d Artifact Registry cleanup policy to the marin repo in every canonical region."
init:
conda install -c conda-forge pandoc
npm install -g pandiff
uv sync --extra cpu
huggingface-cli login
clean:
find . -name "*.pyc" | xargs rm -f && \
find . -name "__pycache__" | xargs rm -rf
check:
./infra/pre-commit.py
fix:
@FILES=$$(git diff --name-only HEAD); \
if [ -n "$$FILES" ]; then \
./infra/pre-commit.py --fix $$FILES && git add $$FILES; \
else \
echo "No modified files to fix"; \
fi
lint:
./infra/pre-commit.py --all-files
# Apply the 30d cleanup policy to the marin repo across every canonical region.
# The region list is sourced from config/marin.yaml.
configure_gcp_registry_all:
uv run infra/configure_gcp_registry.py marin --all-regions
test:
uv run --no-project infra/ci/run_tests.py
# stuff for setting up locally
install_uv:
@if ! command -v uv > /dev/null 2>&1; then \
echo "Installing uv..."; \
curl -LsSf https://astral.sh/uv/install.sh | sh; \
echo "uv installed. Please restart your shell or run: source ~/.cargo/env"; \
else \
echo "uv is already installed."; \
fi
install_gcloud:
@if ! command -v gcloud > /dev/null 2>&1; then \
echo "Installing gcloud CLI..."; \
mkdir -p ~/.local; \
if [ "$$(uname)" = "Darwin" ]; then \
if [ "$$(uname -m)" = "arm64" ]; then \
GCLOUD_ARCHIVE="google-cloud-cli-darwin-arm.tar.gz"; \
else \
GCLOUD_ARCHIVE="google-cloud-cli-darwin-x86_64.tar.gz"; \
fi; \
else \
GCLOUD_ARCHIVE="google-cloud-cli-linux-x86_64.tar.gz"; \
fi; \
cd ~/.local && \
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$$GCLOUD_ARCHIVE && \
tar -xzf $$GCLOUD_ARCHIVE && \
rm $$GCLOUD_ARCHIVE && \
./google-cloud-sdk/install.sh --quiet --usage-reporting=false --path-update=true --command-completion=true && \
echo "gcloud installed. Please restart your shell or run: source ~/.zshrc (or ~/.bashrc)"; \
else \
echo "gcloud is already installed."; \
fi
gcloud config set project hai-gcp-models
setup_pre_commit:
@HOOK_PATH=.git/hooks/pre-commit; \
mkdir -p .git/hooks; \
printf '%s\n' '#!/bin/sh' 'set -e' 'REPO_ROOT="$$(git rev-parse --show-toplevel)"' 'cd "$$REPO_ROOT"' './infra/pre-commit.py --fix' > $$HOOK_PATH; \
chmod +x $$HOOK_PATH; \
echo "Installed git pre-commit hook -> $$HOOK_PATH"
install_node:
@if command -v node > /dev/null 2>&1; then \
echo "Node.js $$(node --version) is already installed."; \
elif command -v brew > /dev/null 2>&1; then \
echo "Installing Node.js via Homebrew..."; \
brew install node; \
elif command -v apt-get > /dev/null 2>&1; then \
echo "Installing Node.js via apt..."; \
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && \
sudo apt-get install -y nodejs; \
else \
echo "Cannot auto-install Node.js. Please install manually: https://nodejs.org/"; \
exit 1; \
fi
dev_setup: install_uv install_gcloud install_node setup_pre_commit
@echo "Dev setup complete."
# Rust crate build mode (dupekit)
# User mode (default): pre-built wheels resolved via find-links in pyproject.toml
# Dev mode: adds dupekit path source to [tool.uv.sources] in pyproject.toml (requires Cargo)
rust-dev:
@python3 scripts/rust_mode.py dev
uv sync
@echo "Done. Run 'make rust-user' before committing."
rust-user:
@python3 scripts/rust_mode.py user
uv sync
rust-status:
@python3 scripts/rust_mode.py status
@if command -v cargo > /dev/null 2>&1; then \
echo "Cargo: installed ($$(cargo --version))"; \
else \
echo "Cargo: not found (source builds will fail)"; \
fi