fix: use public httpx Request/Response and bound httpx below 1.0 - #585
fix: use public httpx Request/Response and bound httpx below 1.0#585Tech Guy (lukiod) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses #568 by preventing import-time breakage when httpx 1.0 lands: it stops importing Request/Response from httpx private modules and adds <1.0 upper bounds so resolvers won’t select httpx 1.x while the SDK still references private httpx type aliases.
Changes:
- Switch
Request/Responseimport in the common HTTP client fromhttpx._modelsto the publichttpxexports. - Add
httpx<1.0upper bounds topackages/common,packages/apps(test group), andexamples/a2a. - Update
uv.lockto reflect the new constraints.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Locks httpx constraints with <1.0 where applicable. |
| packages/common/src/microsoft_teams/common/http/client.py | Uses public httpx.Request/httpx.Response imports instead of private module imports. |
| packages/common/pyproject.toml | Adds httpx<1.0 upper bound to the common package runtime dependency. |
| packages/apps/pyproject.toml | Adds httpx<1.0 upper bound to the apps package test dependency group. |
| examples/a2a/pyproject.toml | Adds httpx<1.0 upper bound for the example app dependency list. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hey Tech Guy (@lukiod), Thanks for filing this. We'll ideally want to fix the private _types aliases in the same PR as well but need to discuss how we want to handle this with the team first. It'll take some time before we reach a decision, just letting you know! |
Sounds good |
httpx 1.0 removes httpx._models and httpx._types, and the requirement was unbounded, so a fresh install would resolve to 1.0 and fail at import. Request and Response are public in both 0.x and 1.0, so they move to the public import. The _types aliases have no public equivalent in either version and appear in public method signatures, so they are left alone and the upper bound covers them.
b585dfb to
83e6b21
Compare
Fixes #568.
httpx 1.0 removes
httpx._modelsandhttpx._types, and the requirement was unbounded, so once 1.0 ships stable a fresh install resolves to it and everyimport microsoft_teams.*fails at import time.This does the two safe halves of the issue:
RequestandResponseare public in both 0.x and 1.0, sopackages/common/.../http/client.pynow imports them fromhttpxdirectly.<1.0upper bound added inpackages/common,packages/appsandexamples/a2a(plus the matchinguv.locklines).Left alone deliberately: the
_typesaliases (QueryParamTypes,RequestContent,RequestData,RequestFiles). They have no public equivalent in either 0.x or 1.0, and they appear in a lot of public method signatures, so picking a replacement is an API decision rather than a mechanical edit — the upper bound covers them until you decide. Happy to follow up with SDK-owned aliases if you want to go that way.Verified locally on httpx 0.28.1:
from httpx import Request, Responseresolves, andmicrosoft_teams.common.http.clientstill imports.uv run ruff check .— All checks passeduv run pytest -q— 1340 passedOne note:
ruff format --checkreportspackages/api/src/microsoft_teams/api/activities/install_update/__init__.pywould be reformatted. That is pre-existing onmain— same result with this branch stashed — and untouched here.