diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index a016962c..4d42f2ca 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -63,7 +63,6 @@ oauthoidc oidc opensource otherurl -postgres POSTGRES postgresql protoc diff --git a/README.md b/README.md index 4964376e..1416c489 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,8 @@ 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]"` | +| **JSON-RPC Server** | `uv add "a2a-sdk[jsonrpc-server]"` | `pip install "a2a-sdk[jsonrpc-server]"` | +| **HTTP+JSON/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..edeecc22 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,10 @@ classifiers = [ ] [project.optional-dependencies] -http-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"] +jsonrpc-server = ["fastapi>=0.115.2", "sse-starlette", "starlette"] +http-server = ["a2a-sdk[jsonrpc-server]", "protobuf>=5.29.5"] 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", "protobuf>=5.29.5"] 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 d077d62b..4f8a92cc 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[grpc] or a2a-sdk[http-server] depending on need"' + ) from e from a2a import types from a2a.grpc import a2a_pb2