Repository navigation
fix: _isnotebook() recognises JupyterLite, and Colab by its module - #167
Closed
petercorke wants to merge 1 commit into
Closed
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
It matched a shell class named Shell or ZMQInteractiveShell and had no JupyterLite check, so Camera took its desktop image-plane branch in the browser if the Pyodide shell has another name. Test for emscripten and for google.colab first, as RTB does and as spatialmath's environment() does (rai-opensource/spatialmath-python#271). Closes #166 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Owner
Author
|
Closing: this was opened by mistake. The Issue (#166) stays open for discussion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166.
_isnotebook()inbase/imageio.pyonly matched a shell class namedShellorZMQInteractiveShell. It had no JupyterLite check, soCamerawould take its desktop image-plane branch in the browser if the Pyodide shell has another name. It now returns True forsys.platform == "emscripten"(JupyterLite) and forgoogle.colabinsys.modules(Colab), then falls back to theZMQInteractiveShelltest. This is the same logic RTB uses, and the same as spatialmath'senvironment()(rai-opensource/spatialmath-python#271, open); this could use that once it is released.One behaviour change: a shell class that is merely named
Shelloutside Colab is no longer treated as a notebook.Does this change numerical results or public behaviour? No numerical results change.
Camera's image-plane reuse follows the notebook branch in JupyterLite where it may not have before. I have not checked whatget_ipython().__class__.__name__is in the MVTB Lite site, so I do not know whether it did before.Tested: new
tests/test_isnotebook.py(6 tests) with a fakeget_ipythonand patchedsys.modulesandsys.platform; no real notebook frontend is exercised.tests/test_image_io.pyandtests/test_camera.pypass.ruff formatreportsimageio.pyas unformatted at line 495, which is not part of this change.This change was written with Claude Code (Claude Sonnet 5.5).
🤖 Generated with Claude Code