-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
makefile
127 lines (104 loc) · 3.22 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
SHELL = /usr/bin/env bash
PANTABLELOGLEVEL ?= DEBUG
python ?= python
_python = PANTABLELOGLEVEL=$(PANTABLELOGLEVEL) $(python)
pandoc ?= pandoc
_pandoc = PANTABLELOGLEVEL=$(PANTABLELOGLEVEL) $(pandoc)
PYTESTARGS ?= --workers auto
# for bump2version, valid options are: major, minor, patch
PART ?= patch
pandocArgs = --toc -M date="`date "+%B %e, %Y"`" --filter=pantable --wrap=none
RSTs = CHANGELOG.rst README.rst
# Main Targets #################################################################
.PHONY: test docs-all docs html epub files dot clean Clean
all: dot files editable
$(MAKE) test docs-all
test:
$(_python) \
-m coverage run \
-m pytest -vv $(PYTESTARGS) tests
coverage: test
coverage combine
coverage report
coverage html
docs-all: docs html epub
docs: $(RSTs)
html: dist/docs/
epub: dist/epub/pantable.epub
files:
cd tests/files; $(MAKE)
dot:
cd docs/dot; $(MAKE)
clean:
rm -f .coverage* docs/pantable*.rst docs/modules.rst docs/setup.rst setup.py
rm -rf htmlcov pantable.egg-info .cache .idea dist docs/_build \
docs/_static docs/_templates .ipynb_checkpoints .mypy_cache \
.pytest_cache .tox
find . -type f -name "*.py[co]" -delete \
-or -type d -name "__pycache__" -delete
Clean: clean
rm -f $(RSTs)
# maintenance ##################################################################
.PHONY: pypi pypiManual pep8 flake8 pylint
# Deploy to PyPI
## by CI, properly git tagged
pypi:
git push origin v0.14.2
## Manually
pypiManual:
rm -rf dist
tox -e check
poetry build
twine upload dist/*
# check python styles
pep8:
pycodestyle . --ignore=E501
flake8:
flake8 . --ignore=E501
pylint:
pylint pantable
print-%:
$(info $* = $($*))
# docs #########################################################################
README.rst: docs/README.md
printf \
"%s\n\n" \
".. This is auto-generated from \`$<\`. Do not edit this file directly." \
> $@
cd $(<D); \
$(_pandoc) $(pandocArgs) $(<F) -V title='pantable Documentation' -s -t rst \
>> ../$@
%.rst: %.md
printf \
"%s\n\n" \
".. This is auto-generated from \`$<\`. Do not edit this file directly." \
> $@
$(_pandoc) $(pandocArgs) $< -s -t rst >> $@
dist/docs/:
tox -e docs
# depends on docs as the api doc is built there
# didn't put this in tox as we should build this once every release
# TODO: consider put this in tox and automate it in GH Actions
dist/epub/pantable.epub: docs
sphinx-build -E -b epub docs dist/epub
# the badges and dots has svg files that LaTeX complains about
# dist/pantable.pdf: docs
# sphinx-build -E -b latex docs dist/pdf
# cd dist/pdf; make
# mv dist/pdf/pantable.pdf dist
# poetry #######################################################################
setup.py:
poetry build
cd dist; tar -xf pantable-0.14.2.tar.gz pantable-0.14.2/setup.py
mv dist/pantable-0.14.2/setup.py .
rm -rf dist/pantable-0.14.2
# since poetry doesn't support editable, we can build and extract the setup.py,
# temporary remove pyproject.toml and ask pip to install from setup.py instead.
editable: setup.py
mv pyproject.toml .pyproject.toml
$(_python) -m pip install --no-dependencies -e .
mv .pyproject.toml pyproject.toml
# releasing ####################################################################
bump:
bump2version $(PART)
git push --follow-tags