diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 81f7bb40799..d7c7e0b8011 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -176,6 +176,25 @@ jobs: - name: Run tests run: tox -e lint-opentelemetry-opentracing-shim + lint-opentelemetry-opentracing-example: + name: opentelemetry-opentracing-example + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e lint-opentelemetry-opentracing-example + lint-opentelemetry-opencensus-shim: name: opentelemetry-opencensus-shim runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 721db3b6127..591a7f3831c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - logs: add exception support to Logger emit and LogRecord attributes ([#4907](https://github.com/open-telemetry/opentelemetry-python/issues/4907)) - Drop Python 3.9 support - ([#5076](https://github.com/open-telemetry/opentelemetry-python/pull/5076)) + ([#5076](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/5076)) +- Fix separate pylint config for opentracing example to resolve `# pylint: disable=import-error` workaround + ([#5037](https://github.com/open-telemetry/opentelemetry-python/pull/5037)) ## Version 1.41.0/0.62b0 (2026-04-09) diff --git a/docs/examples/opentracing/.pylintrc b/docs/examples/opentracing/.pylintrc new file mode 100644 index 00000000000..91f98df0b46 --- /dev/null +++ b/docs/examples/opentracing/.pylintrc @@ -0,0 +1,9 @@ +[MASTER] +init-hook='import sys; sys.path.insert(0, ".")' + +[MESSAGES CONTROL] +disable=missing-docstring, + too-few-public-methods + +[FORMAT] +expected-line-ending-format= \ No newline at end of file diff --git a/docs/examples/opentracing/rediscache.py b/docs/examples/opentracing/rediscache.py index 61025eac725..e6d9a1eca85 100644 --- a/docs/examples/opentracing/rediscache.py +++ b/docs/examples/opentracing/rediscache.py @@ -7,11 +7,8 @@ import pickle from functools import wraps -# FIXME The pylint disablings are needed here because the code of this -# example is being executed against the tox.ini of the main -# opentelemetry-python project. Find a way to separate the two. -import redis # pylint: disable=import-error -import redis_opentracing # pylint: disable=import-error +import redis +import redis_opentracing class RedisCache: diff --git a/tox.ini b/tox.ini index e3a7db365ab..1a94a905eef 100644 --- a/tox.ini +++ b/tox.ini @@ -39,6 +39,7 @@ envlist = py3{10,11,12,13,14,14t}-test-opentelemetry-opentracing-shim pypy3-test-opentelemetry-opentracing-shim lint-opentelemetry-opentracing-shim + lint-opentelemetry-opentracing-example py3{10,11,12,13,14}-test-opentelemetry-opencensus-shim ; opencensus-shim intentionally excluded from pypy3 (grpcio install fails) @@ -406,3 +407,13 @@ deps = pre-commit commands = pre-commit run --color=always --all-files {posargs} + +[testenv:lint-opentelemetry-opentracing-example] +deps = + -r dev-requirements.txt + -r {toxinidir}/docs/examples/opentracing/requirements.txt +setenv = + PYTHONPATH = {toxinidir}/docs/examples/opentracing +commands = + pylint --rcfile {toxinidir}/docs/examples/opentracing/.pylintrc {toxinidir}/docs/examples/opentracing + \ No newline at end of file