forked from marin-community/marin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (126 loc) · 4.61 KB
/
Makefile
File metadata and controls
150 lines (126 loc) · 4.61 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
.PHONY: help clean check fix setup_pre_commit rust-dev rust-user rust-status rust-package
.DEFAULT: 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 all tests"
@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"
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
test:
export HUGGING_FACE_HUB_TOKEN=$HF_TOKEN
export HF_HUB_TOKEN=$HF_TOKEN
RAY_ADDRESS= PYTHONPATH=tests:. pytest tests --durations=0 -n 4 --tb=no -v
# Target to configure GCP registry cleanup policy for all standard regions
CLUSTER_REPOS = us-central2 us-central1 europe-west4 us-west4 us-east5 us-east1
default_registry_name = marin
configure_gcp_registry_all:
@echo "Configuring GCP registry cleanup policy for all standard regions..."
$(foreach region,$(CLUSTER_REPOS), \
python infra/configure_gcp_registry.py $(default_registry_name) --region=$(region) ; \
)
@echo "Cleanup policy configured for all regions."
# 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-package:
@python3 scripts/rust_package.py
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