-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (84 loc) · 2.26 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
SHELL:=/bin/bash
SUPPORTED_COMMANDS := test
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
COMMAND_ARGS := $(subst :,\:,$(COMMAND_ARGS))
$(eval $(COMMAND_ARGS):;@:)
endif
# Git workflow commands
.PHONY: wip
wip:
git add .
git commit -m "WIP: Work in progress"
git push
# Install command
.PHONY: install
install:
uv sync --all-extras --dev
# Build command
.PHONY: build
build: check-version
rm -rf dist/* || true
# ls -al
./scripts/version.sh "${VERSION}"
@cat pyproject.toml | grep version
@cat reattempt/__init__.py | grep version
uv build
.PHONY: check-version
check-version:
@if [ -z "${VERSION}" ]; then \
echo "VERSION is not set. Please set the VERSION environment variable."; \
exit 1; \
fi
# Deploy command
.PHONY: deploy
deploy:
uvx twine upload dist/*
# Install local build command
.PHONY: install-local
install-local:
pip3 install dist/*.whl
# Test command
.PHONY: test
test:
@echo "Modified arguments: $(new_args)"
@if [ -z "$(COMMAND_ARGS)" ]; then \
uv run --python $${PYTHON_VERSION:-3.13} pytest -v --log-cli-level=INFO; \
else \
uv run --python $${PYTHON_VERSION:-3.13} pytest -v --log-cli-level=INFO $(new_args); \
fi
# Lint command
.PHONY: lint
lint:
uv run ruff check --fix
uv run ruff format
uv run ruff format --check
# Update dependencies
.PHONY: update
update:
uv lock --upgrade
uv sync
# Check for outdated dependencies
.PHONY: check-deps
check-deps:
.venv/bin/pip list --outdated
# Run type checking
.PHONY: type-check
type-check:
PYRIGHT_PYTHON_FORCE_VERSION=latest uv run pyright
# Display all available commands
.PHONY: help
help:
@echo "Available commands:"
@echo " wip - Commit and push work in progress"
@echo " install - Install dependencies"
@echo " build - Build the project"
@echo " deploy - Deploy the project"
@echo " install-local - Install the build locally"
@echo " test - Run tests"
@echo " lint - Run linter"
@echo " update - Update dependencies"
@echo " check-deps - Check for outdated dependencies"
@echo " type-check - Run type checking"
@echo " help - Display this help message"