1
- # Project settings
2
- PROJECT := minilog
3
1
PACKAGE := log
4
- REPOSITORY := jacebrowning/minilog
5
-
6
- # Project paths
7
- PACKAGES := $(PACKAGE ) tests
8
- CONFIG := $(wildcard * .py)
9
2
MODULES := $(wildcard $(PACKAGE ) /* .py)
10
3
11
- # Virtual environment paths
12
- VIRTUAL_ENV ?= .venv
13
-
14
4
# MAIN TASKS ##################################################################
15
5
16
6
.PHONY : all
17
7
all : install
18
8
19
9
.PHONY : ci
20
- ci : format check test-repeat mkdocs # # Run all tasks that determine CI status
10
+ ci : format check test mkdocs # # Run all tasks that determine CI status
21
11
22
12
.PHONY : watch
23
13
watch : install .clean-test # # Continuously run all CI tasks when files chanage
24
14
poetry run sniffer
25
15
26
- .PHONY : run # # Start the program
27
- run : install
16
+ .PHONY : run
17
+ run : install # # Start the program
28
18
poetry run python $(PACKAGE ) /__main__.py
29
19
30
- .PHONY : ipython # # Launch an IPython session
31
- ipython : install
20
+ .PHONY : shell
21
+ shell : install # # Launch an IPython session
32
22
poetry run ipython --ipython-dir=notebooks
33
23
34
24
# SYSTEM DEPENDENCIES #########################################################
@@ -39,19 +29,21 @@ doctor: ## Confirm system dependencies are available
39
29
40
30
# PROJECT DEPENDENCIES ########################################################
41
31
32
+ VIRTUAL_ENV ?= .venv
42
33
DEPENDENCIES := $(VIRTUAL_ENV ) /.poetry-$(shell bin/checksum pyproject.toml poetry.lock)
43
34
44
35
.PHONY : install
45
36
install : $(DEPENDENCIES ) .cache
46
37
47
38
$(DEPENDENCIES ) : poetry.lock
39
+ @ rm -rf $(VIRTUAL_ENV ) /.poetry-*
48
40
@ poetry config virtualenvs.in-project true
49
41
poetry install
50
42
@ touch $@
51
43
52
44
ifndef CI
53
45
poetry.lock : pyproject.toml
54
- poetry lock
46
+ poetry lock --no-update
55
47
@ touch $@
56
48
endif
57
49
@@ -62,18 +54,18 @@ endif
62
54
63
55
.PHONY : format
64
56
format : install
65
- poetry run isort $(PACKAGES ) notebooks
66
- poetry run black $(PACKAGES ) notebooks
57
+ poetry run isort $(PACKAGE ) tests notebooks
58
+ poetry run black $(PACKAGE ) tests notebooks
67
59
@ echo
68
60
69
61
.PHONY : check
70
62
check : install format # # Run formaters, linters, and static analysis
71
63
ifdef CI
72
64
git diff --exit-code
73
65
endif
74
- poetry run mypy $(PACKAGES) --config-file=.mypy.ini
75
- poetry run pylint $(PACKAGES) --rcfile=.pylint.ini
76
- poetry run pydocstyle $(PACKAGES) $(CONFIG)
66
+ poetry run mypy $(PACKAGE) tests --config-file=.mypy.ini
67
+ poetry run pylint $(PACKAGE) tests --rcfile=.pylint.ini
68
+ poetry run pydocstyle $(PACKAGE) tests
77
69
78
70
# TESTS #######################################################################
79
71
@@ -94,25 +86,30 @@ test-unit: install
94
86
@ ( mv $( FAILURES) $( FAILURES) .bak || true ) > /dev/null 2>&1
95
87
poetry run pytest $(PACKAGE ) $(PYTEST_OPTIONS )
96
88
@ ( mv $( FAILURES) .bak $( FAILURES) || true ) > /dev/null 2>&1
97
- poetry run coveragespace $(REPOSITORY ) unit
89
+ ifndef DISABLE_COVERAGE
90
+ poetry run coveragespace update unit
91
+ endif
98
92
99
93
.PHONY : test-int
100
94
test-int : install
101
95
@ if test -e $( FAILURES) ; then poetry run pytest tests $( PYTEST_RERUN_OPTIONS) ; fi
102
96
@ rm -rf $(FAILURES )
103
97
poetry run pytest tests $(PYTEST_OPTIONS )
104
- poetry run coveragespace $(REPOSITORY ) integration
98
+ ifndef DISABLE_COVERAGE
99
+ poetry run coveragespace update integration
100
+ endif
105
101
106
102
.PHONY : test-all
107
103
test-all : install
108
- @ if test -e $( FAILURES) ; then poetry run pytest $( PACKAGES ) $( PYTEST_RERUN_OPTIONS) ; fi
104
+ @ if test -e $( FAILURES) ; then poetry run pytest $( PACKAGE ) tests $( PYTEST_RERUN_OPTIONS) ; fi
109
105
@ rm -rf $(FAILURES )
110
- poetry run pytest $(PACKAGES ) $(PYTEST_OPTIONS )
111
- poetry run coveragespace $(REPOSITORY ) overall
106
+ poetry run pytest $(PACKAGE ) tests $(PYTEST_OPTIONS )
107
+ ifndef DISABLE_COVERAGE
108
+ poetry run coveragespace update overall
109
+ endif
112
110
113
111
.PHONY : test-repeat
114
112
test-repeat : install
115
- @ rm -rf $(FAILURES )
116
113
poetry run pytest $(PACKAGES ) $(PYTEST_OPTIONS ) --count=5 --exitfirst
117
114
118
115
.PHONY : test-profile
@@ -134,6 +131,7 @@ docs: mkdocs uml ## Generate documentation and UML
134
131
mkdocs : install $(MKDOCS_INDEX )
135
132
$(MKDOCS_INDEX ) : docs/requirements.txt mkdocs.yml docs/* .md
136
133
@ mkdir -p docs/about
134
+ @ cd docs && ln -sf ../README.md index.md
137
135
@ cd docs/about && ln -sf ../../CHANGELOG.md changelog.md
138
136
@ cd docs/about && ln -sf ../../CONTRIBUTING.md contributing.md
139
137
@ cd docs/about && ln -sf ../../LICENSE.md license.md
@@ -158,7 +156,7 @@ mkdocs-serve: mkdocs
158
156
# BUILD #######################################################################
159
157
160
158
DIST_FILES := dist/*.tar.gz dist/*.whl
161
- EXE_FILES := dist/$(PROJECT ) .*
159
+ EXE_FILES := dist/$(PACKAGE ) .*
162
160
163
161
.PHONY : dist
164
162
dist : install $(DIST_FILES )
@@ -168,20 +166,20 @@ $(DIST_FILES): $(MODULES) pyproject.toml
168
166
169
167
.PHONY : exe
170
168
exe : install $(EXE_FILES )
171
- $(EXE_FILES ) : $(MODULES ) $(PROJECT ) .spec
169
+ $(EXE_FILES ) : $(MODULES ) $(PACKAGE ) .spec
172
170
# For framework/shared support: https://github.com/yyuu/pyenv/wiki
173
- poetry run pyinstaller $(PROJECT ) .spec --noconfirm --clean
171
+ poetry run pyinstaller $(PACKAGE ) .spec --noconfirm --clean
174
172
175
- $(PROJECT ) .spec :
176
- poetry run pyi-makespec $(PACKAGE ) /__main__.py --onefile --windowed --name=$(PROJECT )
173
+ $(PACKAGE ) .spec :
174
+ poetry run pyi-makespec $(PACKAGE ) /__main__.py --onefile --windowed --name=$(PACKAGE )
177
175
178
176
# RELEASE #####################################################################
179
177
180
178
.PHONY : upload
181
179
upload : dist # # Upload the current version to PyPI
182
180
git diff --name-only --exit-code
183
181
poetry publish
184
- bin/open https://pypi.org/project/$(PROJECT )
182
+ bin/open https://pypi.org/project/$(PACKAGE )
185
183
186
184
# CLEANUP #####################################################################
187
185
@@ -194,7 +192,7 @@ clean-all: clean
194
192
195
193
.PHONY : .clean-install
196
194
.clean-install :
197
- find $(PACKAGES ) -name ' __pycache__' -delete
195
+ find $(PACKAGE ) tests -name ' __pycache__' -delete
198
196
rm -rf * .egg-info
199
197
200
198
.PHONY : .clean-test
0 commit comments