Skip to content

Commit d6b9556

Browse files
committed
Add some comments about wtf is goin on
1 parent 377c728 commit d6b9556

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

jupyter_server/prometheus/metrics.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616

1717

1818
if (
19-
notebook_version_info is not None
20-
and notebook_version_info < (7,)
19+
notebook_version_info is not None # No notebook package found
20+
and notebook_version_info < (7,) # Notebook package found, is version 6
21+
# Notebook package found, but its version is the same as jupyter_server
22+
# version. This means some package (lookin at you, nbclassic) has shimmed
23+
# the notebook package to instead be imports from the jupyter_server package.
24+
# In such cases, notebook.prometheus.metrics is actually *this file*, so
25+
# trying to import it will cause a circular import. So we don't.
2126
and notebook_version_info != server_version_info
2227
):
23-
print("yes, we think we have an unshimmed notebook package")
24-
print(notebook_version_info)
2528
# Jupyter Notebook v6 also defined these metrics. Re-defining them results in a ValueError,
2629
# so we simply re-export them if we are co-existing with the notebook v6 package.
2730
# See https://github.com/jupyter/jupyter_server/issues/209

0 commit comments

Comments
 (0)