Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opening active notebook from kernel - custom drive #15958

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

itsmevichu
Copy link
Contributor

Fixes #15931

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

Copy link

welcome bot commented Mar 10, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@itsmevichu itsmevichu changed the title Fix opening running notebook from kernel - custom drive Fix opening active notebook from kernel - custom drive Mar 10, 2024
@itsmevichu
Copy link
Contributor Author

I've noticed that localPath is intentionally used for the session creation. Is there a specific reason for this?

@krassowski krassowski added the bug label Mar 11, 2024
@krassowski
Copy link
Member

krassowski commented Mar 11, 2024

Thank you! The test failure appears related, if this change is indeed desired we should update the the tests too:


  ● docregistry/context › Context › #constructor() › should set the session path with local path

    expect(received).toEqual(expected) // deep equality

    Expected: "373e1985-29d0-487c-9153-91ae151c002b.txt"
    Received: "TestDrive:373e1985-29d0-487c-9153-91ae151c002b.txt"

      64 |         });
      65 |
    > 66 |         expect(context.sessionContext.path).toEqual(localPath);
         |                                             ^
      67 |       });
      68 |     });
      69 |

      at Object.<anonymous> (test/context.spec.ts:66:45)


Error: expect(received).toEqual(expected) // deep equality

Expected: "373e1985-29d0-487c-9153-91ae151c002b.txt"
Received: "TestDrive:373e1985-29d0-487c-9153-91ae151c002b.txt"

@jtpio jtpio added this to the 4.1.x milestone Mar 12, 2024
@krassowski
Copy link
Member

@jtpio this looks reasonable to me but wanted to check with you as the author of #15931 and someone who recently worked with the drive API - is this the right solution?

@jtpio
Copy link
Member

jtpio commented Mar 14, 2024

The change does look reasonable indeed.

As originally noticed in jupyterlite/jupyterlite#1227 there were some changes in JupyterLab 4 when it comes to the handling of these paths. Which led to this comment: #14519 (comment)

Looks like it was needed for the collaboration extension, although not sure why exactly. It could be because the collaboration drive replaces the default file browser.

@jtpio
Copy link
Member

jtpio commented Mar 14, 2024

Trying from the Binder for this PR (which has jupyter-collaboration installed), it does seem to be fixing the UX issue mentioned #14519 (comment) about the drive prefix being missing when hovering on the kernel in the running tab. However "New Console for Notebook" seems to be starting a different kernel, likely because the paths are now different:

image

@itsmevichu
Copy link
Contributor Author

@jtpio, I've tried opening the console via 'New Console for Notebook,' where it prompts to select a kernel. Upon choosing the notebook's kernel, the console opens with that selection as expected.

open-console.mp4

@jtpio
Copy link
Member

jtpio commented Mar 18, 2024

@itsmevichu normally the expected behavior is the same kernel being reused for both the notebook and the console:

jupyterlab-new-console-for-notebook.webm

@Zsailer
Copy link
Member

Zsailer commented Apr 1, 2024

@itsmevichu how's it going here?

It looks like this PR will solve this issue on jupyter-collaboration. 🚀

I was planning to work on PR but saw you had started one. Great work! I'm happy to help test and review going forward.

I also see the regression @jtpio mentioned when opening a console from a previous session when testing your PR. Let us know if you have questions here to push this PR through. Thanks!

@Zsailer
Copy link
Member

Zsailer commented Apr 1, 2024

However "New Console for Notebook" seems to be starting a different kernel, likely because the paths are now different:

@jtpio I think this is may be caused by jupyter-collaboration's replacement of the file browser, because I only see this behavior when jupyter-collaboration is installed (I tested this PR locally with + without JC).

@jtpio
Copy link
Member

jtpio commented Apr 2, 2024

Thanks @Zsailer for looking into this!

this is may be caused by jupyter-collaboration's replacement of the file browser, because I only see this behavior when jupyter-collaboration is installed (I tested this PR locally with + without JC).

OK so if this PR fixes the default install (without RTC), maybe we can look into fixing this in jupyter-collaboration directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't open a notebook from a drive using the running panel
4 participants