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
Make the default drive in the Contents Service configurable #16141
base: main
Are you sure you want to change the base?
Conversation
Thanks for making a pull request to jupyterlab! |
I guess this is intended to fix #16099 (missing 9). |
oops! haha yes, thank you @krassowski. Updated. |
Thanks @Zsailer for looking into this 👍
It looks like being able to set a different default drive would be similar to being able to set other services (for example the kernel manager) provided by the If we start adding new public methods to replace parts of a Raising the question now so we can get a better idea of how this would play with #15329 in the long run. |
I think this particular case is slightly different. This doesn't replace the e.g. Contents Manager, simply changing a property on the Contents Manager, so it's much less disruptive than swapping out a whole service. It does increase the API surface a small amount. However, regardless of what we do to improve the pluggability of the ServiceManager proposed in #15329, swapping out default Drives underneath the Contents API seems like something we'd want to allow either way. |
I think allowing to change the default drive at runtime is a bad idea because there are no control over when it changes and it can be changed at any moment by multiple extensions. As the default drive is already a top options of the https://github.com/jupyterlab/jupyterlab/blob/main/packages/services/src/manager.ts#L223 I second the idea of @jtpio that a better approach would be to make the service manager more extensible with a clear definition of the default plugins used. Something like: Resolve plugins for the service manager -> Create the service manager -> Create the app -> load the other plugins. |
this._defaultDrive = options.defaultDrive ?? new Drive({ serverSettings }); | ||
this._defaultDrive.fileChanged.connect(this._onFileChanged, this); | ||
// Create a drive for the Jupyter Server REST API. | ||
let contentsDrive = new Drive({ serverSettings, name: 'contents' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default drive name is Default
https://github.com/jupyterlab/jupyterlab/blob/main/packages/services/src/contents/index.ts#L1079
So although it is not a good name if this PR is merged, I would not change it for backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fair enough.
Thanks @fcollonval. We discussed this in the JupyterLab call today and reached a similar conclusion; however, the specifics for how to achieve this was a bit muddy. I'll think about this more and see if I can come up with a draft PR. @afshin previously attempted something similar in #13558. I'll dive into this a bit more and see what I can learn. Thank you, all, for reviewing so quickly. I'll post an update here once I can get more time to think about this. |
Hey @Zsailer sorry I was not able to connect to the call. I have a pretty good idea of how to achieve this. But unfortunately it requires a change in the lumino Basically it involves extracting the plugin resolver logic in its own class (because why should such great feat be hard linked to the
I think the first PR should stop there (aka not make the ServiceManager a composition of multiple tokens) as that can be addressed in a follow-up PR. There are also some security concerns raised by @echarles; should we have a specific control on the ServiceManager provider? As mentioned by @afshin in #13558 (comment) I don't think this is really an issue as the service manager can today be replaced at runtime. In fact the above proposal can even improve security because the previous hack won't be possible any longer if the only access to the service manager is through the token (not happening before a major release). And which extensions can be installed could be enforced through the existing white/black lists. |
|
@fcollonval should we discuss this in an issue on the Lumino repo? Or maybe there is one already? |
Issue opened => jupyterlab/lumino#697 |
Thanks!
For reference there is the link to the recording in the meeting notes of the call, in case that can be useful: jupyterlab/frontends-team-compass#229 (comment) |
References
Fixes #16099.
Code changes
This PR makes two changes:
defaultDrive
. The default drive doesn't need a prefix when a file path is given.setDefaultDrive
to update the default drive.Adds a public API to set/change the defaultDrive in the contents service.
Leaving this in draft state for now to discuss.
User-facing changes
There are no user-facing changes by default.
This allows extensions like
jupyter-collaboration
to set the default drive to something other than the REST API. In the RTC case, it uses the ydoc APIs.Backwards-incompatible changes
None.
@martinRenou @SylvainCorlay @davidbrochart @dlqqq @jzhang20133 @jtpio