-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (38 loc) · 1.61 KB
/
Makefile
File metadata and controls
46 lines (38 loc) · 1.61 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
.PHONY: setup test clean lint format run help
# Global variables
PYTHON := python3
PIP := pip
VENV := .venv
VENV_PYTHON := $(VENV)/bin/$(PYTHON)
VENV_PIP := $(VENV)/bin/$(PIP)
help: ## Show this help menu
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
setup: ## First-time setup: creates virtualenv, installs all requirements (prod, test), and configures pre-commit
@echo "=> Creating Python virtual environment..."
$(PYTHON) -m venv $(VENV)
@echo "=> Upgrading pip..."
$(VENV_PIP) install --upgrade pip
@echo "=> Installing project dependencies..."
$(VENV_PIP) install -r requirements.txt
@echo "=> Installing test dependencies..."
$(VENV_PIP) install -r tests/requirements.txt
@echo "=> Installing pre-commit hooks..."
$(VENV_PYTHON) -m pre_commit install
@echo "=> (Optional) Installing Playwright browsers..."
$(VENV_PYTHON) -m playwright install chromium
@echo "\n✅ Setup complete! Activate the environment using: source .venv/bin/activate (or .venv\\Scripts\\activate on Windows)"
test: ## Run the pytest test suite
$(VENV_PYTHON) -m pytest tests/
lint: ## Run flake8 and pre-commit checks on all files
$(VENV_PYTHON) -m pre_commit run --all-files
format: ## Run black to auto-format Python files
$(VENV_PYTHON) -m black .
run: ## Run the scraper script locally
cd scripts && ../$(VENV_PYTHON) update_jobs.py
clean: ## Remove virtualenv, caches, and build artifacts
rm -rf $(VENV)
rm -rf .pytest_cache
rm -rf __pycache__
rm -rf scripts/__pycache__
rm -rf tests/__pycache__
@echo "Cleaned up all temporary files."