-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (68 loc) · 2.79 KB
/
Copy pathMakefile
File metadata and controls
87 lines (68 loc) · 2.79 KB
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
85
86
87
SHELL := /bin/bash
.PHONY: all venv format format-fix format-tests format-src test-integration test build help
all: help
FMT_FLAGS ?= --check
VENV ?= false
ifeq ($(VENV), true)
VENV_FLAGS := --active
else
VENV_FLAGS :=
endif
venv:
uv venv
uv sync --dev
format: format-src format-tests
format-tests:
uv run $(VENV_FLAGS) ruff check tests
uv run $(VENV_FLAGS) ruff format tests $(FMT_FLAGS)
uv run $(VENV_FLAGS) mypy tests
format-src:
uv run $(VENV_FLAGS) ruff check astrapy
uv run $(VENV_FLAGS) ruff format astrapy $(FMT_FLAGS)
uv run $(VENV_FLAGS) mypy astrapy
format-fix: format-fix-src format-fix-tests
format-fix-src: FMT_FLAGS=
format-fix-src: format-src
format-fix-tests: FMT_FLAGS=
format-fix-tests: format-tests
test-integration:
COVERAGE_FILE=".coverage.integration" uv run $(VENV_FLAGS) pytest --cov=astrapy/ tests/base/integration -vv
test:
COVERAGE_FILE=".coverage.unit" uv run $(VENV_FLAGS) pytest --cov=astrapy/ tests/base/unit -vv
docker-test-integration:
DOCKER_COMPOSE_LOCAL_DATA_API="yes" uv run pytest --cov=astrapy/ tests/base/integration -vv
build:
rm -f dist/astrapy*
uv build
coverage_html:
rm htmlcov -rf
uv run coverage combine $(ls .coverage.unit .coverage.integration 2>/dev/null)
uv run coverage html
echo "OPEN file://${PWD}/htmlcov/index.html"
coverage_json:
rm jsoncov -rf
uv run coverage combine $(ls .coverage.unit .coverage.integration 2>/dev/null)
mkdir jsoncov
uv run coverage json -o jsoncov/coverage.json
echo "Created `ls jsoncov/coverage.json`"
query_providers:
uv run python tests/vectorize/query_providers.py
help:
@echo "======================================================================"
@echo "AstraPy make command purpose"
@echo "----------------------------------------------------------------------"
@echo "venv create a virtual env (needs uv)"
@echo "format full lint and format checks"
@echo " format-src limited to source"
@echo " format-tests limited to tests"
@echo " format-fix fixing imports and style"
@echo " format-fix-src limited to source"
@echo " format-fix-tests limited to tests"
@echo "test run unit tests"
@echo "test-integration run integration tests"
@echo "docker-test-integration run int.tests on dockerized local"
@echo "coverage_html HTML coverage map from last test"
@echo "coverage_json JSON coverage map from last test"
@echo "query_providers Refresh _providers.json"
@echo "build build package ready for PyPI"
@echo "======================================================================"