Skip to content

Commit

Permalink
Deprecate the uvicorn.workers module (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Apr 13, 2024
1 parent 12c9ee3 commit 772c24b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
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

0 comments on commit 772c24b

Please sign in to comment.