-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
84 lines (69 loc) · 2.02 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
PYTHON := python
PIP := $(PYTHON) -m pip
PYTEST := $(PYTHON) -m pytest
COVERAGE := $(PYTHON) -m coverage
BLACK := black
RUFF := ruff
PYLINT := pylint
TOX := $(PYTHON) -m tox
SETUP := $(PYTHON) setup.py
DIR := denseclus
.PHONY: lint lint-notebooks test coverage tox install install-dev pypi clean help
lint:
@echo "Running linting..."
@$(BLACK) $(DIR) tests setup.py
@$(RUFF) $(DIR) tests setup.py --fix --preview
@$(PYLINT) $(DIR) --disable=R0902,W0222,W0221,C0103,W0632
lint-notebooks:
@echo "Linting notebooks..."
@nbqa black notebooks/*.ipynb
@nbqa isort notebooks/*.ipynb
test:
@echo "Running tests..."
@$(PYTEST) -ra
coverage:
@echo "Running coverage..."
@$(COVERAGE) erase
@$(COVERAGE) run --source=$(DIR) -m pytest -ra
@$(COVERAGE) report -m
tox:
@echo "Running tox..."
@$(TOX)
install:
@echo "Installing..."
@$(PIP) install --upgrade pip
@$(PIP) install -e .
install-dev: install
@echo "Installing dev dependencies..."
@$(PIP) install -r requirements-dev.txt
install-test: install
@echo "Installing test dependencies..."
@$(PIP) install -e ".[test]"
@$(PIP) install -e ".[all]"
pypi:
@echo "Uploading to PyPi..."
@$(SETUP) sdist
@$(SETUP) bdist_wheel --universal
@twine upload dist/*
clean:
@echo "Cleaning..."
@rm -rf **/.ipynb_checkpoints **/.pytest_cache **/__pycache__ **/**/__pycache__ .ipynb_checkpoints .pytest_cache
@rm -rf .mypy_cache .ruff_cache .coverage build .tox
coverage erase
@rm -rf dist
help:
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%s\n\n" "Usage: make [task]"; \
printf "%-20s %s\n" "task" "help" ; \
printf "%-20s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-20s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done