tenseleyflow/wulftp / 864133f

Browse files

absurd makefile

Authored by espadonne
SHA
864133f7f999b59596a0680ed7904246f6094fce
Parents
a5baae6
Tree
21a55bb

1 changed file

StatusFile+-
A Makefile 98 0
Makefileadded
@@ -0,0 +1,98 @@
1
+.PHONY: help install install-dev uninstall clean build run test format lint typecheck pre-commit reinstall reshim
2
+
3
+# Default target
4
+help:
5
+	@echo "wulFTP Makefile"
6
+	@echo "  make install      - Install package in production mode"
7
+	@echo "  make install-dev  - Install package with dev dependencies"
8
+	@echo "  make uninstall    - Uninstall wulftp"
9
+	@echo "  make clean        - Remove build artifacts and cache"
10
+	@echo "  make build        - Build distribution packages"
11
+	@echo "  make run          - Run wulFTP directly"
12
+	@echo "  make test         - Run test suite"
13
+	@echo "  make format       - Format code with black and isort"
14
+	@echo "  make lint         - Run linting with ruff"
15
+	@echo "  make typecheck    - Run type checking with mypy"
16
+	@echo "  make pre-commit   - Run all code quality checks"
17
+	@echo "  make reinstall    - Full reinstall (uninstall, clean, install-dev)"
18
+	@echo "  make reshim       - Reshim for asdf"
19
+
20
+install:
21
+	pip install -e .
22
+	@if command -v asdf >/dev/null 2>&1; then \
23
+		asdf reshim python; \
24
+	fi
25
+
26
+install-dev:
27
+	pip install -e ".[dev]"
28
+	@if command -v asdf >/dev/null 2>&1; then \
29
+		asdf reshim python; \
30
+	fi
31
+
32
+uninstall:
33
+	pip uninstall -y wulftp || true
34
+
35
+clean:
36
+	# Remove Python cache files
37
+	find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
38
+	find . -type f -name "*.pyc" -delete 2>/dev/null || true
39
+	find . -type f -name "*.pyo" -delete 2>/dev/null || true
40
+	find . -type f -name "*.pyd" -delete 2>/dev/null || true
41
+	find . -type f -name ".coverage" -delete 2>/dev/null || true
42
+	find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
43
+	find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
44
+	find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
45
+	# Remove build artifacts
46
+	rm -rf build/ dist/ 2>/dev/null || true
47
+	# Remove egg-info directories only in src/
48
+	find src -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
49
+
50
+build: clean
51
+	python -m build
52
+
53
+run:
54
+	python -m wulftp
55
+
56
+test:
57
+	@if [ -d "tests" ]; then \
58
+		pytest tests/ -v; \
59
+	else \
60
+		echo "No tests directory found. Create tests/ to add tests."; \
61
+	fi
62
+
63
+format:
64
+	black src/
65
+	isort src/
66
+
67
+lint:
68
+	ruff check src/
69
+
70
+typecheck:
71
+	mypy src/
72
+
73
+pre-commit: format lint typecheck
74
+
75
+reshim:
76
+	@if command -v asdf >/dev/null 2>&1; then \
77
+		asdf reshim python; \
78
+	else \
79
+		echo "asdf not found, skipping reshim"; \
80
+	fi
81
+
82
+# Safer reinstall that preserves pip
83
+reinstall:
84
+	-$(MAKE) uninstall
85
+	$(MAKE) clean
86
+	$(MAKE) install-dev
87
+
88
+# Development shortcuts
89
+dev: install-dev
90
+
91
+# Quick test run
92
+qt: test
93
+
94
+# Watch for changes and run (requires watchdog)
95
+watch:
96
+	@echo "Installing watchdog if not present..."
97
+	@pip install watchdog[watchmedo] >/dev/null 2>&1 || true
98
+	watchmedo auto-restart -d src -p '*.py' -- python -m wulftp