Skip to content

Conversation

@lukeina2z
Copy link
Contributor

@lukeina2z lukeina2z commented Oct 14, 2025

Description

The generate_instrumentation_bootstrap.py script was failing with a ruff linting error (PLC0415: import should be at top-level) when checking the auto_instrumentation module.

Fixes #3878

Add noqa comment to suppress this error for the gevent monkey patch import, which is intentionally inside a try-except block for conditional loading. This allows the bootstrap generation script to complete successfully.

Error while running generate_instrumentation_bootstrap.py

pyerror2

The generate_instrumentation_bootstrap.py script was failing with a
ruff linting error (PLC0415: import should be at top-level) when
checking the auto_instrumentation module.

Add noqa comment to suppress this error for the gevent monkey patch
import, which is intentionally inside a try-except block for
conditional loading. This allows the bootstrap generation script
to complete successfully.
@lukeina2z lukeina2z requested a review from a team as a code owner October 14, 2025 03:25
@lukeina2z lukeina2z marked this pull request as draft October 14, 2025 03:26
@lukeina2z lukeina2z marked this pull request as ready for review October 14, 2025 03:27
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Oct 15, 2025
@xrmx
Copy link
Contributor

xrmx commented Oct 15, 2025

@lukeina2z any idea on why our tooling does not raise that?

@emdneto
Copy link
Member

emdneto commented Oct 17, 2025

@lukeina2z any idea on why our tooling does not raise that?

I guess he is running a newer ruff version than the one we run in CI. When running with 0.6.9 I don't get the warnings

@lukeina2z
Copy link
Contributor Author

lukeina2z commented Oct 17, 2025

@lukeina2z any idea on why our tooling does not raise that?

@emdneto you are right, I manually installed the missing packages. Here is my pip list:

(.venv)
mac (25-10-17 12:47:36) <0> [~/github/otel-python/pr-work/opentelemetry-python-contrib-pr-a]
7cf34de09d4c % pip list
Package Version


anyio 4.11.0
astor 0.8.1
cachetools 6.2.1
certifi 2025.10.5
chardet 5.2.0
click 8.3.0
colorama 0.4.6
distlib 0.4.0
filelock 3.20.0
h11 0.16.0
hatch 1.15.1
hatchling 1.27.0
httpcore 1.0.9
httpx 0.28.1
hyperlink 21.0.0
idna 3.11
jaraco.classes 3.4.0
jaraco.context 6.0.1
jaraco.functools 4.3.0
keyring 25.6.0
markdown-it-py 4.0.0
mdurl 0.1.2
more-itertools 10.8.0
packaging 25.0
pathspec 0.12.1
pexpect 4.9.0
pip 24.3.1
platformdirs 4.5.0
pluggy 1.6.0
ptyprocess 0.7.0
Pygments 2.19.2
pyproject-api 1.10.0
rich 14.2.0
ruff 0.14.1
shellingham 1.5.4
sniffio 1.3.1
tomli 2.3.0
tomli_w 1.2.0
tomlkit 0.13.3
tox 4.31.0
trove-classifiers 2025.9.11.17
typing_extensions 4.15.0
userpath 1.9.2
uv 0.9.3
virtualenv 20.35.3
zstandard 0.25.0

7cf34de09d4c % python --version
Python 3.12.9

@xrmx
Copy link
Contributor

xrmx commented Oct 31, 2025

@lukeina2z could you please bump ruff version like in open-telemetry/opentelemetry-python#4782 ?

@xrmx xrmx removed the Skip Changelog PRs that do not require a CHANGELOG.md entry label Oct 31, 2025
@xrmx xrmx moved this to Reviewed PRs that need fixes in @xrmx's Python PR digest Oct 31, 2025
@lukeina2z lukeina2z changed the title fix: suppress ruff PLC0415 for conditional gevent import Bump ruff to 0.14.1 and fix new lint warnings Nov 11, 2025
@lukeina2z
Copy link
Contributor Author

@xrmx Bumped ruff to 0.14.1 and fixed new lint warnings.

@@ -1,4 +1,8 @@
import pytest
from tests.shared_test_utils import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should be imported from .shared_test_utils import


import fsspec
import pytest
from tests.shared_test_utils import (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@xrmx
Copy link
Contributor

xrmx commented Nov 11, 2025

@xrmx Bumped ruff to 0.14.1 and fixed new lint warnings.

Thanks! a couple of comments but LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Reviewed PRs that need fixes

Development

Successfully merging this pull request may close these issues.

bump ruff version

8 participants