HomeOmer Oo

Helpful Makefile

A helpful Makefile for your next team project

  • #gnumake
  • #documentation

A makefile with the help recipe:

Makefile
.PHONY: help

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

setup-conda:
	conda env create --name foo --file environment.yml

setup-base:
	conda install --file requirements.dev.txt
	pre-commit install

activate: ## activate conda env
	conda activate foo

setup: setup-conda setup-base ## installs python and pip dependencies

build: ## build docker container
	docker build .

run: ## run service natively
	cd src && conda run --no-capture-output uvicorn fastapi_app:app --host 0.0.0.0 --port 8088

Running `make help` will produce the following output:

$ make help
activate                       activate conda env
build                          build docker container
run                            run service natively
setup                          installs python and pip dependencies

Tweet this snippet

Edit on github

Omer Oo

Software engineer passionate about building the next big thing