This repository has been archived by the owner on Aug 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·117 lines (101 loc) · 2.42 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
.DEFAULT_GOAL := all
PKG_NAME := $(shell cat pyproject.toml | grep name | awk '{print $$3}' | sed 's/"//g')
PWD_DIRPATH = .
TESTS_DIRPATH = ${PWD}/tests
isort = isort -rc -sp pyproject.toml src tests
black = black -S -l 88 src tests
nbs = $(wildcard *.ipynb)
mds = $(nbs:%.ipynb=%.md)
pys = $(wildcard *.py)
#
all: install
.PHONY: fmt flake mypy test testcov testlf doctest clean
.PHONY: install
install:
### MIGHT HAVE TO INSTALL POETRY
# pip install poetry
### NO CREATE ENV
#python -m poetry config virtualenvs.create false
python -m poetry install
###########################################
### LINTING, FORMATTING & TYPE CHECKING ###
###########################################
## FORMATTING
.PHONY: fmt
fmt:
$(isort)
$(black)
## LINTING
.PHONY: flake
flake: fmt
python -m flake8 --config=./.flake8 $(PKG_NAME)
python -m flake8 --config=./.flake8 tests
## TYPE CHECKING
.PHONY: mypy
mypy:
mypy --config-file mypy.ini $(PKG_NAME)
###############
### TESTING ###
###############
.PHONY:test
test:
pytest --doctest-modules tests $(PKG_NAME)
.PHONY:testcov
testcov:
pytest --cov=dgpy_pkg --doctest-modules tests $(PKG_NAME)
.PHONY:testlf
testlf:
pytest --doctest-modules --lf tests $(PKG_NAME)
.PHONY:doctest
doctest:
pytest --doctest-modules $(PKG_NAME)
.PHONY:doctestcov
doctestcov:
pytest --cov=src/dgpy --doctest-modules $(PKG_NAME)
###########
## CLEAN ##
###########
.PHONY: clean
clean:
rm -rfv dist || true
rm -rfv build || true
# rm -rfv docs/docs_sphinx/_build/ || true
rm -rfv site || true
#
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -rf .cache
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf htmlcov
rm -rf *.egg-info
rm -f .coverage
rm -f .coverage.*
rm -rf build
rm -rf dist
# python setup.py clean
rm -rf site
#rm -rf docs/_build
rm -rf .nox
rm -rf .nox_*
#############
### BUILD ###
#############
.PHONY:requirements
reqs:
@poetry export --without-hashes -o requirements.txt -f requirements.txt
@poetry export --without-hashes --dev -o requirements-dev.txt -f requirements.txt
.PHONY: build
build:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -rf *.egg-info
rm -rfv dist.bak || true
mv dist dist.bak || true
python -m poetry build -f wheel
mv -f dist.bak/* dist
rm -rfv dist.bak || true