-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
103 lines (82 loc) · 2.69 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
app := pispy
src := src/
run := rye run
python := $(run) python
lint := rye lint -- --select I
fmt := rye fmt
mypy := $(run) mypy
##############################################################################
# Local "interactive testing" of the code.
.PHONY: run
run: # Run the code in a testing context
$(python) -m $(app)
##############################################################################
# Setup/update packages the system requires.
.PHONY: setup
setup: # Set up the repository for development
rye sync
$(run) pre-commit install
.PHONY: resetup
resetup: # Recreate the virtual environment from scratch
rm -rf .venv
make setup
##############################################################################
# Checking/testing/linting/etc.
.PHONY: lint
lint: # Check the code for linting issues
$(lint) $(src)
.PHONY: codestyle
codestyle: # Is the code formatted correctly?
$(fmt) --check $(src)
.PHONY: typecheck
typecheck: # Perform static type checks with mypy
$(mypy) --scripts-are-modules $(src)
.PHONY: stricttypecheck
stricttypecheck: # Perform a strict static type checks with mypy
$(mypy) --scripts-are-modules --strict $(src)
.PHONY: checkall
checkall: codestyle lint stricttypecheck # Check all the things
##############################################################################
# Package/publish.
.PHONY: package
package: # Package the library
rye build
.PHONY: spackage
spackage: # Create a source package for the library
rye build --sdist
.PHONY: testdist
testdist: package # Perform a test distribution
rye publish --yes --skip-existing --repository testpypi --repository-url https://test.pypi.org/legacy/
.PHONY: dist
dist: package # Upload to pypi
rye publish --yes --skip-existing
##############################################################################
# Utility.
.PHONY: repl
repl: # Start a Python REPL in the venv.
$(python)
.PHONY: updatedeps
updatedeps: # Update all dependencies
rye sync --update-all
.PHONY: delint
delint: # Fix linting issues.
$(lint) --fix $(src)
.PHONY: pep8ify
pep8ify: # Reformat the code to be as PEP8 as possible.
$(fmt) $(src)
.PHONY: tidy
tidy: delint pep8ify # Tidy up the code, fixing lint and format issues.
.PHONY: clean
clean: # Clean the build directories
rm -rf dist
.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