update dep docs

This commit is contained in:
Jordan Frazier
2026-06-25 14:51:04 -04:00
parent 6e11f81a39
commit d7f596aa66
3 changed files with 11 additions and 5 deletions

View File

@ -45,6 +45,6 @@ RESET_ENVIRON = (
SYNC_WORKERS = (
"Use gunicorn's blocking 'sync' worker (Unix, --workers > 1) so the kernel "
"routes each request to an idle worker instead of queueing it behind an "
"in-flight request on a busy async worker. Requires the 'a2wsgi' package. "
"Off by default (async worker)."
"in-flight request on a busy async worker. Uses the 'a2wsgi' bridge bundled "
"with lfx on Unix. Off by default (async worker)."
)

View File

@ -680,12 +680,15 @@ def _launch_workers(
from lfx.cli.serve_gunicorn import LFXGunicornApp
if sync_workers:
# Fail fast in the parent rather than per-worker on first request.
# Fail fast in the parent rather than per-worker on first request. a2wsgi
# ships with lfx on Linux/macOS, so a missing import means a broken
# environment, not a forgotten optional install.
try:
import a2wsgi # noqa: F401
except ImportError as exc:
typer.echo(
"Error: --use-sync-workers requires the 'a2wsgi' package. Install it with: pip install a2wsgi",
"Error: --use-sync-workers needs 'a2wsgi', which ships with lfx on Linux/macOS; "
"it is missing, so reinstall lfx to restore your environment.",
err=True,
)
raise typer.Exit(1) from exc

View File

@ -42,7 +42,10 @@ def wsgi_application(environ, start_response):
try:
from a2wsgi import ASGIMiddleware
except ImportError as exc: # pragma: no cover - exercised via --use-sync-workers without the dep
msg = "lfx serve --use-sync-workers requires the 'a2wsgi' package. Install it with: pip install a2wsgi"
msg = (
"lfx serve --use-sync-workers needs 'a2wsgi', which ships with lfx on Linux/macOS; "
"it is missing, so reinstall lfx to restore your environment."
)
raise RuntimeError(msg) from exc
_bridge = ASGIMiddleware(app)
return _bridge(environ, start_response)