-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add support for opening a document with a different factory #6315
Conversation
Keeping it could be useful, so it can be copy pasted and sent to other people (or bookmarked). But some folks used to the classic notebook might wonder what this actually means. |
Probably this one could have special treatment. Right now the notebook/packages/application/src/shell.ts Lines 140 to 143 in c133317
An alternative could be to add it to the tree / dashboard page: |
Some proof of concept to explore this: tree-setting-editor.mp4Posting here for visibility, but should probably be explored more in another PR. |
Thanks a lot for starting @jtpio. I got a call yesterday with @parmentelat about using Jupytext in notebook v7 (something we cannot overlook). Starting from v1.13.2, Jupytext uses the document factory to display files with the notebook editor. So we definitely should check this PR works with Jupytext. cc @mwouts |
Thanks @fcollonval for the heads up. I think it should work with the Jupytext Notebook factory. Maybe we'll need to make sure it properly opens with the I installed
The lab extension loads fine. However the
|
Ah looks like it tries to import Which could be related since these are not available in Notebook v7... (but could be shimmed?) Does jupytext work with Jupyter Server / JupyterLab only? Or does it expect the classic notebook server (via the |
This looks good when running with the fix proposed in mwouts/jupytext#933: jupytext-factory.mp4Just need to open it under |
Thanks a lot for testing it with Jupytext.
How do you plan to support that case? I think we will be able to supported it out of the box by applying jupyterlab/jupyterlab#11540 in Jupytext. |
Maybe only the |
Documents now open with their default factory, for example when double-clicking on the item in the file browser. When opened with a different factory, default-factory.mp4This also means that some files like JSON now open with the JSON viewer instead of the text editor by default. This differs from the behavior of the classic notebook and could maybe be customized via the settings if needed. Opening with the default JSON viewer by default is however useful because it's coherent with the behavior in JupyterLab. |
cc @fcollonval if you would like to have a look. Happy to get this in and iterate further. We can also make a new alpha release if that can ease development of third-party extensions like |
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.
Thanks a lot for this one.
indeed @jtpio many thanks ! |
Thanks @fcollonval and @parmentelat! Let's get this in then, and I'll start a new release right after. |
Looking into this briefly, the trouble for jupytext are actually for file types already defined in core (like .py or .md). I was thinking to use the |
Thanks @fcollonval let's track this in #6324. |
First steps towards jupyterlab/retrolab#290.
For example when opening a JSON file with different factories:
open-factory-edit.mp4
This is also useful so folks can open notebooks with the text editor too:
open-factory-notebook.mp4
TODO
Should this work for arbitrary widgets, like the settings editor? Decide whether to do this in this PR or as follow-up-> deferring to another PR / issue, see this comment for a proof of concept: Add support for opening a document with a different factory #6315 (comment)?factory=
URL parameter be removed from the URL after the document is opened? -> keeping it when it is notdefault
, so the page can be reloaded and the document renders the same