numpy.org icon indicating copy to clipboard operation
numpy.org copied to clipboard

Change prompt cell position for the NumPy REPL (do not merge)

Open agriyakhetarpal opened this issue 6 months ago • 4 comments

Brief description of what is fixed or changed

This PR changes the prompt cell position for the NumPy REPL from the default (bottom) to left. This is, at the moment, not intended to be merged, as it is solely for trying out the new feature that was introduced the recent JupyterLite 0.6 release. Here is a visual diff:

Scenario Before After
With the default import numpy as np snippet numpy org_ numpy org_ (1)
The example snippet is executed numpy org_ (2) numpy org_ (3)

This might currently remain blocked until https://github.com/jupyterlab/jupyterlab/issues/17597 is resolved (I previously attempted to fix this in JupyterLite, but I was later prompted to the fact that the fix lies in JupyterLab instead). I would be on the fence here personally, as both of the layouts look fine to me. However, if the line length in a code snippet is long, say, >70 characters, some of them might get hidden until the layout is expanded manually.

A follow-up item could be to introduce a width/ratio element (for the left or the right positions) which could control the initial state of the prompt cell panel's and the output side panel's widths – it's currently split 50-50 between both but I could see a use case for a 40-60 or 30-70 split (or vice versa).

cc: @jtpio

Closes gh-869

agriyakhetarpal avatar Jun 23 '25 16:06 agriyakhetarpal

Deploy Preview for numpy-org ready!

Name Link
Latest commit 3d7e765a203ecc63ec3c8ab95de11054f3f6e108
Latest deploy log https://app.netlify.com/projects/numpy-org/deploys/68598121f350b80008008005
Deploy Preview https://deploy-preview-872--numpy-org.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Jun 23 '25 16:06 netlify[bot]

Thanks @agriyakhetarpal!

Wondering if the example code could even be directly part of the input cell directly, using the left prompt cell position:

image

That way the dedicated code panel could even be removed.

Not sure if this would be better for users wanting to try numpy, since copy pasting may be a good way to better understand what each line does. But sharing this just as another option to consider.

jtpio avatar Jun 23 '25 16:06 jtpio

I agree! The instructions in the dedicated code panel could also be moved above the REPL and below the "Use the interactive shell [...]" text, instead of being in that code snippet.

agriyakhetarpal avatar Jun 23 '25 16:06 agriyakhetarpal

This might currently remain blocked until jupyterlab/jupyterlab#17597 is resolved

For reference I opened https://github.com/jupyterlab/jupyterlab/pull/17819 to look into improving this.

Although this would not have any impact if the default position is set to left.

jtpio avatar Aug 27 '25 08:08 jtpio