Skip to content
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

Deprecate the uvicorn.workers module #2302

Merged
merged 2 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ Uvicorn provides a lightweight way to run multiple worker processes, for example

### Gunicorn

!!! warning
The `uvicorn.workers` module is deprecated and will be removed in a future release.

You should use the [`uvicorn-worker`](https://github.com/Kludex/uvicorn-worker) package instead.

```bash
python -m pip install uvicorn-worker
```

Gunicorn is probably the simplest way to run and manage Uvicorn in a production setting. Uvicorn includes a gunicorn worker class that means you can get set up with very little configuration.

The following will start Gunicorn with four worker processes:
Expand Down
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ if __name__ == "__main__":

### Running with Gunicorn

!!! warning
The `uvicorn.workers` module is deprecated and will be removed in a future release.

You should use the [`uvicorn-worker`](https://github.com/Kludex/uvicorn-worker) package instead.

```bash
python -m pip install uvicorn-worker
```

[Gunicorn][gunicorn] is a mature, fully featured server and process manager.

Uvicorn includes a Gunicorn worker class allowing you to run ASGI applications,
Expand Down
7 changes: 7 additions & 0 deletions uvicorn/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import signal
import sys
import warnings
from typing import Any

from gunicorn.arbiter import Arbiter
Expand All @@ -12,6 +13,12 @@
from uvicorn.config import Config
from uvicorn.main import Server

warnings.warn(
"The `uvicorn.workers` module is deprecated. Please use `uvicorn-worker` package instead.\n"
"For more details, see https://github.com/Kludex/uvicorn-worker.",
DeprecationWarning,
)


class UvicornWorker(Worker):
"""
Expand Down