Skip to content

chore(deps): migrate to uvicorn-worker, silence deprecation - #96

Merged
Salil Das (sadlilas) merged 2 commits into
microsoft:mainfrom
colombod:chore/migrate-uvicorn-worker
Sep 1, 2026
Merged

chore(deps): migrate to uvicorn-worker, silence deprecation#96
Salil Das (sadlilas) merged 2 commits into
microsoft:mainfrom
colombod:chore/migrate-uvicorn-worker

Conversation

@colombod

@colombod Diego Colombo (colombod) commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Migration: Uvicorn Worker Dependency

Moves the Gunicorn worker off the deprecated uvicorn.workers module to the separate uvicorn-worker package, which is where uvicorn's own deprecation warning points.

Changes:

  • Added uvicorn-worker>=0.4.0 to pyproject.toml and uv.lock
  • Swapped gunicorn worker_class from uvicorn.workers.UvicornWorker to uvicorn_worker.UvicornWorker
  • Updated the worker import in tests and the class name in comments/docstrings
  • uvicorn 0.41.0 and gunicorn 25.1.0 unchanged

Why this is a no-op at runtime: uvicorn/workers.py and uvicorn_worker/_workers.py are identical apart from a license header, the deprecation warning itself, and two URLs inside comments. The worker class, its config construction, signal handling, and serve loop are the same code.

Where the deprecation actually surfaced: in the test suite. Gunicorn imports the worker class outside __main__, so Python's default warning filters suppress it in a normal server run. This removes the warning from pytest output and gets ahead of uvicorn eventually removing the module.

Verification:

  • uv sync --frozen succeeds (lockfile is consistent)
  • Gunicorn resolves uvicorn_worker.UvicornWorker through its real config path, with no DeprecationWarning
  • 1864 tests pass, 5 skipped
  • ruff check clean
  • No uvicorn.workers references remain anywhere in the repo

Added uvicorn-worker>=0.4.0 to pyproject.toml (uvicorn 0.41.0 and gunicorn 25.1.0 unchanged in uv.lock). Swapped gunicorn worker_class from uvicorn.workers.UvicornWorker to uvicorn_worker.UvicornWorker. Updated test references and stale worker import paths in codebase. No behavior change — dependency add + internal reference swap only.

🤖 Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
The uvicorn-worker rename only required updating the class name in the
_THIRD_PARTY_LOGGER_NAMES comment. Restore the full boundary note from
bb420e2 - the enumerated plain-text startup lines and the pointer to
gunicorn's --log-config / logconfig_dict - which is the only record of
that behaviour in the repo.
@sadlilas
Salil Das (sadlilas) merged commit d532711 into microsoft:main Sep 1, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants