Skip to content

Commit 7fe8daf

Browse files
committed
fix(sdk/crewai): split EventBusListener import + attr-defined ignore on module
CI ruff check src/ fails on the 0.13.9-rc3 candidate with: I001 Import block is un-sorted or un-formatted --> src/nullrun/instrumentation/crewai.py:187:9 The two from crewai.events.* import lines had to share an import block per isort default rules — but the existing type-ignore comments attached them to a single line, which ruff flagged. ruff check --fix collapses the second line into a multi-line parenthesised block, but the # type: ignore[attr-defined] then lands on the attribute line (EventBusListener) instead of the module line, and mypy needs it on the module line to silence the "Module has no attribute 'EventBusListener'" error. Fix: split the import into a parenthesised block and put the attr-defined ignore on the module-level line, not the attribute line. Ruff is now satisfied (single block, sorted) and mypy is also satisfied (attr-defined error suppressed at the correct scope). Local verification: * ruff check src/ — "All checks passed!". * mypy src/nullrun/instrumentation/crewai.py — "Success: no issues found in 1 source file". * pytest tests/test_crewai_patch.py tests/test_runtime.py tests/test_runtime_branches.py test_track_batch_retry.py test_track_span_context.py test_v3_wire_contract.py — 142 passed, 1 skipped, 2 warnings. No runtime change; pure lint/typing patch.
1 parent 6dbc6d5 commit 7fe8daf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/nullrun/instrumentation/crewai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ def patch_crewai(runtime: Any) -> bool:
185185

186186
try:
187187
from crewai.events import crewai_event_bus # type: ignore[import-not-found]
188-
from crewai.events.event_bus import EventBusListener # type: ignore[import-not-found,attr-defined]
188+
from crewai.events.event_bus import ( # type: ignore[attr-defined]
189+
EventBusListener, # type: ignore[import-not-found,attr-defined]
190+
)
189191
except ImportError:
190192
# Pre-1.15 crewai lacks the event bus. Fall through to the
191193
# legacy callback injection so old versions still get

0 commit comments

Comments
 (0)