Created
May 12, 2021 14:22
-
-
Save jcaxmacher/185236ee92e805f8eb48796f69941bf4 to your computer and use it in GitHub Desktop.
Python Project Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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