-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (50 loc) · 1.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
.PHONY: help clean_docs install dev format style test docs deploy_package deploy_docs
REMOVE = rm -rfv
PYTHON = python3
PIP = $(PYTHON) -m pip install
TOX = $(PYTHON) -m tox
# About -----------------------------------------------------------------------
help:
@echo "make recipes"
@echo "------------"
@echo "make install -> install the package locally from source"
@echo "make dev -> install the package locally in development mode"
@echo "make format -> format code with black"
@echo "make style -> check style with black and flake8"
@echo "make test -> run unit tests via pytest"
@echo "make docs -> build jupyter-book documentation"
@echo "make all -> check style, run tests, and build docs"
@echo " "
@echo "tox environments (tox -e <env>)"
@echo "-------------------------------"
@$(TOX) list
clean_docs:
$(REMOVE) "docs/_build"
find docs -type d -name "_autosummaries" | xargs $(REMOVE)
# Installation ----------------------------------------------------------------
install:
$(PIP) .
dev:
$(PIP) -e ".[dev]"
# Testing and documentation ---------------------------------------------------
format:
$(TOX) -e format
style:
$(TOX) -e style
test: style
$(TOX)
docs:
$(TOX) -e literature,docs
all: test docs
# Deployment (ADMINISTRATORS ONLY) --------------------------------------------
deploy_package: test
git checkout main
$(PIP) --upgrade build
$(PIP) --upgrade twine
$(PYTHON) -m build --sdist --wheel
$(PYTHON) -m twine check dist/*
$(PYTHON) -m twine upload dist/*
deploy_docs: docs # clean_docs
$(PYTHON) -m pip install --upgrade ghp-import
git checkout main
ghp-import --remote upstream --no-jekyll --push --force --no-history docs/_build/html