Skip to content

Commit

Permalink
🐂 Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
arv-anshul committed Jan 18, 2024
1 parent da4db41 commit f943bea
Showing 1 changed file with 2 additions and 49 deletions.
51 changes: 2 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,11 @@ PACKAGE_NAME := $(shell pwd) # works for (mac | linux)
.DEFAULT_GOAL := help

# UPDATE ME
PYTHON = python3
PYTHON_VENV = .venv
MAX_LINE_LENGTH = 88 # Variable for formatters

define PRINT_HELP_PYSCRIPT
import re, sys

class Style:
BLACK = '\033[30m'
BLUE = '\033[34m'
BOLD = '\033[1m'
CYAN = '\033[36m'
GREEN = '\033[32m'
MAGENTA = '\033[35m'
RED = '\033[31m'
WHITE = '\033[37m'
YELLOW = '\033[33m'
ENDC = '\033[0m'

print(f"{Style.BOLD}Please use `make <target>` where <target> is one of{Style.ENDC}")
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if line.startswith("# -------"):
print(f"\n{Style.RED}{line}{Style.ENDC}")
if match:
target, help_msg = match.groups()
if not target.startswith('--'):
print(f"{Style.BOLD+Style.GREEN}{target:20}{Style.ENDC} - {help_msg}")
endef

export PRINT_HELP_PYSCRIPT


# If you want a specific Python interpreter define it as an envvar
# $ export PYTHON_ENV=
ifdef PYTHON_ENV
PYTHON := $(PYTHON_ENV)
else
PYTHON := python3
endif

help:
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
$(PYTHON) <(curl -sSL https://gist.githubusercontent.com/arv-anshul/84a87b6ac9b15f51b9b8d0cdeda33f5f/raw/f48d6fa8d2e5e5769af347e8baa2677cc254c5c6/make_help_decorator.py)

# -------------------------------- Builds and Installations -----------------------------

Expand Down Expand Up @@ -101,16 +64,6 @@ clean-test: ## Remove test and coverage artefacts
rm -rf htmlcov/
rm -rf .pytest_cache

# -------------------------------------- Code Style -------------------------------------

lint: ## Check style with `flake8` and `mypy`
@$(PYTHON) -m flake8 --max-line-length $(MAX_LINE_LENGTH) $(PACKAGE_NAME)
$(PYTHON) -m mypy

formatter: ## Format style with `black` and sort imports with `isort`
@isort . -m 3 --profile black -l $(MAX_LINE_LENGTH)
black . -l $(MAX_LINE_LENGTH)

# ---------------------------------- Git Hooks ------------------------------------------

install-hooks: .configs/.pre-commit-config.yaml ## Install `pre-commit-hooks` on local directory [see: https://pre-commit.com]
Expand Down

0 comments on commit f943bea

Please sign in to comment.