|
1 | | -#* Variables |
| 1 | +# Define the shell to use when executing commands |
2 | 2 | SHELL := /usr/bin/env bash -o pipefail -o errexit |
3 | 3 |
|
4 | | -#* Lockfile handling |
5 | | -lockfile-update: |
| 4 | +help: |
| 5 | + @@grep -h '^[a-zA-Z]' $(MAKEFILE_LIST) | awk -F ':.*?## ' 'NF==2 {printf " %-22s%s\n", $$1, $$2}' | sort |
| 6 | + |
| 7 | +lockfile-update: ## Update poetry.lock |
6 | 8 | poetry lock -n |
7 | 9 |
|
8 | | -lockfile-update-full: |
| 10 | +lockfile-update-full: ## Fully regenerate poetry.lock |
9 | 11 | poetry lock -n --regenerate |
10 | 12 |
|
11 | | -#* Installation |
12 | | -install: |
| 13 | +install: ## Install dependencies from poetry.lock |
13 | 14 | poetry install -n |
14 | 15 |
|
15 | | -install-types: |
| 16 | +install-types: ## Find and install additional types for mypy |
16 | 17 | poetry run mypy --install-types --non-interactive ./ |
17 | 18 |
|
18 | | -#* Poetry |
19 | | -poetry-download: |
| 19 | +poetry-download: ## Download and install poetry |
20 | 20 | curl -sSL https://install.python-poetry.org | python - |
21 | 21 |
|
22 | | -#* Formatters |
23 | | -codestyle: |
24 | | - poetry run pyupgrade --exit-zero-even-if-changed --py39-plus **/*.py |
25 | | - poetry run isort --settings-path pyproject.toml ./ |
26 | | - poetry run black --config pyproject.toml ./ |
| 22 | +lint: pre-commit ## Alias for the pre-commit target |
27 | 23 |
|
28 | | -formatting: codestyle |
| 24 | +pre-commit: ## Run linters + formatters via pre-commit, run "make pre-commit hook=black" to run only black |
| 25 | + poetry run pre-commit run --all-files --verbose --show-diff-on-failure --color always $(hook) |
29 | 26 |
|
30 | | -#* Linting |
31 | | -test: |
| 27 | +test: ## Run tests with pytest |
32 | 28 | poetry run pytest -c pyproject.toml tests/ |
33 | 29 |
|
34 | | -check-codestyle: |
35 | | - poetry run isort --diff --check-only --settings-path pyproject.toml ./ |
36 | | - poetry run black --diff --check --config pyproject.toml ./ |
37 | | - poetry run darglint --verbosity 2 hyperliquid tests |
38 | | - |
39 | | -check: |
40 | | - poetry run mypy --config-file pyproject.toml ./ |
41 | | - |
42 | | -check-safety: |
43 | | - poetry check |
| 30 | +check-safety: ## Run safety checks on dependencies |
44 | 31 | poetry run safety check --full-report |
45 | | - poetry run bandit -ll --recursive hyperliquid tests |
46 | 32 |
|
47 | | -lint: test check-codestyle mypy check-safety |
| 33 | +update-dev-deps: ## Update development dependencies to latest versions |
| 34 | + poetry add -D mypy@latest pre-commit@latest pytest@latest safety@latest coverage@latest pytest-cov@latest |
| 35 | + poetry run pre-commit autoupdate |
48 | 36 |
|
49 | | -update-dev-deps: |
50 | | - 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 |
51 | | - poetry add -D --allow-prereleases black@latest |
52 | | - |
53 | | -#* Cleaning |
54 | | -pycache-remove: |
| 37 | +cleanup: ## Cleanup project |
55 | 38 | find . | grep -E "(__pycache__|\.pyc|\.pyo$$)" | xargs rm -rf |
56 | | - |
57 | | -dsstore-remove: |
58 | 39 | find . | grep -E ".DS_Store" | xargs rm -rf |
59 | | - |
60 | | -mypycache-remove: |
61 | 40 | find . | grep -E ".mypy_cache" | xargs rm -rf |
62 | | - |
63 | | -ipynbcheckpoints-remove: |
64 | | - find . | grep -E ".ipynb_checkpoints" | xargs rm -rf |
65 | | - |
66 | | -pytestcache-remove: |
67 | 41 | find . | grep -E ".pytest_cache" | xargs rm -rf |
68 | | - |
69 | | -build-remove: |
70 | 42 | rm -rf build/ |
71 | 43 |
|
72 | | -cleanup: pycache-remove dsstore-remove mypycache-remove ipynbcheckpoints-remove pytestcache-remove |
73 | | - |
74 | 44 | .PHONY: all $(MAKECMDGOALS) |
0 commit comments