Skip to content

Commit 0499ef2

Browse files
committed
feat: python improvements and uv support
1 parent 1d14c05 commit 0499ef2

15 files changed

Lines changed: 1683 additions & 147 deletions

.github/workflows/ci-python.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ on:
1616

1717
env:
1818
AWS_REGION: us-east-1
19-
# Copied this CORE_REPO_SHA from
20-
# https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/.github/workflows/test.yml#L9
21-
CORE_REPO_SHA: v1.19.0
2219

2320
permissions:
2421
contents: read
@@ -36,19 +33,17 @@ jobs:
3633
steps:
3734
- name: Checkout this repo
3835
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
36+
3937
- name: Setup Python for OTel Python SDK
4038
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
4139
with:
4240
python-version: ${{ matrix.python }}
43-
- name: Install tox testing package
44-
working-directory: python/src
41+
42+
- name: Set up uv
43+
uses: astral-sh/setup-uv@v7
44+
45+
- name: Run tests
46+
working-directory: python/src/otel
4547
run: |
46-
pip install tox
47-
tox
48-
- name: Set up Go for ADOT Collector
49-
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
50-
with:
51-
go-version: '^1.20.8'
52-
- name: Build Python Layer which includes ADOT Collector
53-
working-directory: python/src
54-
run: ./run.sh -b
48+
uv sync --extra test --extra instrumentation
49+
uv run pytest tests

.github/workflows/release-layer-python.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- name: Save PYTHON_OPENTELEMETRY_SDK_VERSION
3838
id: save-python-opentelemetry-sdk-version
3939
run: |
40-
cd python/src
41-
echo "PYTHON_OPENTELEMETRY_SDK_VERSION=$(cat otel/otel_sdk/requirements.txt | grep opentelemetry-sdk | sed 's/.*==\([^ ]*\).*/\1/')" >> $GITHUB_ENV
40+
cd python/src/otel
41+
echo "PYTHON_OPENTELEMETRY_SDK_VERSION=$(grep 'opentelemetry-sdk' pyproject.toml | sed 's/.*==\([^"]*\).*/\1/')" >> $GITHUB_ENV
4242
echo "PYTHON_OPENTELEMETRY_SDK_VERSION=$PYTHON_OPENTELEMETRY_SDK_VERSION" >> $GITHUB_OUTPUT
4343
shell: bash
4444

@@ -78,7 +78,7 @@ jobs:
7878
needs: build-layer
7979
strategy:
8080
matrix:
81-
aws_region:
81+
aws_region:
8282
- ap-northeast-1
8383
- ap-northeast-2
8484
- ap-south-1

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ terraform.*
1313
.DS_Store
1414

1515
.tox
16-
__pycache__/*
17-
.pyc
16+
.venv
17+
.pytest_cache/
18+
__pycache__/
19+
*.pyc
1820
build.toml
1921

2022
*.zip

python/src/otel/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ ADD . /workspace
66

77
WORKDIR /workspace
88

9+
# Install uv
10+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
11+
export PATH="/root/.local/bin:$PATH"
12+
913
RUN mkdir -p /build && \
10-
python3 -m pip install -r otel_sdk/requirements.txt -t /build/python && \
11-
python3 -m pip install -r otel_sdk/nodeps-requirements.txt -t /build/tmp --no-deps && \
12-
# We need to use a `/build/tmp/` folder otherwise the instrumentation packages
13-
# do not get fully downloaded to the `opentelemetry/instrumentation/` path.
14-
cp -r /build/tmp/* /build/python/ && \
15-
rm -rf /build/tmp && \
14+
/root/.local/bin/uv venv /build/.venv && \
15+
/root/.local/bin/uv pip install --python /build/.venv/bin/python '.[instrumentation]' --target /build/python && \
1616
mv otel_sdk/otel_wrapper.py /build/python && \
1717
mv otel_sdk/otel-instrument /build && \
1818
mv otel_sdk/otel-handler /build && \

python/src/otel/Makefile

Lines changed: 0 additions & 14 deletions
This file was deleted.

python/src/otel/otel_sdk/nodeps-requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)