Repository navigation
68 lines (64 loc) · 2.36 KB
/
Copy pathanthropic-python-tests.yml
File metadata and controls
68 lines (64 loc) · 2.36 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
name: Anthropic Python compatibility
# traceAI-anthropic on the oldest SDK it supports, the first SDK with native
# OpenTelemetry tracing, and the latest SDK. python-tests.yml covers the locked SDK.
on:
pull_request:
paths:
- 'python/frameworks/anthropic/**'
- 'python/fi_instrumentation/**'
- 'python/tests/harness/**'
- '.github/workflows/anthropic-python-tests.yml'
push:
branches: [dev]
paths:
- 'python/frameworks/anthropic/**'
- 'python/fi_instrumentation/**'
- 'python/tests/harness/**'
- '.github/workflows/anthropic-python-tests.yml'
permissions:
contents: read
jobs:
contract:
name: Anthropic Python (anthropic ${{ matrix.sdk }})
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
# Declared floor (pyproject.toml), before native tracing.
- sdk: '0.41.0'
python: '3.10'
extra: 'httpx<0.28'
# First SDK with native OpenTelemetry tracing.
- sdk: '1.14.0'
python: '3.10'
extra: ''
# Latest release.
- sdk: '2.3.0'
python: '3.12'
extra: ''
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python }}
- name: Install source integration and the selected SDK
env:
SDK: ${{ matrix.sdk }}
EXTRA: ${{ matrix.extra }}
run: |
python -m venv .venv
.venv/bin/pip install -e python -e python/frameworks/anthropic "anthropic==$SDK" opentelemetry-sdk pytest pytest-asyncio ${EXTRA:+"$EXTRA"}
.venv/bin/python -c 'import anthropic; print("anthropic", anthropic.__version__)'
- name: Run with outbound network disabled
run: |
sudo unshare --net -- bash -e -c '
ip link set lo up
cd "$2/python/frameworks/anthropic"
"$1" -m pytest tests -q -p no:cacheprovider -o addopts=""
cd "$2/python"
FI_BASE_URL=http://127.0.0.1:9 FI_GRPC_URL=http://127.0.0.1:9 "$1" -m pytest tests/test_framework_anthropic.py -q -p no:cacheprovider
' _ "$PWD/.venv/bin/python" "$PWD"