Skip to content

Commit 2fd5325

Browse files
committed
TQDM workaround due to unresponsive maintainer
tqdm has an incorrect detection of ZMQInteractiveShell when launch via a scheduler that bypass IPKernelApp. Think of JupyterHub cluster spawners and co. As of end of Feb 2025, the maintainer has been unresponsive for 5 months, to our fix, so we implement a workaround. I don't like it but we have few other choices. See `https://github.com/tqdm/tqdm/pull/1628`
1 parent b3a0999 commit 2fd5325

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ipykernel/zmqshell.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from jupyter_client.session import Session, extract_header
3535
from jupyter_core.paths import jupyter_runtime_dir
3636
from traitlets import Any, CBool, CBytes, Dict, Instance, Type, default, observe
37+
from traitlets.config import Config
3738

3839
from ipykernel import connect_qtconsole, get_connection_file, get_connection_info
3940
from ipykernel.displayhook import ZMQShellDisplayHook
@@ -472,6 +473,20 @@ def subshell(self, arg_s):
472473
class ZMQInteractiveShell(InteractiveShell):
473474
"""A subclass of InteractiveShell for ZMQ."""
474475

476+
def __init__(self, *args, **kwargs):
477+
super().__init__(*args, **kwargs)
478+
479+
# tqdm has an incorrect detection of ZMQInteractiveShell when launch via
480+
# a scheduler that bypass IPKernelApp Think of JupyterHub cluster
481+
# spawners and co. as of end of Feb 2025, the maintainer has been
482+
# unresponsive for 5 months, to our fix, so we implement a workaround. I
483+
# don't like it but we have few other choices.
484+
# See https://github.com/tqdm/tqdm/pull/1628
485+
if "IPKernelApp" not in self.config:
486+
self.config["IPKernelApp"] = Config(
487+
{"tqdm": "dummy value for https://github.com/tqdm/tqdm/pull/1628"}
488+
)
489+
475490
displayhook_class = Type(ZMQShellDisplayHook)
476491
display_pub_class = Type(ZMQDisplayPublisher)
477492
data_pub_class = Any() # type:ignore[assignment]

0 commit comments

Comments
 (0)