Skip to content

Commit 500525f

Browse files
committed
feat: make uvicorn event loop configurable via OPEN_TERMINAL_UVICORN_LOOP
Defaults to 'auto' (uvicorn's default). Users hitting segfaults on Python 3.12 can set OPEN_TERMINAL_UVICORN_LOOP=asyncio to bypass uvloop. Refs #37
1 parent 736a947 commit 500525f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

open_terminal/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def run(
9898
click.echo("=" * 60)
9999
click.echo()
100100

101-
uvicorn.run("open_terminal.main:app", host=host, port=port, loop="asyncio")
101+
from open_terminal.env import UVICORN_LOOP
102+
uvicorn.run("open_terminal.main:app", host=host, port=port, loop=UVICORN_LOOP)
102103

103104

104105
@main.command()

open_terminal/env.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ def _resolve_file_env(var: str, default: str = "") -> str:
9393
"OPEN_TERMINAL_ENABLE_NOTEBOOKS",
9494
str(config.get("enable_notebooks", True)),
9595
).lower() not in ("false", "0", "no")
96+
UVICORN_LOOP = os.environ.get(
97+
"OPEN_TERMINAL_UVICORN_LOOP",
98+
config.get("uvicorn_loop", "auto"),
99+
)

0 commit comments

Comments
 (0)