generated from BastiTee/python-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
133 lines (103 loc) · 3.14 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Required executables
ifeq (, $(shell which python3))
$(error "No python3 on PATH.")
endif
ifeq (, $(shell which pipenv))
$(error "No pipenv on PATH.")
endif
export PYTHON_VERSION=$(shell cat .python-version| tr -d "[:space:]")
# shut up please
export PIPENV_QUIET=1
# Use relative .venv folder instead of home-folder based
export PIPENV_VENV_IN_PROJECT=1
# Ignore existing venvs
export PIPENV_IGNORE_VIRTUALENVS=1
# Make sure we are running with an explicit encoding
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
# Set configuration folder to venv
export PYPE_CONFIG_FOLDER=$(shell pwd)/.venv/.pype-cli
export DISABLE_LOG_LEVEL=INFO
# Process variables
PY_FILES := key_set tests
all: clean venv build
venv: clean
@echo Initialize virtualenv, i.e., install required packages etc.
pipenv install --dev --python $(PYTHON_VERSION)
clean:
@echo Clean project base
find . -type d \
-name ".venv" -o \
-name ".tox" -o \
-name ".ropeproject" -o \
-name ".mypy_cache" -o \
-name ".pytest_cache" -o \
-name "__pycache__" -o \
-iname "*.egg-info" -o \
-name "build" -o \
-name "dist" \
|xargs rm -rfv
find . -type f \
-name "pyproject.toml" -o \
-name "Pipfile.lock" \
|xargs rm -rfv
shell:
@echo Initialize virtualenv and open a new shell using it
pipenv shell
outdated:
@echo Show outdated packages
pipenv update --outdated --dev --dry-run --bare
update:
@echo Update all libs that can be updated
pipenv update
graph:
@echo show the dependencies graph
pipenv graph
test:
@echo Run all tests in default virtualenv
pipenv run py.test tests
testall:
@echo Run all tests against all virtualenvs defined in tox.ini
pipenv run tox -c setup.cfg tests
isort:
@echo Check for incorrectly sorted imports
pipenv run isort --profile black --check-only $(PY_FILES)
isort-apply:
@echo Check for incorrectly sorted imports
pipenv run isort --profile black $(PY_FILES)
mypy:
@echo Run static code checks against source code base
pipenv run mypy key_set
pipenv run mypy tests
black:
@echo Run black on src and complain about issues
pipenv run black $(PY_FILES) --check
black-apply:
@echo Run black on src and fix any issues that it can
pipenv run black $(PY_FILES)
lint: isort black
@echo Run code formatting checks against source code base
pipenv run flake8 key_set tests
lint-apply: isort-apply black-apply
@echo Run code formatting checks against source code base
pipenv run flake8 key_set tests
build: test mypy isort lint
@echo Run setup.py-based build process to package application
pipenv run python setup.py bdist_wheel
bump:
@echo Bump version and change CHANGELOG
npx standard-version
publish: all
@echo Release to pypi.org
pipenv run twine upload dist/*
run:
@echo Execute key_set directly
pipenv run python -m key_set
fetch-latest-boilerplate:
@echo Fetch latest python3-boilerplate version from github
git remote add py3template git@github.com:BastiTee/python3-boilerplate.git \
||true
git pull py3template master --allow-unrelated-histories ||true
@echo ----------------------------------------------------
@echo Resolve all merge conflicts and commit your changes!
@echo ----------------------------------------------------