fix: lazy-load auth deps in web/Pyodide startup and add regression tests#6280
Merged
FeodorFitsner merged 9 commits intomainfrom Mar 9, 2026
Merged
fix: lazy-load auth deps in web/Pyodide startup and add regression tests#6280FeodorFitsner merged 9 commits intomainfrom
FeodorFitsner merged 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Pyodide/web startup crash caused by eager imports of optional auth dependencies (httpx, oauthlib) by deferring those imports until the relevant auth code paths are actually used.
Changes:
- Made
httpximports lazy inGitHubOAuthProvideruser/group fetching. - Made
httpx/oauthlibimports lazy inAuthorizationService(and adjusted typing to avoid oauthlib types at import-time). - Added regression tests ensuring
import flet/import flet.authsucceed whenhttpxandoauthlibare unavailable.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/python/packages/flet/tests/test_auth_lazy_imports.py | Adds regression tests that simulate missing optional auth deps and validate lazy-import behavior. |
| sdk/python/packages/flet/src/flet/auth/providers/github_oauth_provider.py | Moves httpx import into the async fetch methods to avoid import-time dependency. |
| sdk/python/packages/flet/src/flet/auth/authorization_service.py | Defers httpx/oauthlib imports to call sites and removes oauthlib type imports from module import-time. |
| sdk/python/packages/flet/src/flet/auth/init.py | Lazily exposes auth exports via module __getattr__ to avoid eager importing of auth implementation/provider modules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploying flet-docs with
|
| Latest commit: |
da92691
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f84dedff.flet-docs.pages.dev |
| Branch Preview URL: | https://fix-web-build.flet-docs.pages.dev |
Deploying flet-examples with
|
| Latest commit: |
da92691
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://019fcd4e.flet-examples.pages.dev |
| Branch Preview URL: | https://fix-web-build.flet-examples.pages.dev |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Import pytest and add pytestmark = pytest.mark.skip(reason="Temporarily disabled") in sdk/python/packages/flet/tests/test_object_diff_memory_churn.py to temporarily disable the memory churn test.
FeodorFitsner
approved these changes
Mar 9, 2026
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.
Fix #6258
Summary by Sourcery
Lazy-load optional authentication dependencies to avoid import-time failures when auth is unused and add regression tests to validate this behavior.
New Features:
Bug Fixes:
Enhancements:
Tests: