-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
115 lines (92 loc) · 2.86 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
###############################################################################
# Common make values.
lib := tinboard
run := pipenv run
python := $(run) python
lint := $(run) pylint
mypy := $(run) mypy
twine := $(run) twine
build := $(python) -m build
black := $(run) black
##############################################################################
# Run the app.
.PHONY: run
run:
$(python) -m $(lib) --filter public
.PHONY: debug
debug:
TEXTUAL=devtools make
.PHONY: console
console:
$(run) textual console
##############################################################################
# Setup/update packages the system requires.
.PHONY: setup
setup: # Install all dependencies
pipenv sync --dev
$(run) pre-commit install
.PHONY: resetup
resetup: # Recreate the virtual environment from scratch
rm -rf $(shell pipenv --venv)
pipenv sync --dev
.PHONY: depsoutdated
depsoutdated: # Show a list of outdated dependencies
pipenv update --outdated
.PHONY: depsupdate
depsupdate: # Update all dependencies
pipenv update --dev
.PHONY: depsshow
depsshow: # Show the dependency graph
pipenv graph
##############################################################################
# Checking/testing/linting/etc.
.PHONY: lint
lint: # Run Pylint over the library
$(lint) $(lib)
.PHONY: typecheck
typecheck: # Perform static type checks with mypy
$(mypy) --scripts-are-modules $(lib)
.PHONY: stricttypecheck
stricttypecheck: # Perform a strict static type checks with mypy
$(mypy) --scripts-are-modules --strict $(lib)
.PHONY: checkall
checkall: lint stricttypecheck # Check all the things
##############################################################################
# Package/publish.
.PHONY: package
package: # Package the library
$(build) -w
.PHONY: spackage
spackage: # Create a source package for the library
$(build) -s
.PHONY: packagecheck
packagecheck: package spackage # Check the packaging.
$(twine) check dist/*
.PHONY: testdist
testdist: packagecheck # Perform a test distribution
$(twine) upload --skip-existing --repository testpypi dist/*
.PHONY: dist
dist: packagecheck # Upload to pypi
$(twine) upload --skip-existing dist/*
##############################################################################
# Utility.
.PHONY: ugly
ugly: # Reformat the code with black.
$(black) $(lib)
.PHONY: repl
repl: # Start a Python REPL
$(python)
.PHONY: clean
clean: # Clean the build directories
rm -rf build dist $(lib).egg-info
.PHONY: help
help: # Display this help
@grep -Eh "^[a-z]+:.+# " $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.+# "}; {printf "%-20s %s\n", $$1, $$2}'
##############################################################################
# Housekeeping tasks.
.PHONY: housekeeping
housekeeping: # Perform some git housekeeping
git fsck
git gc --aggressive
git remote update --prune
### Makefile ends here