-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
82 lines (64 loc) · 2.69 KB
/
makefile
File metadata and controls
82 lines (64 loc) · 2.69 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
72
73
74
75
76
77
78
79
80
81
82
#################################################################################
# GLOBALS (CORRIGIDO PARA POWERSHELL) #
#################################################################################
# --- Variável Chave: Força o uso do Powershell para comandos complexos ---
SHELL := powershell.exe
PROJECT_NAME = src
PYTHON_INTERPRETER = python
# --- Caminhos dos Scripts ---
TRAIN_SCRIPT = $(PROJECT_NAME)/modeling/train.py
PREDICT_SCRIPT = $(PROJECT_NAME)/run_predict.py
#################################################################################
# COMMANDS #
#################################################################################
## Instala as dependências Python
.PHONY: requirements
requirements:
$(PYTHON_INTERPRETER) -m pip install -e .
## Deleta todos os arquivos Python compilados e caches
.PHONY: clean
clean:
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
## Lint usando flake8, black, e isort
.PHONY: lint
lint:
flake8 $(PROJECT_NAME)
isort --check --diff $(PROJECT_NAME)
black --check $(PROJECT_NAME)
## Formata código fonte com black e isort
.PHONY: format
format:
isort $(PROJECT_NAME)
black $(PROJECT_NAME)
#################################################################################
# PROJECT RULES (MLOPS) #
#################################################################################
## Processa dados brutos para formato intermediário
.PHONY: data
data:
$(PYTHON_INTERPRETER) $(PROJECT_NAME)/scripts/make_dataset.py --input_filepath data/raw --output_filepath data/interim
## Treina o modelo, ajusta hiperparâmetros e loga no MLflow/DagsHub
.PHONY: train
train:
@echo "Iniciando pipeline de treino e rastreamento com MLflow..."
python -m src.modeling.run_train
## Executa o script de predição (run_predict)
.PHONY: predict
predict:
@echo "Executando predição do modelo..."
python -m src.modeling.run_predict
#################################################################################
# Self Documenting Commands #
#################################################################################
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys; \
lines = '\n'.join([line for line in sys.stdin]); \
matches = re.findall(r'\n## (.*)\n[\s\S]+?\n([a-zA-Z_-]+):', lines); \
print('Available rules:\n'); \
print('\n'.join(['{:25}{}'.format(*reversed(match)) for match in matches]))
endef
export PRINT_HELP_PYSCRIPT
help:
@$(PYTHON_INTERPRETER) -c "${PRINT_HELP_PYSCRIPT}" < $(MAKEFILE_LIST)