-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
75 lines (55 loc) · 1.7 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
VIRTUAL_ENV ?= venv
REQUIREMENTS:=requirements.txt
PIP=$(VIRTUAL_ENV)/bin/pip
PYTHON=$(VIRTUAL_ENV)/bin/python
ISORT=$(VIRTUAL_ENV)/bin/isort
FLAKE8=$(VIRTUAL_ENV)/bin/flake8
BLACK=$(VIRTUAL_ENV)/bin/black
PYTEST=$(VIRTUAL_ENV)/bin/pytest
TOX=$(VIRTUAL_ENV)/bin/tox
TWINE=$(VIRTUAL_ENV)/bin/twine
PYTHON_MAJOR_VERSION=3
PYTHON_MINOR_VERSION=10
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
SOURCES=edilkamin/ tests/ setup.py
SPHINXBUILD=$(shell realpath venv/bin/sphinx-build)
DOCS_DIR=docs
$(VIRTUAL_ENV):
$(PYTHON_WITH_VERSION) -m venv $(VIRTUAL_ENV)
$(PIP) install -r $(REQUIREMENTS)
virtualenv: $(VIRTUAL_ENV)
test: $(VIRTUAL_ENV)
$(TOX)
pytest: $(VIRTUAL_ENV)
$(PYTEST) --doctest-modules --cov edilkamin/ --cov-report term --cov-report html tests/ edilkamin/
lint/isort: $(VIRTUAL_ENV)
$(ISORT) --check-only --diff $(SOURCES)
lint/flake8: $(VIRTUAL_ENV)
$(FLAKE8) $(SOURCES)
lint/black: $(VIRTUAL_ENV)
$(BLACK) --check $(SOURCES)
format/isort: $(VIRTUAL_ENV)
$(ISORT) $(SOURCES)
format/black: $(VIRTUAL_ENV)
$(BLACK) --verbose $(SOURCES)
lint: lint/isort lint/flake8 lint/black
format: format/isort format/black
clean:
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type d -name "*.egg-info" -exec rm -r {} +
clean/all: clean
rm -rf $(VIRTUAL_ENV)
docs/clean:
rm -rf $(DOCS_DIR)/build/
docs/build: virtualenv
cd $(DOCS_DIR) && make html SPHINXBUILD=$(SPHINXBUILD)
docs: docs/build
release/clean:
rm -rf dist/ build/
release/build: release/clean virtualenv
$(PYTHON) setup.py sdist bdist_wheel
$(TWINE) check dist/*
release/upload:
$(TWINE) upload dist/*