|
1 | 1 | #* Variables |
2 | | -SHELL := /usr/bin/env bash |
3 | | -PYTHON := python |
4 | | -PYTHONPATH := `pwd` |
| 2 | +SHELL := /usr/bin/env bash -o pipefail -o errexit |
5 | 3 |
|
6 | 4 | #* Installation |
7 | | -.PHONY: install |
8 | 5 | install: |
9 | 6 | poetry lock -n --no-update && poetry export --without-hashes > requirements.txt |
10 | 7 | poetry install -n |
11 | 8 | -poetry run mypy --install-types --non-interactive ./ |
12 | 9 |
|
13 | 10 | #* Poetry |
14 | | -.PHONY: poetry-download |
15 | 11 | poetry-download: |
16 | | - curl -sSL https://install.python-poetry.org | $(PYTHON) - |
| 12 | + curl -sSL https://install.python-poetry.org | python - |
17 | 13 |
|
18 | 14 | #* Formatters |
19 | | -.PHONY: codestyle |
20 | 15 | codestyle: |
21 | 16 | poetry run pyupgrade --exit-zero-even-if-changed --py37-plus **/*.py |
22 | 17 | poetry run isort --settings-path pyproject.toml ./ |
23 | 18 | poetry run black --config pyproject.toml ./ |
24 | 19 |
|
25 | | -.PHONY: formatting |
26 | 20 | formatting: codestyle |
27 | 21 |
|
28 | 22 | #* Linting |
29 | | -.PHONY: test |
30 | 23 | test: |
31 | | - PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --record-mode=once --cov-report=html --cov=hyperliquid tests/ |
| 24 | + poetry run pytest -c pyproject.toml tests/ |
32 | 25 | poetry run coverage-badge -o assets/images/coverage.svg -f |
33 | 26 |
|
34 | | -.PHONY: check-codestyle |
35 | 27 | check-codestyle: |
36 | 28 | poetry run isort --diff --check-only --settings-path pyproject.toml ./ |
37 | 29 | poetry run black --diff --check --config pyproject.toml ./ |
38 | 30 | poetry run darglint --verbosity 2 hyperliquid tests |
39 | 31 |
|
40 | | -.PHONY: check |
41 | 32 | check: |
42 | 33 | poetry run mypy --config-file pyproject.toml ./ |
43 | 34 |
|
44 | | -.PHONY: check-safety |
45 | 35 | check-safety: |
46 | 36 | poetry check |
47 | 37 | poetry run safety check --full-report |
48 | 38 | poetry run bandit -ll --recursive hyperliquid tests |
49 | 39 |
|
50 | | -.PHONY: lint |
51 | 40 | lint: test check-codestyle mypy check-safety |
52 | 41 |
|
53 | | -.PHONY: update-dev-deps |
54 | 42 | update-dev-deps: |
55 | 43 | poetry add -D bandit@latest darglint@latest "isort[colors]@latest" mypy@latest pre-commit@latest pydocstyle@latest pylint@latest pytest@latest pyupgrade@latest safety@latest coverage@latest coverage-badge@latest pytest-cov@latest |
56 | 44 | poetry add -D --allow-prereleases black@latest |
57 | 45 |
|
58 | | -#* Docker |
59 | | -# Example: make docker-build VERSION=latest |
60 | | -# Example: make docker-build IMAGE=some_name VERSION=0.1.0 |
61 | | -.PHONY: docker-build |
62 | | -docker-build: |
63 | | - @echo Building docker $(IMAGE):$(VERSION) ... |
64 | | - docker build \ |
65 | | - -t $(IMAGE):$(VERSION) . \ |
66 | | - -f ./docker/Dockerfile --no-cache |
67 | | - |
68 | | -# Example: make docker-remove VERSION=latest |
69 | | -# Example: make docker-remove IMAGE=some_name VERSION=0.1.0 |
70 | | -.PHONY: docker-remove |
71 | | -docker-remove: |
72 | | - @echo Removing docker $(IMAGE):$(VERSION) ... |
73 | | - docker rmi -f $(IMAGE):$(VERSION) |
74 | | - |
75 | 46 | #* Cleaning |
76 | | -.PHONY: pycache-remove |
77 | 47 | pycache-remove: |
78 | 48 | find . | grep -E "(__pycache__|\.pyc|\.pyo$$)" | xargs rm -rf |
79 | 49 |
|
80 | | -.PHONY: dsstore-remove |
81 | 50 | dsstore-remove: |
82 | 51 | find . | grep -E ".DS_Store" | xargs rm -rf |
83 | 52 |
|
84 | | -.PHONY: mypycache-remove |
85 | 53 | mypycache-remove: |
86 | 54 | find . | grep -E ".mypy_cache" | xargs rm -rf |
87 | 55 |
|
88 | | -.PHONY: ipynbcheckpoints-remove |
89 | 56 | ipynbcheckpoints-remove: |
90 | 57 | find . | grep -E ".ipynb_checkpoints" | xargs rm -rf |
91 | 58 |
|
92 | | -.PHONY: pytestcache-remove |
93 | 59 | pytestcache-remove: |
94 | 60 | find . | grep -E ".pytest_cache" | xargs rm -rf |
95 | 61 |
|
96 | | -.PHONY: build-remove |
97 | 62 | build-remove: |
98 | 63 | rm -rf build/ |
99 | 64 |
|
100 | | -.PHONY: cleanup |
101 | 65 | cleanup: pycache-remove dsstore-remove mypycache-remove ipynbcheckpoints-remove pytestcache-remove |
| 66 | + |
| 67 | +.PHONY: all $(MAKECMDGOALS) |
0 commit comments