Skip to content

refactor(http): eliminate third-party httpx-sse dependency#1132

Open
Iwaniukooo11 wants to merge 5 commits into
a2aproject:mainfrom
Iwaniukooo11:mateusziwaniuk/refactor/remove-httpx-sse-rs1
Open

refactor(http): eliminate third-party httpx-sse dependency#1132
Iwaniukooo11 wants to merge 5 commits into
a2aproject:mainfrom
Iwaniukooo11:mateusziwaniuk/refactor/remove-httpx-sse-rs1

Conversation

@Iwaniukooo11

@Iwaniukooo11 Iwaniukooo11 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary
Removed the third-party dependency httpx-sse to reduce the SDK's attack surface. Replaced it with a native, lightweight Server-Sent Events (SSE) streaming parser inside the HTTP transport helpers.

Changes

  • Dependencies: Removed httpx-sse from pyproject.toml and updated uv.lock.
  • Client (http_helpers.py): Replaced EventSource.aiter_sse() with a local parse_sse_stream generator that parses streaming line blocks and yields typed event payloads.
  • Tests: Refactored test_rest_client.py and test_jsonrpc_client.py to mock standard Response line streaming instead of the third-party EventSource object.

Verification
Ran tests and linters locally with httpx-sse uninstalled:

./scripts/lint.sh
uv run pytest tests/client/transports/test_rest_client.py tests/client/transports/test_jsonrpc_client.py

Status: 72 tests passed, linter green.

Replaced httpx-sse imports with a native Server-Sent Events (SSE) streaming parser in the client transport helpers. Refactored transport unit tests to mock standard HTTP response line streaming. Removed the httpx-sse dependency from pyproject.toml and uv.lock.
@Iwaniukooo11 Iwaniukooo11 requested a review from a team as a code owner July 13, 2026 10:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the external httpx-sse dependency and implements a custom Server-Sent Events (SSE) parser (parse_sse_stream) to process streaming HTTP responses directly. Corresponding test suites have been updated to mock httpx.Response.aiter_lines instead of EventSource. Feedback was provided on a potential bug in the custom parser where buffered event data could be lost if the stream terminates without a trailing empty line, along with a suggestion to handle empty event fields correctly.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/a2a/client/transports/http_helpers.py
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/transports/http_helpers.py 93.59% 95.54% 🟢 +1.95%
src/a2a/server/events/event_queue_v2.py 91.71% 91.19% 🔴 -0.52%
src/a2a/utils/telemetry.py 91.47% 90.70% 🔴 -0.78%
Total 92.97% 92.97% ⚪️ 0.00%

Generated by coverage-comment.yml

@Iwaniukooo11 Iwaniukooo11 requested a review from ishymko July 13, 2026 13:26
Comment thread src/a2a/client/transports/http_helpers.py
Comment thread src/a2a/client/transports/http_helpers.py
@Iwaniukooo11 Iwaniukooo11 requested a review from ishymko July 14, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants