-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (64 loc) · 2.08 KB
/
Makefile
File metadata and controls
71 lines (64 loc) · 2.08 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
.PHONY: help venv install install-dev test clean
PYTHON := python
VENV_DIR := .venv
VENV_PYTHON := $(VENV_DIR)/bin/python
VENV_PIP := $(VENV_DIR)/bin/pip
PYTEST_FLAGS := -sv
help:
@echo "Available targets:"
@echo " make venv - Create a virtual environment in .venv/"
@echo " make install - Install the project (auto-detects venv)"
@echo " make install-dev - Install with dev dependencies (auto-detects venv)"
@echo " make test - Run pytest tests"
@echo " make clean - Remove build artifacts and venv"
venv:
@if [ -d "$(VENV_DIR)" ]; then \
echo "Virtual environment already exists at $(VENV_DIR)"; \
else \
echo "Creating virtual environment..."; \
$(PYTHON) -m venv $(VENV_DIR); \
echo "Virtual environment created at $(VENV_DIR)"; \
echo "Activate it with: source $(VENV_DIR)/bin/activate"; \
fi
install:
@if [ -d "$(VENV_DIR)" ]; then \
echo "Installing in venv ($(VENV_DIR))..."; \
$(VENV_PIP) install --upgrade pip; \
$(VENV_PIP) install -e .; \
else \
echo "No virtual environment detected."; \
echo "Installing in system/user Python..."; \
pip install --upgrade pip; \
pip install -e .; \
fi
@echo "Installation complete!"
install-dev:
@if [ -d "$(VENV_DIR)" ]; then \
echo "Installing dev deps in venv ($(VENV_DIR))..."; \
$(VENV_PIP) install --upgrade pip; \
$(VENV_PIP) install -e .[dev]; \
else \
echo "No virtual environment detected."; \
echo "Installing dev deps in system/user Python..."; \
pip install --upgrade pip; \
pip install -e .[dev]; \
fi
@echo "Development installation complete!"
test:
@if [ -d "$(VENV_DIR)" ]; then \
echo "Running tests with $(VENV_PYTHON)..."; \
$(VENV_PYTHON) -m pytest $(PYTEST_FLAGS); \
else \
echo "$(VENV_DIR) not found. Falling back to system/user pytest..."; \
pytest $(PYTEST_FLAGS); \
fi
clean:
@echo "Cleaning build artifacts..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf $(VENV_DIR)
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.so" -delete
@echo "Clean complete!"