Skip to content

[BUG] Performance improvement for non-uvicorn ASGI environments #620

Open
@ryansb

Description

Describe the bug

fasthtml/core.py file imports uvicorn even though it's only used for serve() calls. For AWS Lambda this causes worse cold starts than if the uvicorn was imported inline of serve().

Minimal Reproducible Example

# Your code here
from fasthtml.core import *
uvicorn # uvicorn is imported and re-exported, even though it's only used in `serve()`

Expected behavior

I'd expect that users of other ASGI serving methods would not need to load uvicorn at runtime unless they are using it.

Environment Information
Please provide the following version information:

  • fastlite version: 0.1.1
  • fastcore version: 1.7.28
  • fasthtml version: 0.10.3

Confirmation
Please confirm the following:

  • I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
  • I have provided a minimal reproducible example
  • I have included the versions of fastlite, fastcore, and fasthtml
  • I understand that this is a volunteer open source project with no commercial support.

Additional context
Add any other context about the problem here.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions