-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
69 lines (55 loc) · 1.37 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
# Variables
PYTHON = python3
PIP = pip3
VENV_NAME = venv
# Virtual Environment
$(VENV_NAME):
$(PYTHON) -m venv $(VENV_NAME)
# Activate Virtual Environment
activate:
source $(VENV_NAME)/bin/activate
# Install Dependencies
install: $(VENV_NAME)
$(VENV_NAME)/bin/$(PIP) install -r requirements.txt
# Update Dependencies
update:
$(VENV_NAME)/bin/$(PIP) install --upgrade -r requirements.txt
# Freeze Dependencies
freeze:
$(VENV_NAME)/bin/$(PIP) freeze > requirements.txt
# New Exercise Workspace
new-exercise:
git checkout -b $(USER)-exercise-$(shell date +%Y%m%d-%H%M)
# Solutions
solutions:
git checkout -b solutions
# Lint Code
lint:
$(VENV_NAME)/bin/flake8 .
# Run Tests
test:
$(VENV_NAME)/bin/pytest tests/
# Run Application
run:
$(VENV_NAME)/bin/python main.py
# Generate Data
data.txt:
seq 10 > data.txt
# Clean Up
clean:
rm -rf $(VENV_NAME)
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
# Help
help:
@echo "Available commands:"
@echo " make install Install dependencies"
@echo " make update Update dependencies"
@echo " make freeze Freeze dependencies"
@echo " make lint Lint the code"
@echo " make test Run tests"
@echo " make run Run the application"
@echo " make clean Clean up generated files"
@echo " make help Show this help message"
# Default Target
.DEFAULT_GOAL := help