-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
110 lines (92 loc) · 2.48 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
SHELL = /usr/bin/env bash
_python ?= python
# for bump2version, valid options are: major, minor, patch
PART ?= patch
PANDOC = pandoc
pandocArgs = --toc -M date="`date "+%B %e, %Y"`" --filter=pantable --wrap=none
RSTs = CHANGELOG.rst README.rst
# Main Targets #################################################################
.PHONY: docs api html test clean
docs: $(RSTs)
$(MAKE) html
api: docs/api/
html: dist/docs/
test:
rm -f .coverage*
coverage run -m pytest -vv $(PYTESTARGS) \
tests
coverage combine
coverage report
coverage html
clean:
rm -f $(RSTs) .coverage*
# docs #########################################################################
README.rst: docs/README.md docs/badges.csv
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 >> $@
docs/api/:
sphinx-apidoc \
--maxdepth 6 \
--force \
--separate \
--module-first \
--implicit-namespaces \
--doc-project API \
--output-dir $@ src/bsos
dist/docs/:
sphinx-build -E -b dirhtml docs dist/docs
# sphinx-build -b linkcheck docs dist/docs
# maintenance ##################################################################
.PHONY: pypi pypiManual gh-pages pep8 flake8 pylint
# Deploy to PyPI
## by CI, properly git tagged
pypi:
git push origin v0.1.0
## Manually
pypiManual:
rm -rf dist
poetry build
twine upload dist/*
gh-pages:
ghp-import --no-jekyll --push dist/docs
# check python styles
pep8:
pycodestyle . --ignore=E501
flake8:
flake8 . --ignore=E501
pylint:
pylint bsos
format: format-python format-shell
format-python:
black . && isort .
find \! -path '*/.ipynb_checkpoints/*' -name '*.ipynb' -exec jupytext --sync --pipe black --pipe 'isort - --treat-comment-as-code "# %%" --float-to-top' {} +
python src/bsos/core.py common/conda/conda.csv common/conda/conda.csv
format-shell:
find . -type f \
\( -name '*.sh' -o -name env -o -name interactive \) \
-exec sed -i -E 's/\$$([a-zA-Z_][a-zA-Z0-9_]*)/$${\1}/g' {} + \
-exec shfmt \
--write \
--simplify \
--indent 4 \
--case-indent \
--space-redirects \
{} +
print-%:
$(info $* = $($*))
# releasing ####################################################################
.PHONY: bump
bump:
bump2version $(PART)
git push --follow-tags