-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
📝 More explicitly explain dependencies in websockets doc page #9930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 More explicitly explain dependencies in websockets doc page #9930
Conversation
📝 Docs preview for commit 9944f99 at: https://64bc7cd6a11600468968067f--fastapi.netlify.app |
9944f99
to
9df46e2
Compare
📝 Docs preview for commit 9df46e2 at: https://64be82424e1061008bd78812--fastapi.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Uvicorn is even invoked a few paragraphs down in the same tutorial despite not being installed.
📝 Docs preview for commit 2e1bf33 at: https://ceb977ba.fastapitiangolo.pages.dev Modified Pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text of this section was updated since the time this PR was opened.
But it still looks a bit incomplete: it's said that we need to create environment and install websockets
, but it's said nothing about installing FastAPI itself.
How about the following?
## Install `uvicorn` and `websockets`
Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and install `fastapi`, `uvicorn` and `websockets`:
<div class="termy">
```console
$ pip install fastapi uvicorn websockets
---> 100%
```
</div>
/// tip
If you install FastAPI using `pip install fastapi[standard]`, you don't need to install websockets separately - it will be installed by default.
///
/// note
You will not interact with `websockets` package directly, it's required for Uvicorn to handle the websocket protocol.
///
As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR. |
The note at the top of the websockets doc page implies FastAPI has an implicit dependency on the
websockets
package. As a result, I mistakenly spent quite a bit of time reading thewebsockets
docs, thinking it would help me work with thefastapi.websocket
functionality.FastAPI itself instead relies solely on the Starlette WebSockets implementation, which has an entirely different API.
This MR attempts to update the documentation to make it more explicit WHY
websockets
is required. It's not a fastapi dependency by any means, but a uvicorn dependency (and the tutorial makes use of uvicorn)