-
Notifications
You must be signed in to change notification settings - Fork 344
[HTTPXodus] migrate httpx to httpx2 (hard switch; closes #1856) - #1857
[HTTPXodus] migrate httpx to httpx2 (hard switch; closes #1856) #1857ProgrammerPlus1998 wants to merge 2 commits into
Conversation
Use the actively maintained httpx2 fork (Pydantic Services) when available, falling back to httpx. 11 source files updated; the public API surface (httpx.Client, httpx.AsyncClient, httpx.Response, httpx.HTTPStatusError) behaves identically in both libraries. Tests: 431 passed, 1 failed (test_prompt - pre-existing on stock, reproduced on clean checkout before changes), 18 errors in tests requiring optional deps (langchain) not installed in the dev env. Refs: langfuse#1856
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude Code Review
This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.
CLAassistant
commented
Sep 4, 2026
CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1 Lockfile Is Stale
This adds httpx2 without regenerating uv.lock. The locked langfuse dependency metadata still contains only httpx, while every CI job installs dependencies with uv sync --locked. As a result, CI fails during dependency installation before linting, type checking, or tests can run. Please regenerate and commit the lockfile.
Prompt To Fix With AI
This is a comment left during a code review. Path: pyproject.toml Line: 12 Comment: **Lockfile Is Stale** This adds `httpx2` without regenerating `uv.lock`. The locked `langfuse` dependency metadata still contains only `httpx`, while every CI job installs dependencies with `uv sync --locked`. As a result, CI fails during dependency installation before linting, type checking, or tests can run. Please regenerate and commit the lockfile. --- For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Remove all try/except ImportError dual-import blocks and the 'import httpx2 as httpx' aliasing: direct 'import httpx2' in the 11 converted modules plus the remaining test files. Drop the httpx runtime dependency (httpx2>=2.12.0 unconditional; requires-python is already >=3.10). Fix the noise-reduction logger name to 'httpx2'. Refs: langfuse#1856
Uh oh!
There was an error while loading. Please reload this page.
Closes #1856
What this PR does
Complete hard switch from
httpxtohttpx2:try/except ImportErrordual-import block andimport httpx2 as httpxaliasing — directimport httpx2inmedia.py,_task_manager/media_manager.py,_utils/request.py,_client/client.py,_client/resource_manager.py, andapi/modulestest_media_manager,test_openai,test_resource_manager,test_additional_headers_simple,support/api_wrapper, ...)pyproject.toml: dropshttpx>=0.15.4,<1.0;httpx2>=2.12.0unconditional (requires-pythonis already>=3.10)logger.pynoise-reduction logger name follows the library rename:"httpx"→"httpx2"Generated code
langfuse/api/is generated from the API spec. The conversion is mechanical and API-identical, but the switch should also land in the generator/templates so the next regeneration doesn't overwrite it.Test results
pytest tests/unit: 632 passed; the 39 failures + 18 errors are identical on the base commit (verified by control run) — all are "Langfuse client is not initialized"-type environment issues, zero migration regressionsNotes for reviewer
httpx2verifies TLS against the OS trust store (viatruststore) instead of the bundledcertifi. Deployments that relied on certifi's CA bundle may needSSL_CERT_FILE/SSL_CERT_DIRafter the switch. Worth a line in the changelog.Happy to revise per review — and equally happy to close this PR if the maintainers would rather wait for
httpx1.0 stable. 🙏