-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
144 lines (96 loc) · 3.35 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
134
135
136
137
138
139
140
141
142
143
144
.PHONY: build docs
_: check test
# Development Environment Setup
pip: # Upgrade pip
python -m pip install --upgrade pip
# # [Un]Install Package
install: pip # Install package
python -m pip install .
install-dev: pip # Install package in develop/editable mode
python -m pip install -e .
uninstall: pip # Uninstall package
python -m pip uninstall --yes term-image
# # Install Dev/Doc Dependencies
req: pip # Install dev dependencies
python -m pip install --upgrade -r requirements.txt
req-doc: pip # Install doc dependencies
python -m pip install --upgrade -r docs/requirements.txt
req-all: req req-doc
# # Install Dev/Doc Dependencies and Package
dev: req install-dev
dev-doc: req-doc install-dev
dev-all: req-all install-dev
# Pre-commit Checks and Corrections
check: check-code
py_files := src/ docs/source/conf.py tests/
## Code Checks
check-code: lint type check-format check-imports
lint:
flake8 $(py_files) && echo
type:
mypy src/term_image && echo
check-format:
black --check --diff --color $(py_files) && echo
check-imports:
isort --check --diff --color $(py_files) && echo
## Code Corrections
format:
black $(py_files)
imports:
isort $(py_files)
# Tests
pytest := pytest -v -r a
## Filepath variables
test-top-level := tests/test_top_level.py
test-color := tests/test_color.py
test-geometry := tests/test_geometry.py
test-padding := tests/test_padding.py
test-renderable-renderable := tests/renderable/test_renderable.py
test-renderable-types := tests/renderable/test_types.py
test-render-iterator := tests/render/test_iterator.py
test-base := tests/test_image/test_base.py
test-block := tests/test_image/test_block.py
test-kitty := tests/test_image/test_kitty.py
test-iterm2 := tests/test_image/test_iterm2.py
test-url := tests/test_image/test_url.py
test-others := tests/test_image/test_others.py
test-iterator := tests/test_iterator.py
test-widget-urwid-main := tests/widget/urwid/test_main.py
test-widget-urwid-screen := tests/widget/urwid/test_screen.py
test-renderable := $(test-renderable-renderable) $(test-renderable-types)
test-render := $(test-render-iterator)
test-text := $(test-block)
test-graphics := $(test-kitty) $(test-iterm2)
test-image := $(test-base) $(test-text) $(test-graphics) $(test-others)
test-widget-urwid := $(test-widget-urwid-main) $(test-widget-urwid-screen)
test-widget := $(test-widget-urwid)
test := $(test-top-level) $(test-color) $(test-geometry) $(test-padding) $(test-renderable) $(test-render) $(test-image) $(test-iterator) $(test-widget)
test-all := $(test) $(test-url)
## Targets
test-top-level \
test-color \
test-geometry \
test-padding \
test-renderable test-renderable-renderable test-renderable-types \
test-render test-render-iterator \
test-image test-base test-text test-graphics test-block test-kitty test-iterm2 test-url test-others test-iterator \
test-widget test-widget-urwid test-widget-urwid-main test-widget-urwid-screen \
test test-all:
$(pytest) $($@)
test-cov:
$(pytest) --cov --cov-append --cov-report=term --cov-report=html $(test)
test-all-cov:
$(pytest) --cov --cov-report=term --cov-report=html $(test-all)
test-%-cov:
$(pytest) --cov --cov-append --cov-report=term --cov-report=html $(test-$*)
# Building the Docs
docs:
cd docs/ && make html
clean-docs:
cd docs/ && make clean
# Packaging
build: pip
python -m pip install --upgrade build
python -m build
clean:
rm -rf build dist