Skip to content

Commit 5b3ed74

Browse files
authored
Fix python version. (#56)
*Issue #, if available:* 1. change tox.ini `py3{7,8,9,10,11}` to `3.{7,8,9,10,11}` so that the workflow can run unit test. 2. change project Dokerfile to use python 3.10, because we are using opentelemetry-exporter-otlp-proto-grpc, it use grpcio as dependencies. It seems like grpc has a strict dependency on the OS / Python version. Also mentioned in [Docker build template in upstream](https://github.com/open-telemetry/opentelemetry-operator/blob/b5bb0ae34720d4be2d229dafecb87b61b37699b0/autoinstrumentation/python/requirements.txt#L2). When we use python 3.11 to build the docker file, we receive `"Cannot import name 'cygrpc' from 'grpc._cython'"` in EKS auto-instrumentation injection. As [https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#the-python-interpre[…]tions-python-worker](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#the-python-interpreter-isnt-supported-by-azure-functions-python-workerr) suggested, Azure Functions support python 3.6 - 3.9, but while testing, 3.10 also worked. So change to 3.10 here. 3. As we change the python version for Dockerfile we also change main_build and release_build workflow to align with Dock build. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent c91cad3 commit 5b3ed74

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.github/workflows/main_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
5555
push_image: true
5656
load_image: false
57-
python_version: 3.11
57+
python_version: 3.10
5858
package_name: aws-opentelemetry-distro
5959
os: ubuntu-latest
6060

.github/workflows/release_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
snapshot-ecr-role: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
3333
push_image: false
3434
load_image: false
35-
python_version: 3.11
35+
python_version: 3.10
3636
package_name: aws-opentelemetry-distro
3737
os: ubuntu-latest
3838

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
# one init container will be created to copy all the content in `/autoinstrumentation` directory to app's container. Then
55
# update the `PYTHONPATH` environment variable accordingly. Then in the second stage, copy the directory to `/autoinstrumentation`.
66

7-
FROM python:3.11 AS build
7+
# Using Python 3.10 because we are utilizing the opentelemetry-exporter-otlp-proto-grpc exporter,
8+
# which relies on grpcio as a dependency. grpcio has strict dependencies on the OS and Python version.
9+
# Also mentioned in Docker build template in the upstream repository:
10+
# https://github.com/open-telemetry/opentelemetry-operator/blob/b5bb0ae34720d4be2d229dafecb87b61b37699b0/autoinstrumentation/python/requirements.txt#L2
11+
# For further details, please refer to: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#the-python-interpre[…]tions-python-worker
12+
FROM python:3.10 AS build
813

914
WORKDIR /operator-build
1015

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ skipsdist = True
44
skip_missing_interpreters = True
55
envlist =
66
; aws-opentelemetry-distro
7-
py3{7,8,9,10,11}-test-aws-opentelemetry-distro
7+
3.{7,8,9,10,11}-test-aws-opentelemetry-distro
88
; intentionally excluded from pypy3 since we use grpc in aws-opentelemetry-distro, but pypy3 doesn't support grpc
99

1010
lint
@@ -26,7 +26,7 @@ changedir =
2626

2727
commands_pre =
2828
; Install without -e to test the actual installation
29-
py3{7,8,9,10,11}: python -m pip install -U pip setuptools wheel
29+
3.{7,8,9,10,11}: python -m pip install -U pip setuptools wheel
3030
; Install common packages for all the tests. These are not needed in all the
3131
; cases but it saves a lot of boilerplate in this file.
3232
test: pip install "opentelemetry-api[test] @ {env:CORE_REPO}#egg=opentelemetry-api&subdirectory=opentelemetry-api"

0 commit comments

Comments
 (0)