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

Merged
merged 1 commit into from
Jul 24, 2024

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.

@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?

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

@kiancross Hi, I have added some conditional logic and make CI happy. Could you please review it again :)

@kiancross kiancross enabled auto-merge (squash) July 24, 2024 22:51
@kiancross kiancross merged commit 9bb5ae1 into tmbo:master Jul 24, 2024
59 checks passed
@fijemax
Copy link

fijemax commented Jul 26, 2024

Hello, can we tag a new version who is carrying this fix ?

@kiancross
Copy link
Collaborator

I'll push a new version within the next week.

@superlevure
Copy link

Hello, could we get a new release with this fix?

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
5 participants