diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index a016962c..da68a546 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -1,17 +1,10 @@ AAgent +ACMRTUXB ACard AClient -ACMRTUXB -aconnect -adk AError AFast -agentic AGrpc -aio -aiomysql -amannn -aproject ARequest ARun AServer @@ -19,6 +12,26 @@ AServers AService AStarlette AUser +DSNs +EUR +GBP +GVsb +INR +JPY +JSONRPCt +JWS +Llm +POSTGRES +RUF +SLF +Tful +aconnect +adk +agentic +aio +aiomysql +amannn +aproject autouse backticks cla @@ -29,32 +42,23 @@ coro datamodel deepwiki drivername -DSNs dunders euo -EUR excinfo fernet fetchrow fetchval -GBP genai getkwargs gle -GVsb ietf initdb inmemory -INR isready -JPY -JSONRPCt -JWS kwarg langgraph lifecycles linting -Llm lstrips mikeas mockurl @@ -64,7 +68,6 @@ oidc opensource otherurl postgres -POSTGRES postgresql protoc pyi @@ -74,14 +77,11 @@ pyversions redef respx resub -RUF -SLF socio sse tagwords taskupdate testuuid -Tful tiangolo typeerror vulnz diff --git a/README.md b/README.md index 4964376e..d77b07a5 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,9 @@ Install the core SDK and any desired extras using your preferred package manager | ------------------------ | ------------------------------------------ | -------------------------------------------- | | **Core SDK** | `uv add a2a-sdk` | `pip install a2a-sdk` | | **All Extras** | `uv add "a2a-sdk[all]"` | `pip install "a2a-sdk[all]"` | -| **HTTP Server** | `uv add "a2a-sdk[http-server]"` | `pip install "a2a-sdk[http-server]"` | +| **protobuf** | `uv add "a2a-sdk[proto]"` | `pip install "a2a-sdk[proto]"` | +| **JSON-RPC Server** | `uv add "a2a-sdk[jsonrpc-server]"` | `pip install "a2a-sdk[jsonrpc-server]"` | +| **HTTP (REST) Server** | `uv add "a2a-sdk[http-server]"` | `pip install "a2a-sdk[http-server]"` | | **gRPC Support** | `uv add "a2a-sdk[grpc]"` | `pip install "a2a-sdk[grpc]"` | | **OpenTelemetry Tracing**| `uv add "a2a-sdk[telemetry]"` | `pip install "a2a-sdk[telemetry]"` | | **Encryption** | `uv add "a2a-sdk[encryption]"` | `pip install "a2a-sdk[encryption]"` | diff --git a/pyproject.toml b/pyproject.toml index 46f7400a..3fb811c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,8 +11,6 @@ dependencies = [ "httpx>=0.28.1", "httpx-sse>=0.4.0", "pydantic>=2.11.3", - "protobuf>=5.29.5", - "google-api-core>=1.26.0", ] classifiers = [ @@ -29,9 +27,11 @@ classifiers = [ ] [project.optional-dependencies] -http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"] +proto = ["protobuf>=5.29.5"] +jsonrpc-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"] +http-server = ["a2a-sdk[jsonrpc-server]", "a2a-sdk[proto]"] encryption = ["cryptography>=43.0.0"] -grpc = ["grpcio>=1.60", "grpcio-tools>=1.60", "grpcio_reflection>=1.7.0"] +grpc = ["grpcio>=1.60", "grpcio-tools>=1.60", "grpcio_reflection>=1.7.0", "google-api-core>=1.26.0", "a2a-sdk[proto]"] telemetry = ["opentelemetry-api>=1.33.0", "opentelemetry-sdk>=1.33.0"] postgresql = ["sqlalchemy[asyncio,postgresql-asyncpg]>=2.0.0"] mysql = ["sqlalchemy[asyncio,aiomysql]>=2.0.0"] diff --git a/src/a2a/utils/proto_utils.py b/src/a2a/utils/proto_utils.py index e619cd72..7e87824e 100644 --- a/src/a2a/utils/proto_utils.py +++ b/src/a2a/utils/proto_utils.py @@ -7,7 +7,13 @@ from typing import Any -from google.protobuf import json_format, struct_pb2 + +try: + from google.protobuf import json_format, struct_pb2 +except ImportError as e: + raise ImportError( + 'proto-utils requires protobuf. Install with "pip install a2a-sdk[proto]"' + ) from e from a2a import types from a2a.grpc import a2a_pb2