Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (39 loc) · 1.44 KB
/
Copy pathMakefile
File metadata and controls
52 lines (39 loc) · 1.44 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
UV = uv
RUN = $(UV) run
PROTO_DIR = proto
PB_DIR = src/rune_sdk/_pb
DIST_DIR = dist
TESTPYPI_URL = https://test.pypi.org/legacy/
.PHONY: default generate lint test format clean build publish-test publish check-clean
default: lint test
generate:
@ ./scripts/generate.sh
lint:
@ $(RUN) ruff check src tests examples
@ $(RUN) ruff format --check src tests examples
@ $(RUN) mypy
test:
@ $(RUN) pytest
format:
@ $(RUN) ruff format src tests examples
@ $(RUN) ruff check --fix src tests examples
clean:
@ rm -rf .mypy_cache .ruff_cache .pytest_cache dist
# hatch-vcs derives the version from the git tag; a dirty tree yields a
# .devN+g<sha> local version that PyPI rejects, so refuse to publish it.
check-clean:
@ test -z "$$(git status --porcelain)" || \
{ echo "error: working tree is dirty; commit or stash before publishing"; exit 1; }
build: check-clean clean
@ $(UV) build
@ $(UV) run --with twine twine check --strict $(DIST_DIR)/*
# Publish to TestPyPI. Requires TESTPYPI_TOKEN in the environment.
publish-test: build
@ test -n "$$TESTPYPI_TOKEN" || \
{ echo "error: set TESTPYPI_TOKEN to a TestPyPI API token"; exit 1; }
@ UV_PUBLISH_TOKEN=$$TESTPYPI_TOKEN $(UV) publish --publish-url $(TESTPYPI_URL) $(DIST_DIR)/*
# Publish to PyPI. Requires PYPI_TOKEN in the environment.
publish: build
@ test -n "$$PYPI_TOKEN" || \
{ echo "error: set PYPI_TOKEN to a PyPI API token"; exit 1; }
@ UV_PUBLISH_TOKEN=$$PYPI_TOKEN $(UV) publish $(DIST_DIR)/*