-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
118 lines (95 loc) · 3.08 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
#############################################################################
# Common make values.
.DEFAULT_GOAL := help
package := textual_dev
run := poetry run
python := $(run) python
pytest := $(run) pytest
lint := $(run) pylint
mypy := $(run) mypy
black := $(run) black
isort := $(run) isort
textual := $(python) -m $(package)
##############################################################################
# Setup/update/repo admin targets.
.PHONY: setup
setup: # Set up the development environment for the tool
poetry install
$(run) pre-commit install
.PHONY: relock
relock: # Rebuild the lock file.
poetry lock
.PHONY: update
update: # Update the development environment
poetry update
##############################################################################
# Reformatting tools.
.PHONY: black
black: # Run black over the code
$(black) src/$(package) tests/
.PHONY: isort
isort: # Run isort over the code
$(isort) --profile black src/$(package)
.PHONY: reformat
reformat: isort black # Run all the formatting tools over the code
##############################################################################
# Checking/testing/linting/etc.
.PHONY: lint
lint: # Run Pylint over the library
$(lint) src/$(package)
.PHONY: typecheck
typecheck: # Perform static type checks with mypy
$(mypy) --scripts-are-modules src/$(package)
.PHONY: stricttypecheck
stricttypecheck: # Perform strict static type checks with mypy
$(mypy) --scripts-are-modules --strict src/$(package)
.PHONY: test
test: # Run the unit tests.
$(pytest) tests/
.PHONY: checkall
checkall: lint stricttypecheck test # Check all the things
##############################################################################
# The main interfaces for the package (for easy in-development testing).
.PHONY: textual
textual: # Show the help for the textual command.
$(textual)
.PHONY: borders
borders: # Show the Textual borders preview.
$(textual) borders
.PHONY: colors
colors: # Show the Textual colours preview.
$(textual) colors
.PHONY: console
console: # Run the textual console
$(textual) console
.PHONY: diagnose
diagnose: # Run the Textual diagnosis tool.
$(textual) diagnose
.PHONY: easing
easing: # Run the Textual easing preview.
$(textual) easing
.PHONY: keys
keys: # Run the Textual keys tool.
$(textual) keys
.PHONY: run
run: # Test the textual run command.
$(textual) run
##############################################################################
# Utility.
.PHONY: repl
repl: # Start a Python REPL
$(python)
.PHONY: shell
shell: # Create a shell within the virtual environment
poetry shell
.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 prune origin
git remote update --prune