-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
76 lines (67 loc) · 2.35 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
default: doctest
.PHONY: pre-commit
pre-commit: fmt test check-types
.PHONY: clean
clean: ## Remove built docs and packaging artifacts
rm -rf dist build zgulde.egg-info public
rm -f index.html
rm -rf .make .mypy_cache .pytest_cache .pytype
.PHONY: release
release: fmt test check-types gh-pages ## Release a new version to pypi
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
.PHONY: docs gh-pages
docs: ## Build the docs for extend_pandas
mkdir -p public
PYTHONPATH=. python doc/gen_extend_pandas_docs.py |\
rst2html.py --stylesheet-path=doc/style.css \
--template=doc/template.txt \
> public/index.html
gh-pages: clean ## Build, commit, and push docs for the gh-pages branch
mkdir -p public
@if [[ ! -f .git/refs/heads/gh-pages ]] ; then \
@echo '[make] Creating gh-pages branch';\
git --work-tree public checkout -q --orphan gh-pages;\
touch public/index.html;\
git --work-tree public add --all;\
git --work-tree public commit --quiet --message 'Update Docs';\
git checkout --quiet --force master;\
fi
git --work-tree public checkout gh-pages
make docs
git --work-tree public add -A
git --work-tree public commit --amend --no-edit
git checkout --force master
git push origin gh-pages --force
PY_FILES := $(shell find zgulde -name \*.py)
.PHONY: test doctest pytest
DOCTESTS := $(addprefix .make/doctest/, $(filter-out %__main__.py, $(PY_FILES)))
.make/doctest/%: %
@mkdir -p $(dir $@)
python -m doctest -o NORMALIZE_WHITESPACE -o ELLIPSIS $<
@touch $@
test: doctest pytest
doctest: $(DOCTESTS)
pytest:
python -m pytest
.PHONY: check-types check-types-mypy check-types-pytype
PYTYPE_TYPE_CHECKS := $(addprefix .make/pytype/, $(PY_FILES))
MYPY_TYPE_CHECKS := $(addprefix .make/mypy/, $(PY_FILES))
.make/pytype/%: %
@mkdir -p $(dir $@)
pytype $<
@touch $@
.make/mypy/%: %
@mkdir -p $(dir $@)
python -m mypy --ignore-missing-imports $<
@touch $@
check-types-mypy: $(MYPY_TYPE_CHECKS)
check-types-pytype: $(PYTYPE_TYPE_CHECKS)
check-types: check-types-mypy check-types-pytype
.PHONY: fmt
fmt: ## Format code with isort and black
python -m isort --line-width 88 --trailing-comma --multi-line 3 $(PY_FILES)
python -m black -q $(PY_FILES)
.PHONY: help
help: ## Show this help message
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%s\033[0m\t%s\n", $$1, $$2}' | column -ts$$'\t'