Skip to content

fix: use public httpx Request/Response and bound httpx below 1.0 - #585

Open
Tech Guy (lukiod) wants to merge 1 commit into
microsoft:mainfrom
lukiod:fix-httpx-private-imports
Open

fix: use public httpx Request/Response and bound httpx below 1.0#585
Tech Guy (lukiod) wants to merge 1 commit into
microsoft:mainfrom
lukiod:fix-httpx-private-imports

Conversation

@lukiod

Copy link
Copy Markdown

Fixes #568.

httpx 1.0 removes httpx._models and httpx._types, and the requirement was unbounded, so once 1.0 ships stable a fresh install resolves to it and every import microsoft_teams.* fails at import time.

This does the two safe halves of the issue:

  • Request and Response are public in both 0.x and 1.0, so packages/common/.../http/client.py now imports them from httpx directly.
  • <1.0 upper bound added in packages/common, packages/apps and examples/a2a (plus the matching uv.lock lines).

Left alone deliberately: the _types aliases (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, Response resolves, and microsoft_teams.common.http.client still imports.
  • uv run ruff check . — All checks passed
  • uv run pytest -q — 1340 passed

One note: ruff format --check reports packages/api/src/microsoft_teams/api/activities/install_update/__init__.py would be reformatted. That is pre-existing on main — same result with this branch stashed — and untouched here.

Copilot AI lite review requested due to automatic review settings September 1, 2026 08:11

Copilot AI 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.

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/Response import in the common HTTP client from httpx._models to the public httpx exports.
  • Add httpx<1.0 upper bounds to packages/common, packages/apps (test group), and examples/a2a.
  • Update uv.lock to 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.

@lilyydu

Copy link
Copy Markdown
Collaborator

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!

@lukiod

Copy link
Copy Markdown
Author

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.
@lukiod
Tech Guy (lukiod) force-pushed the fix-httpx-private-imports branch from b585dfb to 83e6b21 Compare September 4, 2026 07:07
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.

httpx dependency is unbounded while the SDK imports httpx private modules, so httpx 1.0 will break installs

3 participants