Skip to content

[HTTPXodus] migrate httpx to httpx2 (hard switch) - #7677

Open
SiAgentBuild wants to merge 3 commits into
chroma-core:mainfrom
SiAgentBuild:httpxodus/httpx2-migration
Open

SiAgentBuild wants to merge 3 commits into
chroma-core:mainfrom
SiAgentBuild:httpxodus/httpx2-migration

Conversation

@SiAgentBuild

@SiAgentBuild SiAgentBuild commented Sep 3, 2026 •

Copy link
Copy Markdown

Closes #7671

🏷️ Part of HTTPXodus — a community effort to help major Python projects plan their path off the stalled httpx stable line onto httpx2, the actively maintained fork by Pydantic Services.

What this PR does

Complete hard switch from httpx to httpx2:

  • Replaces every import httpx with import httpx2 across the package — including the lazy and dynamic imports in chromadb/utils/embedding_functions/ (cloudflare, huggingface, jina, together, qwen, splade, onnx-mini-lm, roboflow) and the test suite (patch targets, ConnectError import)
  • Removes httpx from pyproject.toml and requirements.txt; httpx2>=2.12.0 is the only runtime HTTP dependency
  • Bumps requires-python to >=3.10 (httpx2 requires 3.10+; Python 3.9 is EOL since 2025-10)

Diff summary

21 files, +53 / −68 (commit 8586ca3):

Area Change
chromadb/api/ (6 files) Remove the if TYPE_CHECKING: httpx2 / else: httpx dual-mode blocks → plain import httpx2; one docstring updated
chromadb/utils/embedding_functions/ (8 files) Lazy import httpx → import httpx2; roboflow's importlib.import_module("httpx") → "httpx2"; install-hint messages now say pip install httpx2
chromadb/test/ (5 files) Patch targets updated (httpx.stream → httpx2.stream, chromadb.api.fastapi.httpx.Client → ...httpx2.Client); from httpx2 import ConnectError
pyproject.toml, requirements.txt Drop httpx>=0.27.0; httpx2>=2.12.0 without version marker; requires-python = ">=3.10"

Test results

  • chromadb/test/api/test_base_http_client.py — the suite that exercises retry/backoff against httpx2.Response/httpx2.Request: 5/5 pass in an isolated environment with httpx2 2.12.0 and no httpx installed
  • All changed modules compile and import cleanly
  • Full integration suite not run locally (requires a running server)

Notes for reviewer

  • ⚠️ Python 3.9 dropped: httpx2 supports 3.10+, and Python 3.9 has been EOL since 2025-10. CI still has a 3.9 job, which will fail at dependency install until the matrix drops 3.9 — happy to include that change here or as a separate PR, your call.
  • ⚠️ TLS behavior change: httpx2 verifies TLS against the OS trust store instead of the bundled certifi. Self-hosted chroma deployments behind corporate proxies or in minimal containers that relied on certifi's CA bundle may need SSL_CERT_FILE / SSL_CERT_DIR after the switch. Worth a line in the changelog.
  • clients/python/pyproject.toml still lists httpx>=0.27.0, but that package has no import httpx in its code — left untouched to keep this PR scoped; can be dropped in a follow-up.

Happy to revise per review — and equally happy to close this PR if the maintainers would rather wait for httpx 1.0 stable. 🙏

Use the actively maintained httpx2 fork (Pydantic Services) when running
on Python 3.10+, falling back to httpx on 3.9. Five call sites in
chromadb/api/{base_http_client,fastapi,async_fastapi,client,async_client}.py
and a new conditional dependency in pyproject.toml.

Refs: chroma-core#7671

@claude claude 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.

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.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Convert the httpx usages the previous commit missed: embedding
functions (lazy, dynamic, and top-level imports), tests (patch
targets, ConnectError import), and requirements.txt. Drop the httpx
dependency, remove the python_version marker on httpx2, and bump
requires-python to >=3.10 (httpx2 requires 3.10+; Python 3.9 is EOL
since 2025-10).

Refs: chroma-core#7671
@SiAgentBuild
SiAgentBuild force-pushed the httpxodus/httpx2-migration branch from bd50df6 to 8586ca3 Compare September 9, 2026 08:14
@SiAgentBuild SiAgentBuild changed the title [HTTPXodus] migrate httpx to httpx2 (dual import) [HTTPXodus] migrate httpx to httpx2 (hard switch) Sep 9, 2026

This branch has not been deployed

No deployments
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.

[HTTPXodus] Consider migrating from httpx to httpx2 (the actively maintained fork)

1 participant