Skip to content

Commit 46e55db

Browse files
committed
fix: add known-third-party config for a2a and fix import ordering
Adds [tool.ruff.lint.isort] known-third-party = ["a2a"] so ruff classifies a2a imports consistently regardless of whether a2a-sdk is installed in the lint environment.
1 parent a06ada6 commit 46e55db

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ select = [
8686
"!src/**/*.py" = ["D"]
8787
"src/bedrock_agentcore/memory/metadata-workflow.ipynb" = ["E501"]
8888

89+
[tool.ruff.lint.isort]
90+
known-third-party = ["a2a"]
91+
8992
[tool.ruff.lint.pydocstyle]
9093
convention = "google"
9194

src/bedrock_agentcore/runtime/a2a.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,12 @@ def build_a2a_app(
177177

178178
_check_a2a_sdk()
179179

180-
from starlette.applications import Starlette
181-
from starlette.responses import JSONResponse
182-
from starlette.routing import Route
183-
184180
from a2a.server.apps import A2AStarletteApplication
185181
from a2a.server.request_handlers import DefaultRequestHandler
186182
from a2a.server.tasks import InMemoryTaskStore
183+
from starlette.applications import Starlette
184+
from starlette.responses import JSONResponse
185+
from starlette.routing import Route
187186

188187
runtime_url = os.environ.get(AGENTCORE_RUNTIME_URL_ENV, "http://localhost:9000/")
189188

tests/bedrock_agentcore/runtime/test_a2a.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import uuid
33
from unittest.mock import patch
44

5-
from starlette.testclient import TestClient
6-
75
from a2a.server.agent_execution import AgentExecutor, RequestContext
86
from a2a.server.events import EventQueue
97
from a2a.server.tasks import InMemoryTaskStore, TaskUpdater
108
from a2a.types import AgentCapabilities, AgentCard, AgentSkill, Part, TextPart
119
from a2a.utils import new_task
10+
from starlette.testclient import TestClient
11+
1212
from bedrock_agentcore.runtime.a2a import (
1313
BedrockCallContextBuilder,
1414
build_a2a_app,

tests/integration/runtime/test_a2a_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import uuid
1010

1111
import pytest
12-
from starlette.testclient import TestClient
13-
1412
from a2a.server.agent_execution import AgentExecutor, RequestContext
1513
from a2a.server.events import EventQueue
1614
from a2a.server.tasks import TaskUpdater
@@ -24,6 +22,8 @@
2422
)
2523
from a2a.utils import new_task
2624
from a2a.utils.errors import ServerError
25+
from starlette.testclient import TestClient
26+
2727
from bedrock_agentcore.runtime.a2a import BedrockCallContextBuilder, build_a2a_app
2828

2929

0 commit comments

Comments
 (0)