Install using pip install bgipykernel
Add the following line to your ipython_kernel_config.py file:
c.IPKernelApp.kernel_class = 'bgipykernel.NoAsyncLockBgIPythonKernel'
if you can't find your config file, run ipython profile locate.
- Move running cells to the background by running
%bg - List background cells using
%jobs - Kill them using
%kill
Screencast.from.2025-11-28.15-29-14.mp4
- Run multiple cells with
awaitconcurrently
Screencast.from.2025-11-28.14-42-47.mp4
- If you just want to use
awaitin multiple cells concurrently, usebgipykernel.NoAsyncLockIPythonKernel - If you just want
%bg, usebgipykernel.BgIPythonKernel - If you want both, use
bgipykernel.NoAsyncLockBgIPythonKernel
When using a %bg variant (i.e. BgIPythonKernel or NoAsyncLockBgIPythonKernel), interrupting the kernel can only happen at the byte code level, meaning functions like time.sleep don't get interrupted.