Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (79 loc) · 3.36 KB
/
Copy pathMakefile
File metadata and controls
92 lines (79 loc) · 3.36 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
.PHONY: check-poetry core tests notebooks dev clean docs mcp setup-sys-deps
GLOBAL_POETRY := $(shell which -a poetry | grep -v ".venv" | head -n 1)
# Avoid poetry hanging on keyring lookups in headless/SSH sessions (no private indexes used)
export PYTHON_KEYRING_BACKEND ?= keyring.backends.null.Keyring
SAFE_RUN := env -u VIRTUAL_ENV
# OS Detection
UNAME_S := $(shell uname -s)
# Path definitions for local (no-sudo) installs
LOCAL_LIB := $(HOME)/.local/lib
export LD_LIBRARY_PATH := $(LOCAL_LIB)$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))
export DYLD_LIBRARY_PATH := $(LOCAL_LIB)$(if $(DYLD_LIBRARY_PATH),:$(DYLD_LIBRARY_PATH))
setup-sys-deps:
ifeq ($(UNAME_S),Darwin)
@echo "Checking for udunits via Homebrew..."
@command -v brew > /dev/null 2>&1 || ( \
echo "----------------------------------------------------------"; \
echo "ERROR: Homebrew is required to check for udunits on macOS."; \
echo "Install Homebrew from https://brew.sh/, then run:"; \
echo " brew install udunits"; \
echo "----------------------------------------------------------"; \
exit 1)
@brew --prefix udunits > /dev/null 2>&1 || ( \
echo "----------------------------------------------------------"; \
echo "ERROR: udunits not found via Homebrew."; \
echo "Install it with:"; \
echo " brew install udunits"; \
echo "----------------------------------------------------------"; \
exit 1)
endif
ifeq ($(UNAME_S),Linux)
@echo "Checking for udunits2 development files..."
@if (command -v pkg-config > /dev/null 2>&1 && pkg-config --exists udunits2) || \
(command -v dpkg > /dev/null 2>&1 && dpkg -s libudunits2-dev > /dev/null 2>&1); then \
echo "udunits2 development files found."; \
else \
echo "----------------------------------------------------------"; \
echo "ERROR: libudunits2-dev / udunits2 pkg-config metadata not found."; \
echo "If you have sudo, run: sudo apt-get install libudunits2-dev"; \
echo "If not, install to ~/.local/ or use a Conda environment."; \
echo "----------------------------------------------------------"; \
exit 1; \
fi
endif
check-poetry:
@if [ -z "$(GLOBAL_POETRY)" ]; then \
echo "----------------------------------------------------------"; \
echo "ERROR: poetry is not installed (outside of .venv)."; \
echo "Install it with one of:"; \
echo " curl -sSL https://install.python-poetry.org | python3 -"; \
echo " pipx install poetry"; \
echo "See https://python-poetry.org/docs/#installation"; \
echo "Then re-run make."; \
echo "----------------------------------------------------------"; \
exit 1; \
fi
# Core sync
core: check-poetry setup-sys-deps
$(SAFE_RUN) $(GLOBAL_POETRY) sync
# Sync including specific extras
tests: check-poetry
$(SAFE_RUN) $(GLOBAL_POETRY) sync --extras "tests notebooks"
mcp: check-poetry
$(SAFE_RUN) $(GLOBAL_POETRY) sync --extras "notebooks mcp"
notebooks: check-poetry
$(SAFE_RUN) $(GLOBAL_POETRY) sync --extras notebooks
dev: check-poetry setup-sys-deps
$(SAFE_RUN) $(GLOBAL_POETRY) sync --extras "notebooks tests docs dev mcp"
$(SAFE_RUN) $(GLOBAL_POETRY) run pre-commit install
# Plugin management is global, so it doesn't need SAFE_RUN
$(GLOBAL_POETRY) self add poetry-plugin-export
docs: check-poetry
$(SAFE_RUN) $(GLOBAL_POETRY) sync --extras docs
clean:
rm -rf .venv
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf dist
rm -rf *.egg-info
find . -type d -name "__pycache__" -exec rm -rf {} +