forked from rudymatela/python-leancheck
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (72 loc) · 2.23 KB
/
Makefile
File metadata and controls
104 lines (72 loc) · 2.23 KB
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
# Makefile for python-leancheck
#
# (C) 2023-2025 Rudy Matela
# Distributed under the LGPL v2.1 or later (see the file LICENSE)
# Sets the number of jobs to the the number of processors minus one.
NJOBS := $(shell grep ^processor /proc/cpuinfo | head -n -1 | wc -l | sed 's/^0$$/1/')
all: run
repl:
PYTHONPATH=src python -ic 'import leancheck; from leancheck import *; from leancheck.iitertools import *'
test: run pytest mypy diff-test
pytest:
pytest
mypy:
mypy src/ tests/ examples/
lint:
black -l99 src/ tests/ examples/ --check
black:
black -l99 src/ tests/ examples/
validate-pyproject:
validate-pyproject pyproject.toml
doc:
PYTHONPATH=src pdoc --footer="`poetry version`" leancheck -o docs
opendoc: doc
wbi docs/index.html
run: $(patsubst %.py,%.run, $(wildcard src/leancheck/*.py))
.PHONY: examples
examples: $(patsubst %.py,%.run, $(wildcard examples/*.py))
txt: $(patsubst %.py,%.txt, $(wildcard examples/*.py))
diff-test: $(patsubst %.py,%.diff,$(wildcard examples/*.py))
clean:
rm -rf __pycache__ src/__pycache__ tests/__pycache__ .pytest_cache .mypy_cache
rm -rf docs/ dist/ tmp/ src/leancheck.egg-info
fastest:
make test -j$(NJOBS)
release:
cat release.md
# Generates a distribution archive for PyPI
#
# See: https://packaging.python.org/en/latest/tutorials/packaging-projects/
#
# Needed: python-setuptools; twine
.PHONY: dist
dist:
python -m build
upload-test: dist
twine upload --skip-existing --repository testpypi dist/*
test-install:
rm -rf tmp/test-install
mkdir -p tmp/test-install
python -m venv tmp/test-install
source tmp/test-install/bin/activate && \
pip install --index-url https://test.pypi.org/simple/ --no-deps leancheck && \
python -ic 'from leancheck import *; print("run check(lambda x: x * x > x, int)")'
upload-for-real-this-time: dist
echo 'Uploading for real in PyPI in 6 seconds (Ctrl-C to abort)'
sleep 6
twine upload --skip-existing dist/*
# alias to dist
sdist: dist
clone-docs:
rm -rf docs
git clone git@github.com:leancheck/leancheck.github.io.git docs
pull-docs:
git -C docs pull
%.run: %.py
PYTHONPATH=src python $<
%.repl: %.py
PYTHONPATH=src python -i $<
%.txt: %.py
PYTHONPATH=src python $< >$@
%.diff: %.py
PYTHONPATH=src python $< | diff -rud $*.txt -