@@ -21,7 +21,7 @@ PYTHON = python3
2121
2222# .PHONY defines parts of the makefile that are not dependant on any specific file
2323# This is most often used to store functions
24- .PHONY = help setup lint test debug clean
24+ .PHONY = help setup format lint test debug clean
2525
2626# Defining an array variable
2727FILES = input output
@@ -30,10 +30,12 @@ FILES = input output
3030# This target is executed whenever we just type `make`
3131.DEFAULT_GOAL = help
3232
33+
3334# The @ makes sure that the command itself isn't echoed in the terminal
3435help :
3536 @echo " $( BOLD_BLUE) -----------------------------MAKE GUIDE----------------------------$( RESET_STYLES) "
3637 @echo " $( BOLD_CYAN) make setup$( RESET_STYLES) : Setup pyflask-service"
38+ @echo " $( BOLD_CYAN) make format$( RESET_STYLES) : Format and fix python code pyflask-service"
3739 @echo " $( BOLD_CYAN) make lint$( RESET_STYLES) : Lint pyflask-service"
3840 @echo " $( BOLD_CYAN) make test$( RESET_STYLES) : Test pyflask-service"
3941 @echo " $( BOLD_CYAN) make debug$( RESET_STYLES) : Debug pyflask-service"
@@ -43,13 +45,39 @@ help:
4345 @echo " $( BOLD_BLUE) -------------------------------------------------------------------$( RESET_STYLES) "
4446
4547
46- lint : # : Run static analysis with black, flake8, pylint, bandit and mypy
48+ setup : # : Use pip-tools, pip-compile, pip install
49+ @echo " $( BOLD_CYAN) Setting up pyflask base$( RESET_STYLES) "
50+ # Check for venv, conda else exit
51+ @echo " $( BOLD_CYAN) Installing pip-tools . . .$( RESET_STYLES) "
52+ pip install pip-tools
53+ @echo " $( BOLD_CYAN) Generating requirements$( RESET_STYLES) "
54+ pip-compile -q --build-isolation --output-file=requirements/requirements.txt requirements/requirements.in
55+ @echo " $( BOLD_CYAN) Generating dev requirements$( RESET_STYLES) "
56+ pip-compile -q --build-isolation --output-file=requirements/dev-requirements.txt requirements/dev-requirements.in
57+ @echo " $( BOLD_CYAN) Syncing requirements$( RESET_STYLES) "
58+ pip-sync -q requirements/requirements.txt requirements/dev-requirements.txt
59+ @echo " $( BOLD_CYAN) Installing requirements$( RESET_STYLES) "
60+ pip install -r requirements/requirements.txt
61+ @echo " $( BOLD_CYAN) Installing dev requirements$( RESET_STYLES) "
62+ pip install -r requirements/dev-requirements.txt
63+
64+
65+ format : # : Format and fix python code with black, isort, autoflake
4766 @echo " $( BOLD_CYAN) Blackifying $( RESET_STYLES) 🍳"
67+ black --version
4868 black $(APP_DIR ) $(TEST_DIR ) $(HOME_DIR_PY_FILES )
4969 @echo " $( BOLD_CYAN) ISorting 〽️$( RESET_STYLES) ️"
5070 isort --recursive $(APP_DIR ) $(TEST_DIR ) $(HOME_DIR_PY_FILES )
5171 @echo " $( BOLD_CYAN) Flaking️❄️$( RESET_STYLES) "
72+ flake8 --version
73+ autoflake --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys --ignore-init-module-imports -i -r $(APP_DIR ) $(TEST_DIR ) $(HOME_DIR_PY_FILES )
74+
75+
76+ lint : # : Run static analysis with flake8, bandit and mypy
77+ @echo " $( BOLD_CYAN) Flake linting ❄️$( RESET_STYLES) "
78+ flake8 --version
5279 flake8 $(APP_DIR ) $(TEST_DIR ) $(HOME_DIR_PY_FILES )
53- @echo " $( BOLD_CYAN) Securing️🕵️️$( RESET_STYLES) "
80+ @echo " $( BOLD_CYAN) Securing with bandit️🕵️️$( RESET_STYLES) "
81+ bandit --version
5482 bandit -l -i -r . --format=custom
5583
0 commit comments