0

I'm using Jupyter Lab.

I would like know if there is a way to select some big part of the ipynb file without scrolling (in order to run the selected cells).

I guess a good way to do it would be by using the table of content on the left, but the "problem" is that when I click on a new part, it activates the first cell of this part so I can't use SHIFT + right click.

armandfavrot
  • 169
  • 9
  • (For others, it seem 'MAJ' is `Shift`-key equivalent on French keyboard.) Not that I'm aware of. By clicking the blue bars next to cells or a selection of cells, you can collapse a lot of things and use that to ease making large selections within the notebook; however, you still may need to scroll. Depending on what you are trying to do after you have selected cells that make up this big part, you may be able to use `nbformat` to programmatically process your notebook file. You'd have to share the reason for the selection? – Wayne Jun 21 '22 at 18:06
  • I want to select and then run the selection. Clicking the blue bars would not be convenient. – armandfavrot Jun 21 '22 at 19:24
  • You could make a utility script that takes a range and makes new notebook with the specified subset of cells from the input notebook. Sort of like [here](https://stackoverflow.com/a/71244733/8508004) and then you can run that notebook in the current namespace of the current one, using `%run subset_nb.ipynb`. I'm not recalling anything that does the process all together yet. I'm sure it is out there though. – Wayne Jun 21 '22 at 19:54
  • I edited my post. I don't have a definite subset to select and run. It's for daily use. – armandfavrot Jun 21 '22 at 20:20
  • Yes, the idea would be you could provide whatever range you wanted. Alternatively, you could provide a special 'start' signal as a string and a different 'end' signal string and the script would extract that portion to a new notebook so that you could run the extracted portion. – Wayne Jun 21 '22 at 21:16
  • Too complicated I think, because I often need to do that with changing subset to be run. The perfect thing would be the following : I'm at a certain cell. I click on some part of the table of content and it doesn't activate the first cell of that part. I scroll a little bit to go to the cell I want, then SHIFT + right click and it's done. – armandfavrot Jun 21 '22 at 21:41

0 Answers0