AnswerDotAI / AnswerDotAI/fasthtml
[BUG] Performance improvement for non-uvicorn ASGI environments
- Dominant language
- Jupyter Notebook
- Stars
- 7k
- Forks
- 319
- Avg merge
- 28m
- Merged PRs (30d)
- 3
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**
```python
# 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:
- [x] I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
- [x] I have provided a minimal reproducible example
- [x] I have included the versions of fastlite, fastcore, and fasthtml
- [x] 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.
Contributor guide
Assessment
This issue has not been assessed yet.