-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (87 loc) · 2.33 KB
/
Makefile
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
.PHONY: default
default:
@echo "an explicit target is required"
SHELL=/usr/bin/env bash
PYTHON_FILES=$(shell git ls-files '*.py' | sort | tr '\n' ' ')
export PYTHONPATH := $(shell realpath .)
.PHONY: lock
lock:
# Complex logic needed to pin `setuptools` but not `pip` in Python 3.11 and earlier
PYTHON_VERSION_AT_LEAST_3_12=$(shell python -c 'import sys; print(int(sys.version_info >= (3, 12)))')
ifeq ($(PYTHON_VERSION_AT_LEAST_3_12),1)
pip freeze >requirements-lock.txt
else
pip freeze --all --exclude pip >requirements-lock.txt
endif
# Remove editable packages because they are expected to be available locally
sed --in-place -e '/^-e .*/d' requirements-lock.txt
# Strip local versions so PyTorch is the same on Linux and macOS
sed --in-place -e 's/+[[:alnum:]]\+$$//g' requirements-lock.txt
# Remove nvidia-* and triton because they cannot be installed on macOS
# The packages have no sdists, and their wheels are not available for macOS
# They install automatically on Linux as a requirement of PyTorch
sed --in-place -e '/^\(nvidia-.*\|triton\)==.*/d' requirements-lock.txt
.PHONY: actionlint
actionlint:
pre-commit run --all-files actionlint
.PHONY: black
black:
pre-commit run --all-files black
.PHONY: codespell
codespell:
pre-commit run --all-files codespell
.PHONY: lychee
lychee:
pre-commit run --all-files --hook-stage manual lychee
.PHONY: markdownlint
markdownlint:
pre-commit run --all-files markdownlint
.PHONY: mypy
mypy:
ifneq ($(PYTHON_FILES),)
mypy $(PYTHON_FILES)
endif
.PHONY: prettier
prettier:
pre-commit run --all-files prettier
.PHONY: pylint
pylint:
ifneq ($(PYTHON_FILES),)
pylint $(PYTHON_FILES)
endif
.PHONY: ruff
ruff:
pre-commit run --all-files ruff
.PHONY: shellcheck
shellcheck:
pre-commit run --all-files shellcheck
.PHONY: shfmt
shfmt:
pre-commit run --all-files shfmt
.PHONY: yamllint
yamllint:
pre-commit run --all-files yamllint
.PHONY: precommit
precommit:
pre-commit run --all-files
.PHONY: check
check: precommit mypy pylint
.PHONY: fix
fix: lock check
.PHONY: update
update:
pip install --upgrade pip
pip install --upgrade -e .[dev] -r requirements-lock.txt
.PHONY: upgrade
upgrade:
pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -e .[dev]
.PHONY: install
install:
make update
TAG ?= latest
.PHONY: build
build:
docker build \
--tag rss-shim:$(TAG) \
.