From 55bf10038f30b170e439cc92d50152d75db6bba8 Mon Sep 17 00:00:00 2001 From: Iuri de Silvio Date: Wed, 14 Feb 2024 02:21:50 -0300 Subject: [PATCH] Upgrade tox (#3624) * Upgrade tox * Remove tox-factor * Bump tox cache * Remove exporter-jaeger from matrix These tests were removed in 2a8d4ed433feb8f4ba8db141643773e6f097bdca, but tox-factor just ignored the problem, but tox 4 fails because the env does not exist. * Ignore py37 getting-started The py37 env was removed in 4a2cb86f2885159d9e3f8d5f04fe409640df23e4 and now tox 4 fails instead of ignore it like tox-factor. * Ignore pypy3 for some packages * Github actions exclude does not accept arrays * Contrib tests still running on tox 3 * Revert "Contrib tests still running on tox 3" This reverts commit fdcd75db7b5ef3e59850ff55bf70ea1521dbaa74. * Update contrib SHA * Remove excludes * Revert "Remove excludes" This reverts commit 1cf7b42db092248e7e11951c675852796b8ff745. * WIP * More WIP --------- Co-authored-by: Diego Hurtado --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/public-api-check.yml | 2 +- .github/workflows/test.yml | 27 ++++++++++++++++---------- CONTRIBUTING.md | 6 ++---- tox.ini | 27 +++++++++++++++----------- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 1036cb75400..4fccfe73524 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -25,7 +25,7 @@ jobs: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' - name: Install tox - run: pip install tox==3.27.1 -U tox-factor + run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs uses: actions/cache@v2 diff --git a/.github/workflows/public-api-check.yml b/.github/workflows/public-api-check.yml index 46432af0b54..67dcb798310 100644 --- a/.github/workflows/public-api-check.yml +++ b/.github/workflows/public-api-check.yml @@ -34,7 +34,7 @@ jobs: python-version: '3.10' - name: Install tox - run: pip install tox==3.27.1 -U tox-factor + run: pip install tox - name: Public API Check run: tox -e public-symbols-check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15565160154..0457d584f2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: d167ef7b43941a74378d625fea74628dd7572efa + CONTRIB_REPO_SHA: 1a984d3ba18d4080c58485b7d807dba241179d41 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when @@ -42,9 +42,6 @@ jobs: - "getting-started" - "opentracing-shim" - "opencensus-shim" - - "exporter-jaeger-combined" - - "exporter-jaeger-proto-grpc" - - "exporter-jaeger-thrift" - "exporter-opencensus" - "exporter-otlp-proto-common" - "exporter-otlp-combined" @@ -58,6 +55,16 @@ jobs: - "propagator-b3" - "propagator-jaeger" os: [ubuntu-20.04, windows-2019] + exclude: + - python-version: pypy3 + package: "opencensus-shim" + - python-version: pypy3 + package: "exporter-opencensus" + - python-version: pypy3 + package: "exporter-otlp-combined" + - python-version: pypy3 + package: "exporter-otlp-proto-grpc" + steps: - name: Checkout Core Repo @ SHA - ${{ github.sha }} uses: actions/checkout@v2 @@ -67,7 +74,7 @@ jobs: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' - name: Install tox - run: pip install tox==3.27.1 -U tox-factor + run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs uses: actions/cache@v2 @@ -75,7 +82,7 @@ jobs: path: | .tox ~/.cache/pip - key: v3-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', + key: v4-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core - name: Windows does not let git check out files with long names if: ${{ matrix.os == 'windows-2019'}} @@ -100,7 +107,7 @@ jobs: python-version: '3.10' architecture: 'x64' - name: Install tox - run: pip install tox==3.27.1 + run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs uses: actions/cache@v2 @@ -108,7 +115,7 @@ jobs: path: | .tox ~/.cache/pip - key: v3-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') + key: v4-tox-cache-${{ matrix.tox-environment }}-${{ hashFiles('tox.ini', 'dev-requirements.txt') }}-core - name: run tox run: tox -e ${{ matrix.tox-environment }} @@ -169,7 +176,7 @@ jobs: - "tornado" - "tortoiseorm" - "urllib" - - "urllib3" + - "urllib3v" - "wsgi" - "prometheus-remote-write" - "richconsole" @@ -191,7 +198,7 @@ jobs: python-version: ${{ env[matrix.python-version] }} architecture: 'x64' - name: Install tox - run: pip install tox==3.27.1 -U tox-factor + run: pip install tox - name: Cache tox environment # Preserves .tox directory between runs for faster installs uses: actions/cache@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 344b5585853..485cb6a0fcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,14 +38,12 @@ during their normal contribution hours. This project uses [tox](https://tox.readthedocs.io) to automate some aspects of development, including testing against multiple Python versions. -To install `tox`, run[^1]: +To install `tox`, run: ```console -$ pip install tox==3.27.1 +$ pip install tox ``` -[^1]: Right now we are experiencing issues with `tox==4.x.y`, so we recommend you use this version. - You can run `tox` with the following arguments: - `tox` to run all existing tox commands, including unit tests for all packages diff --git a/tox.ini b/tox.ini index 035f8269e37..1bd0c98226e 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,7 @@ envlist = ; docs/getting-started py3{8,9,10,11}-opentelemetry-getting-started + pypy3-opentelemetry-getting-started py3{8,9,10,11}-opentelemetry-opentracing-shim pypy3-opentelemetry-opentracing-shim @@ -31,6 +32,7 @@ envlist = ; exporter-opencensus intentionally excluded from pypy3 py3{8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-common + pypy3-proto{3,4}-opentelemetry-exporter-otlp-proto-common ; opentelemetry-exporter-otlp py3{8,9,10,11}-opentelemetry-exporter-otlp-combined @@ -90,8 +92,8 @@ deps = setenv = ; override CONTRIB_REPO_SHA via env variable when testing other branches/commits than main ; i.e: CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e - CONTRIB_REPO_SHA={env:CONTRIB_REPO_SHA:"main"} - CONTRIB_REPO="git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@{env:CONTRIB_REPO_SHA}" + CONTRIB_REPO_SHA={env:CONTRIB_REPO_SHA:main} + CONTRIB_REPO=git+https://github.com/open-telemetry/opentelemetry-python-contrib.git@{env:CONTRIB_REPO_SHA} mypy: MYPYPATH={toxinidir}/opentelemetry-api/src/:{toxinidir}/tests/opentelemetry-test-utils/src/ changedir = @@ -127,11 +129,11 @@ commands_pre = protobuf: pip install {toxinidir}/opentelemetry-proto getting-started: pip install -r requirements.txt - getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http" - getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation" - getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests" - getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi" - getting-started: pip install -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-flask&subdirectory=instrumentation/opentelemetry-instrumentation-flask" + getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http + getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation + getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests + getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi + getting-started: pip install -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-flask&subdirectory=instrumentation/opentelemetry-instrumentation-flask opencensus: pip install {toxinidir}/exporter/opentelemetry-exporter-opencensus @@ -255,14 +257,17 @@ deps = requests~=2.7 markupsafe~=2.1 +allowlist_externals = + {toxinidir}/scripts/tracecontext-integration-test.sh + commands_pre = pip install -e {toxinidir}/opentelemetry-api \ -e {toxinidir}/opentelemetry-semantic-conventions \ -e {toxinidir}/opentelemetry-sdk \ - -e "{env:CONTRIB_REPO}#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http" \ - -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation" \ - -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests" \ - -e "{env:CONTRIB_REPO}#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi" + -e {env:CONTRIB_REPO}\#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http \ + -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation \ + -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-requests&subdirectory=instrumentation/opentelemetry-instrumentation-requests \ + -e {env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation-wsgi&subdirectory=instrumentation/opentelemetry-instrumentation-wsgi commands = {toxinidir}/scripts/tracecontext-integration-test.sh