-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (63 loc) · 1.52 KB
/
Copy pathMakefile
File metadata and controls
82 lines (63 loc) · 1.52 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
.PHONY: default
default:
.PHONY: install-deps
install-deps:
uv sync
.PHONY: update-deps
update-deps:
uv sync --upgrade
.PHONY: check
check: lint test
.PHONY: lint
lint: lint-black lint-isort lint-pyflakes lint-mypy
.PHONY: lint-black
lint-black:
uv run black --check --diff .
.PHONY: lint-isort
lint-isort:
uv run isort --check .
.PHONY: lint-pyflakes
lint-pyflakes:
uv run pyflakes src tests examples
.PHONY: lint-mypy
lint-mypy:
uv run mypy tests
uv run mypy src/enapter
.PHONY: test
test: test-unit test-integration
.PHONY: test-unit
test-unit:
uv run pytest -vv --cov=enapter --cov-report term-missing tests/unit
.PHONY: test-integration
test-integration:
uv run pytest -vv --capture=no tests/integration
.PHONY: upload-to-pypi
upload-to-pypi: dist
ifndef PYPI_API_TOKEN
$(error PYPI_API_TOKEN is not defined)
endif
@UV_PUBLISH_TOKEN=$(PYPI_API_TOKEN) uv publish $</*
dist.tar: dist
rm --force $@
tar --create --file $@ $<
.PHONY: dist
dist:
rm -rf dist
uv build
RE_SEMVER = [0-9]+.[0-9]+.[0-9]+(-[a-z0-9]+)?
.PHONY: bump-version
bump-version:
ifndef V
$(error V is not defined)
endif
sed -E -i 's/__version__ = "$(RE_SEMVER)"/__version__ = "$(V)"/g' src/enapter/__init__.py
uv lock
grep -E --files-with-matches --recursive "enapter==$(RE_SEMVER)" README.md examples \
| xargs -n 1 sed -E -i "s/enapter==$(RE_SEMVER)/enapter==$(V)/g"
git add .
git commit -m "bump version to $(V)"
git tag "v$(V)"
DOCKER_IMAGE_TAG ?= enapter/python-sdk:dev
.PHONY: docker-image
docker-image:
docker build -t $(DOCKER_IMAGE_TAG) .