This repository was archived by the owner on Nov 26, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.87 KB
/
Makefile
File metadata and controls
61 lines (47 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
PYTHON_BINARY := python3
VIRTUAL_BIN := venv/bin
PROJECT_NAME := diff_tool
## help - Display help about make targets for this Makefile
help:
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t
## build - Builds the project in preparation for release
build:
$(PYTHON_BINARY) setup.py sdist bdist_wheel
## coverage - Test the project and generate an HTML coverage report
coverage:
$(VIRTUAL_BIN)/pytest --cov=$(PROJECT_NAME) --cov-branch --cov-report=html --cov-report=term-missing
## clean - Remove the virtual environment and clear out .pyc files
clean:
rm -rf ~/.venv/$(PROJECT_NAME)/ venv
find . -name '*.pyc' -delete
rm -rf dist
rm -rf build
rm -rf *.egg-info
## black - Runs the Black Python formatter against the project
black:
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ test/
## black-check - Checks if the project is formatted correctly against the Black rules
black-check:
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ test/ --check
## format - Runs all formatting tools against the project
format: black isort lint
## format-check - Checks if the project is formatted correctly against all formatting rules
format-check: black-check isort-check lint
## install - Install the project locally
install:
$(PYTHON_BINARY) -m venv ~/.venv/$(PROJECT_NAME)/
ln -snf ~/.venv/$(PROJECT_NAME)/ venv
$(VIRTUAL_BIN)/pip install -e ."[dev]"
## isort - Sorts imports throughout the project
isort:
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ test/
## isort-check - Checks that imports throughout the project are sorted correctly
isort-check:
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ test/ --check-only
## lint - Lint the project
lint:
$(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ test/
## test - Test the project
test:
$(VIRTUAL_BIN)/pytest
.PHONY: help build coverage clean black black-check format format-check install isort isort-check lint test