fix(a2a): add A2A Python SDK as project dependency
CI / lint (pull_request) Successful in 3m44s
CI / typecheck (pull_request) Successful in 3m58s
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 24s
CI / security (pull_request) Successful in 4m3s
CI / quality (pull_request) Successful in 3m40s
CI / unit_tests (pull_request) Successful in 10m23s
CI / e2e_tests (pull_request) Successful in 17m10s
CI / integration_tests (pull_request) Successful in 25m25s
CI / coverage (pull_request) Successful in 14m4s
CI / docker (pull_request) Successful in 1m24s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m0s
CI / lint (pull_request) Successful in 3m44s
CI / typecheck (pull_request) Successful in 3m58s
CI / build (pull_request) Successful in 23s
CI / helm (pull_request) Successful in 24s
CI / security (pull_request) Successful in 4m3s
CI / quality (pull_request) Successful in 3m40s
CI / unit_tests (pull_request) Successful in 10m23s
CI / e2e_tests (pull_request) Successful in 17m10s
CI / integration_tests (pull_request) Successful in 25m25s
CI / coverage (pull_request) Successful in 14m4s
CI / docker (pull_request) Successful in 1m24s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m0s
Add a2a-sdk>=0.3.0 to [project.dependencies] in pyproject.toml. The specification mandates that both local (stdio) and server (HTTP) transports use the A2A Python SDK (ADR-047). Previously the package was absent from pyproject.toml and uv.lock, making the project non-compliant with the spec requirement. Changes: - Add 'a2a-sdk>=0.3.0' to [project.dependencies] in pyproject.toml - Regenerate uv.lock to include a2a-sdk 0.3.25 and its transitive deps - Add Behave scenarios confirming a2a is importable as a project dependency - Add step definitions for the new TDD scenarios ISSUES CLOSED: #2922
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
"""Step definitions for TDD issue #2922: A2A Python SDK dependency."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from behave import given, then, when
|
||||
from behave.runner import Context
|
||||
|
||||
|
||||
@given('the pyproject.toml file exists at "{path}"')
|
||||
def step_pyproject_exists(context: Context, path: str) -> None:
|
||||
"""Verify pyproject.toml exists at the given path."""
|
||||
pyproject_path = Path(path)
|
||||
assert pyproject_path.exists(), f"pyproject.toml not found at {path}"
|
||||
context.pyproject_path = pyproject_path
|
||||
|
||||
|
||||
@when("I read the project dependencies from pyproject.toml")
|
||||
def step_read_project_dependencies(context: Context) -> None:
|
||||
"""Read the [project.dependencies] list from pyproject.toml."""
|
||||
content = context.pyproject_path.read_bytes()
|
||||
data: dict[str, Any] = tomllib.loads(content.decode("utf-8"))
|
||||
context.project_dependencies = data.get("project", {}).get("dependencies", [])
|
||||
|
||||
|
||||
@then(
|
||||
'the dependency list should include a package that provides the "{module}" module'
|
||||
)
|
||||
def step_dependency_provides_module(context: Context, module: str) -> None:
|
||||
"""Assert that a dependency providing the given module is listed."""
|
||||
deps: list[str] = context.project_dependencies
|
||||
# The a2a-sdk package installs as the 'a2a' module.
|
||||
# Accept either 'a2a-sdk' or 'a2a' as the package name.
|
||||
found = any(
|
||||
dep.lower().startswith("a2a-sdk") or dep.lower().startswith("a2a>=")
|
||||
for dep in deps
|
||||
)
|
||||
assert found, (
|
||||
f"No dependency providing the '{module}' module found in "
|
||||
f"[project.dependencies]. Current deps: {deps}"
|
||||
)
|
||||
|
||||
|
||||
@when('I attempt to import the "{module_name}" module')
|
||||
def step_attempt_import(context: Context, module_name: str) -> None:
|
||||
"""Attempt to import the given module and record the result."""
|
||||
try:
|
||||
context.imported_module = importlib.import_module(module_name)
|
||||
context.import_error = None
|
||||
except ImportError as exc:
|
||||
context.imported_module = None
|
||||
context.import_error = exc
|
||||
|
||||
|
||||
@then("the import should succeed without errors")
|
||||
def step_import_succeeded(context: Context) -> None:
|
||||
"""Assert that the previous import attempt succeeded."""
|
||||
assert context.import_error is None, f"Import failed with: {context.import_error}"
|
||||
assert context.imported_module is not None, "Module was not imported"
|
||||
|
||||
|
||||
@when('I import "{module_path}" and access "{attr_name}"')
|
||||
def step_import_and_access(context: Context, module_path: str, attr_name: str) -> None:
|
||||
"""Import a module and access a named attribute."""
|
||||
try:
|
||||
mod = importlib.import_module(module_path)
|
||||
context.accessed_attr = getattr(mod, attr_name, None)
|
||||
context.access_error = None
|
||||
except ImportError as exc:
|
||||
context.accessed_attr = None
|
||||
context.access_error = exc
|
||||
|
||||
|
||||
@then('the "{attr_name}" class should be available')
|
||||
def step_class_available(context: Context, attr_name: str) -> None:
|
||||
"""Assert that the accessed attribute is a class."""
|
||||
assert context.access_error is None, f"Import failed with: {context.access_error}"
|
||||
assert context.accessed_attr is not None, (
|
||||
f"Attribute '{attr_name}' not found in module"
|
||||
)
|
||||
assert isinstance(context.accessed_attr, type), (
|
||||
f"'{attr_name}' is not a class, got {type(context.accessed_attr)}"
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
@tdd_issue @tdd_issue_2922
|
||||
Feature: A2A Python SDK is a declared project dependency
|
||||
As a CleverAgents developer
|
||||
I want the A2A Python SDK to be listed in pyproject.toml dependencies
|
||||
So that the SDK is always installed and importable in any project environment
|
||||
|
||||
Background:
|
||||
Given the pyproject.toml file exists at "pyproject.toml"
|
||||
|
||||
Scenario: a2a-sdk is listed in project dependencies
|
||||
When I read the project dependencies from pyproject.toml
|
||||
Then the dependency list should include a package that provides the "a2a" module
|
||||
|
||||
Scenario: a2a module is importable as a project dependency
|
||||
When I attempt to import the "a2a" module
|
||||
Then the import should succeed without errors
|
||||
|
||||
Scenario: a2a SDK provides the A2AClient class
|
||||
When I import "a2a.client" and access "A2AClient"
|
||||
Then the "A2AClient" class should be available
|
||||
@@ -48,6 +48,7 @@ dependencies = [
|
||||
"tomlkit>=0.13.0", # TOML writing with comment preservation for config CLI
|
||||
"tenacity>=8.2.0", # Retry framework for service layer resilience
|
||||
"aiohttp>=3.13.4", # CVE-2026-34515 mitigation: open redirect vulnerability
|
||||
"a2a-sdk>=0.3.0", # A2A Python SDK — required transport for local (stdio) and server (HTTP) modes (ADR-047)
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
Reference in New Issue
Block a user