Skip to content

Instantly share code, notes, and snippets.

@jcaxmacher
Created May 12, 2021 14:22
Show Gist options
  • Save jcaxmacher/185236ee92e805f8eb48796f69941bf4 to your computer and use it in GitHub Desktop.
Save jcaxmacher/185236ee92e805f8eb48796f69941bf4 to your computer and use it in GitHub Desktop.
Python Project Makefile
# system python interpreter. used only to create virtual environment
PY = python3
VENV = venv
BIN=$(VENV)/bin
# make it work on windows too
ifeq ($(OS), Windows_NT)
BIN=$(VENV)/Scripts
PY=python
endif
all: lint test
$(VENV): requirements.txt requirements-dev.txt setup.py
$(PY) -m venv $(VENV)
$(BIN)/pip install --upgrade -r requirements.txt
$(BIN)/pip install --upgrade -r requirements-dev.txt
$(BIN)/pip install -e .
touch $(VENV)
.PHONY: test
test: $(VENV)
$(BIN)/pytest
.PHONY: lint
lint: $(VENV)
$(BIN)/flake8
.PHONY: release
release: $(VENV)
$(BIN)/python setup.py sdist bdist_wheel upload
clean:
rm -rf $(VENV)
find . -type f -name *.pyc -delete
find . -type d -name __pycache__ -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment