Skip to content

execution count more atomic, run_cell_async reenterable#15088

Merged
Carreau merged 1 commit intoipython:mainfrom
drorspei:main
Dec 3, 2025
Merged

execution count more atomic, run_cell_async reenterable#15088
Carreau merged 1 commit intoipython:mainfrom
drorspei:main

Conversation

@drorspei
Copy link
Copy Markdown
Contributor

@drorspei drorspei commented Dec 1, 2025

This pull request makes run_cell_async able to re-enter itself without messing the history causing a new session. This solves issue #15087

The changes are to increment execution_count of InteractiveShell before running the user code in a cell, and some compatible changes so that prompts and outputs get the correct execution_count.

With this change it's possible to modify frontends so that they can run multiple cells concurrently. I've written a small one-file package on top of ipykernel that shows this nicely and works well

https://github.com/drorspei/bgipykernel

@Carreau Carreau self-requested a review December 1, 2025 20:07
@Carreau
Copy link
Copy Markdown
Member

Carreau commented Dec 3, 2025

I don't super like the -1 in a few places, but let's try

@Carreau Carreau added this to the 9.8 milestone Dec 3, 2025
@Carreau Carreau merged commit b33d048 into ipython:main Dec 3, 2025
20 checks passed
@drorspei
Copy link
Copy Markdown
Contributor Author

drorspei commented Dec 3, 2025

Yeah... I tried the alternative of starting the execution count at 0 and having everything show the "current" execution_count, but other projects (e.g. ipykernel) already have their own minus ones, so the projects would have to be modified in tandem

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Dec 3, 2025

It should be released :-)

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.

2 participants