Skip to content

Commit 0f6c28b

Browse files
committed
Fix docs build: resolve InteractiveShell forward reference in KernelMagics
sphinx_autodoc_typehints cannot resolve inherited type annotations from parent classes in a different module. KernelMagics inherits shell: InteractiveShell from IPython's Magics, but sphinx evaluates it in the parent module's namespace. Re-declare the annotation in KernelMagics so sphinx resolves it in zmqshell.py where InteractiveShell is imported.
1 parent 770afbe commit 0f6c28b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ipykernel/zmqshell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def unregister_hook(self, hook):
251251
@magics_class
252252
class KernelMagics(Magics):
253253
"""Kernel magics."""
254+
shell: InteractiveShell | None # already imported in zmqshell.py
254255

255256
# ------------------------------------------------------------------------
256257
# Magic overrides

0 commit comments

Comments
 (0)