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

Open .py and .md documents with the Notebook factory (Jupytext) #6324

Closed
jtpio opened this issue Mar 21, 2022 · 6 comments
Closed

Open .py and .md documents with the Notebook factory (Jupytext) #6324

jtpio opened this issue Mar 21, 2022 · 6 comments
Milestone

Comments

@jtpio
Copy link
Member

jtpio commented Mar 21, 2022

Maybe only the Notebook factory should open in /notebooks then?

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 Router to deal with path like /notebooks/not/a-ipynb-file.ext URL to redirect to the /edit/not/a-ipynb-file.ext?factory=Jupytext%20Notebook if the extension is supported by Jupytext. What do you think @jtpio ?

Originally posted by @fcollonval in #6315 (comment)

@jtpio jtpio changed the title Open .py and .md documents with the Notebook factory (Jupytext) Open .py and .md documents with the Notebook factory (Jupytext) Mar 21, 2022
@jtpio jtpio added this to the 7.0 milestone Mar 21, 2022
@jtpio
Copy link
Member Author

jtpio commented Mar 21, 2022

@fcollonval I thought docRegistry.defaultWidgetFactory(path) would return "Notebook" for a .md or .py with Jupytext.

Which means there could be a check for this before redirecting to /notebooks or /edit here?

@fcollonval
Copy link
Collaborator

Today it is not possible to coerce a factory to a existing file types. You can link a type and a factory either when defining the factory or the type. But if they have been defined as separated. This cannot be changed - in fact Jupytext is unique in that sense that it create an impossible contract on the frontend using a factory for an unsupported type. I'm reluctant to modify Jupyter core to support that corner case.

Another possibility would be for Jupytext to override the default notebook factory plugin @jupyterlab/notebook-extension:widget-factory by providing its own version extending the file types supported.

@fcollonval
Copy link
Collaborator

This should be feasible by hard-coding the settings plugin id the toolbar customization is read from to ensure it loads the core definition.

@jtpio
Copy link
Member Author

jtpio commented Sep 19, 2023

@parmentelat just checking if the issue is now resolved with the latest Jupyter Notebook 7.0.3 release, as fixed by #6914 and linked issues and PRs?

@parmentelat
Copy link
Contributor

hi @jtpio

yes the issue can be deemed fixed indeed, we've been using jupytext notebooks in the classroom since early september without a glitch, thanks !

@jtpio
Copy link
Member Author

jtpio commented Sep 20, 2023

That's great to hear!

Thanks for the help, closing as fixed.

@jtpio jtpio closed this as completed Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants