- Notifications
You must be signed in to change notification settings - Fork5.5k
Add support for opening a document with a different factory#6315
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jtpio commentedMar 18, 2022
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. |
jtpio commentedMar 18, 2022
Probably this one could have special treatment. Right now the notebook/packages/application/src/shell.ts Lines 140 to 143 inc133317
An alternative could be to add it to the tree / dashboard page: |
jtpio commentedMar 18, 2022
Some proof of concept to explore this: tree-setting-editor.mp4Posting here for visibility, but should probably be explored more in another PR. |
fcollonval commentedMar 19, 2022
Thanks a lot for starting@jtpio. I got a call yesterday with@parmentelat about using Jupytext in notebook v7 (something we cannot overlook). Starting fromv1.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 |
jtpio commentedMar 19, 2022
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 |
jtpio commentedMar 19, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 |
jtpio commentedMar 20, 2022
This looks good when running with the fix proposed inmwouts/jupytext#933: jupytext-factory.mp4Just need to open it under |
fcollonval commentedMar 20, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 applyingjupyterlab/jupyterlab#11540 in Jupytext. |
jtpio commentedMar 20, 2022
Maybe only the |
jtpio commentedMar 21, 2022
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. |
jtpio commentedMar 21, 2022
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 |
fcollonval left a comment
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.
parmentelat commentedMar 21, 2022
indeed@jtpio many thanks ! |
jtpio commentedMar 21, 2022
Thanks@fcollonval and@parmentelat! Let's get this in then, and I'll start a new release right after. |
fcollonval commentedMar 21, 2022
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 |
jtpio commentedMar 21, 2022
Thanks@fcollonval let's track this in#6324. |

Uh oh!
There was an error while loading.Please reload this page.
First steps towardsjupyterlab/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