[HTTPXodus] migrate httpx to httpx2 (dual import) - #6811
Open
ProgrammerPlus1998 wants to merge 3 commits into
Open
[HTTPXodus] migrate httpx to httpx2 (dual import)#6811ProgrammerPlus1998 wants to merge 3 commits into
ProgrammerPlus1998 wants to merge 3 commits into
Conversation
Adopt the actively maintained httpx2 fork (Pydantic Services) on Python 3.10+, fall back to httpx on 3.9. Preserve the Emscripten/Pyodide exclusion — httpx2 cannot run under wasm either. All call sites are in the auth/OAuth code path (flet.auth.authorization_service and the built-in OAuth providers). Refs: flet-dev#6809
Removes the if/else/trial dual-import blocks. All call sites now use 'import httpx2' directly. The pyproject keeps the 'httpx' marker line for Python <3.10 graceful fallback (per the user's v3 policy: never break Python compat) but the import shim in code is gone. Refs: flet-dev#6809
Contributor
|
I liked previous commit with httpx2 aliasing to httpx. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #6809
What this PR does
Hard switch from
httpxtohttpx2in the SDK code:try/exceptdual-import shim fromauthorization_service.pyandgithub_oauth_provider.pyimport httpx2directly (no aliasas httpx, no fallback)httpx.Xreferences updated tohttpx2.Xpyproject.tomlkeeps thehttpxmarker line for Python <3.10 graceful install (thepython_version < '3.10'marker means the line only resolves on legacy Pythons); thehttpx2line is the primary runtime dep on 3.10+Diff summary
2 files, +5 / −20 (commit
9be4590):sdk/python/packages/flet/src/flet/auth/authorization_service.pytry/exceptblocks;import httpx2direct;httpx.Request/httpx.AsyncClient/httpx.HTTPStatusError→httpx2.Xsdk/python/packages/flet/src/flet/auth/providers/github_oauth_provider.pytry/exceptblocks; samehttpx2direct imports; same.XrenameThe previous "v3 amend" (commit
8f5b200) was an inflated report — it only renamedhttpx.X→httpx2.Xwhile leaving thetry/exceptstructure. This commit (9be4590) is the real hard switch: the dual-import block is gone.Test results
python -c "import flet; from flet.auth.authorization_service import AuthorizationService; print('ok')"✓httpx2.HTTPStatusError,httpx2.Request,httpx2.AsyncClientreferences resolve to thehttpx2moduleNotes for reviewer
httpx2verifies TLS against the OS trust store instead of the bundledcertifi. Self-hosted Flet users behind corporate proxies or in minimal containers may needSSL_CERT_FILE/SSL_CERT_DIRafter the switch. Worth a line in the changelog.httpx2line inpyproject.tomlbecause of thepython_version >= "3.10"marker. Thehttpxfallback line is for theoretical compat only.Co-Authored-By: Claudetrailer, no drive-by changes.Happy to revise per review — and equally happy to close this PR if the maintainers would rather wait for
httpx1.0 stable. 🙏