Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to support prompt_toolkit >3.0.37 #347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FantasqueX
Copy link
Contributor

@FantasqueX FantasqueX commented Dec 30, 2023

Currently one test will fail with latest prompt_toolkit(3.0.43). test_blank_line_fix will throw RuntimeError: no running event loop. By bisecting commit, the culprit is
prompt-toolkit/python-prompt-toolkit@a775996. This commit replaces custom get_event_loop with asyncio.get_event_loop. The former will creator a new loop if asyncio.get_running_loop fails while the latter won't. I mimic the changes in the examples to use asyncio.run and the test passes. I'm not sure whether more changes are needed.

What is the problem that this PR addresses?

Closes: #344

How did you solve it?

Use asyncio.run to make the test pass.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@FantasqueX
Copy link
Contributor Author

@kiancross Hi, could you please take a look at this? I'm not sure whether I have to do more except making all tests pass.

@FantasqueX
Copy link
Contributor Author

I've fixed code quality problem. Gently ping~

@florian6973
Copy link

Any update please?

@kiancross
Copy link
Collaborator

@FantasqueX Please could you merge latest changes into this branch and then I can run the CI.

Currently one test will fail with latest prompt_toolkit(3.0.43).
test_blank_line_fix will throw RuntimeError: no running event loop.
By bisecting commit, the culprit is
prompt-toolkit/python-prompt-toolkit@a775996.
This commit replaces custom `get_event_loop` with `asyncio.get_event_loop`.
The former will creator a new loop if `asyncio.get_running_loop` fails while the latter won't.
I mimic the changes in the examples to use `asyncio.run` and the test
passes.

Fixes: tmbo#344
@FantasqueX
Copy link
Contributor Author

@FantasqueX Please could you merge latest changes into this branch and then I can run the CI.

@kiancross Done :)

Copy link
Collaborator

@kiancross kiancross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is currently failing because there was a breaking change in 3.0.29, which changed the return type of create_pipe_input. Prior to this version, it did not return a context manager.

prompt-toolkit/python-prompt-toolkit@97ac514

Given we support these previous versions of prompt_toolkit (for reasons I am unaware of), I suppose some conditional logic needs to be added here?

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.

Update prompt_toolkit to be compatible with ipython
3 participants