Skip to content

Commit ac7285e

Browse files
committed
add docstring
1 parent af3d13f commit ac7285e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bigframes/display/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020

2121

2222
def __getattr__(name: str) -> Any:
23+
"""Lazily import TableWidget to avoid ZMQ port conflicts.
24+
25+
anywidget and traitlets eagerly initialize kernel communication channels on
26+
import. This can lead to race conditions and ZMQ port conflicts when
27+
multiple Jupyter kernels are started in parallel, such as during notebook
28+
tests. By using __getattr__, we defer the import of TableWidget until it is
29+
explicitly accessed, preventing premature initialization and avoiding port
30+
collisions.
31+
"""
2332
if name == "TableWidget":
2433
try:
2534
import anywidget # noqa

0 commit comments

Comments
 (0)