Skip to content

Commit

Permalink
remove nest_asyncio dependency (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral authored Jan 28, 2025
1 parent 7cba927 commit 1520670
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 4 additions & 5 deletions lilya/cli/directives/operations/shell/base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

import asyncio
import select
import sys
from collections.abc import Callable, Sequence
from contextvars import copy_context
from typing import Any

import click
import nest_asyncio

from lilya._internal._events import AyncLifespanContextManager
from lilya.cli.directives.operations.shell.enums import ShellOption
Expand Down Expand Up @@ -53,14 +54,12 @@ async def run_shell(app: Any, lifespan: Any, kernel: str) -> None:
from lilya.cli.directives.operations.shell.ipython import get_ipython

ipython_shell = get_ipython(app=app)
nest_asyncio.apply()
ipython_shell()
await asyncio.to_thread(copy_context().run, ipython_shell)
else:
from lilya.cli.directives.operations.shell.ptpython import get_ptpython

ptpython = get_ptpython(app=app)
nest_asyncio.apply()
ptpython()
await asyncio.to_thread(copy_context().run, ptpython)


def handle_lifespan_events(
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Source = "https://github.com/dymmond/lilya"
all = [
"click>=8.1.7,<9.0.0",
"jinja2>=3.1.3",
"nest_asyncio>=1.6.0,<2.0.0",
"rich>=13.7.0,<15.0.0",
"uvicorn>=0.29.0",
"httpx>=0.22.0",
Expand All @@ -66,7 +65,6 @@ all = [
cli = [
"click>=8.1.7,<9.0.0",
"jinja2>=3.1.3",
"nest_asyncio>=1.6.0,<2.0.0",
"rich>=13.7.0,<15.0.0",
"uvicorn>=0.29.0",
]
Expand Down Expand Up @@ -232,7 +230,7 @@ source = ["tests", "lilya"]
# omit = []

[[tool.mypy.overrides]]
module = ["multipart.*", "mako.*", "nest_asyncio.*", "uvicorn.*"]
module = ["multipart.*", "mako.*", "uvicorn.*"]
ignore_missing_imports = true
ignore_errors = true

Expand Down

0 comments on commit 1520670

Please sign in to comment.