Hide code input in CodeConsole when configured#18554
Hide code input in CodeConsole when configured#18554krassowski merged 3 commits intojupyterlab:mainfrom
code input in CodeConsole when configured#18554Conversation
|
Thanks for making a pull request to jupyterlab! |
|
I have kept this PR as a draft for now because I have yet to test JupyterLite with this change. I'd like to ensure this is the right fix. Could I please receive some guidance about this? Perhaps we should have some instructions over in the JupyterLite repo... |
Eventually, I ended up testing this by installing an editable version of JupyterLab into my JupyterLite deployment via Nevertheless, I can confirm this PR works (I added a video to the PR description). This is ready for review! |
|
Would it be possible to cover it in test suite it by adding a test similar to: jupyterlab/packages/console/test/widget.spec.ts Lines 363 to 382 in b7203bc |
|
Yes, of course, done. Note that this is essentially the same test as the |
krassowski
left a comment
There was a problem hiding this comment.
Verified that the test fails before and passes after, thank you @agriyakhetarpal!
… configured
References
jupyterlite/jupyterlite#1866
Code changes
When creating a new cell in
CodeConsole, I have added athis._config.hideCodeInputflag and hidden the cell's input area by callingcell.inputArea?.setHidden(true)before adding the cell. This should allow the console to hide cells that come fromcodeURL parameters in JupyterLite whenhideCodeInputis set.cc: @jtpio @xess0fd00m
User-facing changes
Cells added via
inject()were always visible regardless of the config, this should no longer be the case.For testing, navigate to
repl/index.html?kernel=python&hideCodeInput=1&code=import%20pandas%20as%20pd%0Afrom%20IPython.display%20import%20Markdown%2C%20display%0A%0Adisplay(Markdown(%27%27%27Loaded!!%27%27%27))I tested this on Vivaldi 7.8.3925.73 (macOS arm64) based on Chromium version 144.0.7559.220.
Before
Screen.Recording.2026-02-24.at.03.49.35.mov
After
Screen.Recording.2026-02-24.at.03.51.34.mov
Backwards-incompatible changes
None; this PR makes no change to JupyterLab public APIs.
AI usage