Skip to content

Conversation

@taeold
Copy link
Contributor

@taeold taeold commented Jul 21, 2025

Summary

This PR moves starlette, uvicorn, and uvicorn-worker from optional dependencies to direct dependencies, simplifying the installation process for users who need async functionality.

Impact Analysis

  • Installation size increase: < 1MB (specifically 816KB, ~3.5% increase)
  • Base installation: 23MB → With async deps: 24MB
  • Removes the need for pip install functions-framework[async]
  • Maintains Python 3.8+ requirement for these dependencies

Changes

  • Move async dependencies to direct dependencies in pyproject.toml
  • Remove [async] extra dependency configuration
  • Update imports to be direct instead of conditional
  • Remove "Starlette is not installed" error messages
  • Update tests to reflect direct dependency availability

Test Plan

All existing tests pass with 100% coverage. The async functionality remains unchanged, just the installation method is simplified.

taeold added 7 commits July 21, 2025 12:04
Based on dependency analysis, adding starlette, uvicorn, and uvicorn-worker as direct dependencies only increases installation size by ~816KB (3.5%). This minimal impact makes it reasonable to include them directly, simplifying installation for users who need async functionality while maintaining Python 3.8+ compatibility constraints.
…dencies - Remove async extras from tox.ini since deps are now direct - Update _http/__init__.py to import StarletteApplication directly - Remove try/except ImportError for starlette in aio/__init__.py - Remove error message about installing with [async] extra - Update test_asgi.py to import starlette directly - Remove test_import_error_without_starlette from test_aio.py - Fix test_http.py monkeypatch to work with direct imports
…sk apps Reverts the direct import of StarletteApplication to keep it as a dynamic import. This ensures that Flask-only users don't load the asgi module and its starlette/uvicorn dependencies unnecessarily.
Since async dependencies are now direct dependencies, we no longer need to install with [async] extras in the GitHub workflow.
@taeold taeold requested a review from maemayve July 22, 2025 15:21
@taeold taeold merged commit 82ba117 into GoogleCloudPlatform:main Jul 22, 2025
85 of 87 checks passed
@taeold taeold deleted the move-async-deps-to-direct branch July 22, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants