Skip to content

Instantly share code, notes, and snippets.

@timhughes
Last active March 29, 2022 10:33
Show Gist options
  • Save timhughes/79f29c8704a251a2b70e266ce091731d to your computer and use it in GitHub Desktop.
Save timhughes/79f29c8704a251a2b70e266ce091731d to your computer and use it in GitHub Desktop.
Python Makefile
#
# vim:ft=make
# Makefile
#
.DEFAULT_GOAL := help
.PHONY: test help
_GREEN=$(shell tput setaf 2)
_BLUE=$(shell tput setaf 4)
_RED=$(shell tput setaf 1)
_RESET=$(shell tput sgr0)
_BOLD=$(shell tput bold)
help: ## these help instructions
@sed -rn 's/^([a-zA-Z0-9_-]+):.* ## (.*)$$/"\1" "\2"/p' < $(MAKEFILE_LIST)|xargs printf "$(_GREEN)make %-20s$(_RESET) # %s\n"
hidden: # undocumented, single '#' allows for comments on internal usage only tasks
@true
install: ## Runs poetry install
poetry install
lint: ## Runs bandit and black in check mode
poetry run black . --check --target-version=py36
poetry run bandit -r src
format: ## Formats you code with Black
poetry run black . --target-version=py36
test: hidden ## run pytest with coverage
poetry run pytest --cov test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment