Skip to content

Commit 772c24b

Browse files
authored
Deprecate the uvicorn.workers module (#2302)
1 parent 12c9ee3 commit 772c24b

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

docs/deployment.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ Uvicorn provides a lightweight way to run multiple worker processes, for example
182182

183183
### Gunicorn
184184

185+
!!! warning
186+
The `uvicorn.workers` module is deprecated and will be removed in a future release.
187+
188+
You should use the [`uvicorn-worker`](https://github.com/Kludex/uvicorn-worker) package instead.
189+
190+
```bash
191+
python -m pip install uvicorn-worker
192+
```
193+
185194
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.
186195

187196
The following will start Gunicorn with four worker processes:

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ if __name__ == "__main__":
262262

263263
### Running with Gunicorn
264264

265+
!!! warning
266+
The `uvicorn.workers` module is deprecated and will be removed in a future release.
267+
268+
You should use the [`uvicorn-worker`](https://github.com/Kludex/uvicorn-worker) package instead.
269+
270+
```bash
271+
python -m pip install uvicorn-worker
272+
```
273+
265274
[Gunicorn][gunicorn] is a mature, fully featured server and process manager.
266275

267276
Uvicorn includes a Gunicorn worker class allowing you to run ASGI applications,

uvicorn/workers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import signal
66
import sys
7+
import warnings
78
from typing import Any
89

910
from gunicorn.arbiter import Arbiter
@@ -12,6 +13,12 @@
1213
from uvicorn.config import Config
1314
from uvicorn.main import Server
1415

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

1623
class UvicornWorker(Worker):
1724
"""

0 commit comments

Comments
 (0)