blob: ca8cce12a7139b3799b23f2af4513bd547d6e118 (
plain) (
blame)
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
|
export VIRTUAL_ENV := ""
# Use sudo for docker if the current user isn't in the docker group
docker := if `docker info > /dev/null 2>&1 && echo ok || echo fail` == "ok" { "docker" } else { "sudo docker" }
# Install project + dev dependencies
install-dev:
uv sync
# Format + lint + type check
check: format-check lint typecheck
# Strict checks: unused imports, args, complexity
check-strict:
uv run --inexact ruff check --select F401,F841,ARG,PLR0913,C901,RUF src/ test/
# Auto-format + auto-fix lint
fix:
uv run --inexact ruff format src/ test/
uv run --inexact ruff check --fix src/ test/
# Format source
format:
uv run --inexact ruff format src/ test/
# Check formatting without modifying
format-check:
uv run --inexact ruff format --check src/ test/
# Lint source
lint:
uv run --inexact ruff check src/ test/
# Type check
typecheck:
uv run --inexact mypy src/
# Run tests
test:
uv run --inexact pytest
# Build sdist + wheel
build:
uv build
# Remove caches + dist
clean:
rm -rf dist/ .mypy_cache/ .ruff_cache/ .pytest_cache/
find . -type d -name __pycache__ -exec rm -rf {} +
# --- Docker ---
# Build the claude-py test image
docker-build:
{{docker}} compose -f compose/scenarios/test.yml build claude-py
# Run dockerized integration test (standalone, no proxy)
docker-test mode="chat":
{{docker}} compose -f compose/scenarios/test.yml build claude-py
{{docker}} compose -f compose/scenarios/test.yml run --rm -e TEST_MODE={{mode}} claude-py
# Run dockerized test with mitmproxy traffic capture
docker-capture mode="chat":
{{docker}} compose -f compose/scenarios/capture.yml build claude-py
{{docker}} compose -f compose/scenarios/capture.yml run --rm -e TEST_MODE={{mode}} claude-py
# Tear down all docker test resources
docker-down:
-{{docker}} compose -f compose/scenarios/test.yml down
-{{docker}} compose -f compose/scenarios/capture.yml down -v
|