diff --git a/acapy_agent/config/ledger.py b/acapy_agent/config/ledger.py index 507113d531..e177d37fc8 100644 --- a/acapy_agent/config/ledger.py +++ b/acapy_agent/config/ledger.py @@ -8,7 +8,6 @@ import markdown import prompt_toolkit -from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop from prompt_toolkit.formatted_text import HTML from uuid_utils import uuid4 @@ -239,9 +238,6 @@ async def select_aml_tty(taa_info, provision: bool = False) -> Optional[str]: + taa_html ) - # setup for prompt_toolkit - use_asyncio_event_loop() - prompt_toolkit.print_formatted_text(HTML(taa_html)) opts = [] diff --git a/acapy_agent/config/tests/test_ledger.py b/acapy_agent/config/tests/test_ledger.py index 813e9c5d88..3fb5af3f49 100644 --- a/acapy_agent/config/tests/test_ledger.py +++ b/acapy_agent/config/tests/test_ledger.py @@ -1,3 +1,4 @@ +import sys from unittest import IsolatedAsyncioTestCase import pytest @@ -634,9 +635,8 @@ async def test_ledger_accept_taa_not_tty_not_accept_config(self, mock_stdout): None, self.profile, taa_info, provision=False ) - @mock.patch("sys.stdout") - async def test_ledger_accept_taa_tty(self, mock_stdout): - mock_stdout.isatty = mock.MagicMock(return_value=True) + async def test_ledger_accept_taa_tty(self): + sys.stdout.isatty = mock.MagicMock(return_value=True) self.profile = await create_test_profile() taa_info = { @@ -645,7 +645,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout): } with ( - mock.patch.object(test_module, "use_asyncio_event_loop", mock.MagicMock()), mock.patch.object( test_module.prompt_toolkit, "prompt", mock.CoroutineMock() ) as mock_prompt, @@ -656,9 +655,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout): ) with ( - mock.patch.object( - test_module, "use_asyncio_event_loop", mock.MagicMock() - ) as mock_use_aio_loop, mock.patch.object( test_module.prompt_toolkit, "prompt", mock.CoroutineMock() ) as mock_prompt, @@ -669,9 +665,6 @@ async def test_ledger_accept_taa_tty(self, mock_stdout): ) with ( - mock.patch.object( - test_module, "use_asyncio_event_loop", mock.MagicMock() - ) as mock_use_aio_loop, mock.patch.object( test_module.prompt_toolkit, "prompt", mock.CoroutineMock() ) as mock_prompt, diff --git a/demo/runners/support/utils.py b/demo/runners/support/utils.py index ebd8c9e67b..609528da4c 100644 --- a/demo/runners/support/utils.py +++ b/demo/runners/support/utils.py @@ -7,7 +7,6 @@ import prompt_toolkit import pygments from prompt_toolkit.application import run_in_terminal -from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop from prompt_toolkit.formatted_text import FormattedText, PygmentsTokens from prompt_toolkit.patch_stdout import patch_stdout from prompt_toolkit.shortcuts import ProgressBar @@ -142,15 +141,7 @@ def flatten(args): yield arg -def prompt_init(): - if hasattr(prompt_init, "_called"): - return - prompt_init._called = True - use_asyncio_event_loop() - - async def prompt(*args, **kwargs): - prompt_init() with patch_stdout(): try: while True: diff --git a/poetry.lock b/poetry.lock index d1d78ec00c..f581e42aa7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1941,19 +1941,17 @@ virtualenv = ">=20.10.0" [[package]] name = "prompt-toolkit" -version = "2.0.10" +version = "3.0.50" description = "Library for building powerful interactive command lines in Python" optional = false -python-versions = ">=2.6,<3.0.dev0 || >=3.3.dev0" +python-versions = ">=3.8.0" groups = ["main"] files = [ - {file = "prompt_toolkit-2.0.10-py2-none-any.whl", hash = "sha256:e7f8af9e3d70f514373bf41aa51bc33af12a6db3f71461ea47fea985defb2c31"}, - {file = "prompt_toolkit-2.0.10-py3-none-any.whl", hash = "sha256:46642344ce457641f28fc9d1c9ca939b63dadf8df128b86f1b9860e59c73a5e4"}, - {file = "prompt_toolkit-2.0.10.tar.gz", hash = "sha256:f15af68f66e664eaa559d4ac8a928111eebd5feda0c11738b5998045224829db"}, + {file = "prompt_toolkit-3.0.50-py3-none-any.whl", hash = "sha256:9b6427eb19e479d98acff65196a307c555eb567989e6d88ebbb1b509d9779198"}, + {file = "prompt_toolkit-3.0.50.tar.gz", hash = "sha256:544748f3860a2623ca5cd6d2795e7a14f3d0e1c3c9728359013f79877fc89bab"}, ] [package.dependencies] -six = ">=1.9.0" wcwidth = "*" [[package]] @@ -2955,4 +2953,4 @@ didcommv2 = ["didcomm-messaging"] [metadata] lock-version = "2.1" python-versions = "^3.12" -content-hash = "cc1de5dbba1f6550873d8aee9b7df0367ebe83606933cb92e341d5b523f47c3b" +content-hash = "1176053f084869dafc9f1754b0eed17985beadc7b99dcbefd8290e86853bac55" diff --git a/pyproject.toml b/pyproject.toml index 564ee4c439..f056f653b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ marshmallow = "~3.26.1" nest_asyncio = "~1.6.0" packaging = "^24.2" portalocker = "^3.1.1" -prompt_toolkit = ">=2.0.9,<2.1.0" +prompt_toolkit = ">=2.0.9,<3.1.0" pydid = "^0.5.1" pyjwt = "~2.10.1" pyld = "^2.0.4"