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

Ability to specify jupytext as the viewer via URL #1211

Closed
jabbera opened this issue Feb 6, 2024 · 9 comments
Closed

Ability to specify jupytext as the viewer via URL #1211

jabbera opened this issue Feb 6, 2024 · 9 comments

Comments

@jabbera
Copy link

jabbera commented Feb 6, 2024

We send around alot of links like this to our jupyterhub instance: https://jupyterhubdev.private.tld/user-redirect/lab/tree/nfs-location/notebook.ipynb so people can open notebooks we consider common. They are sort of like complicated dashboards.

Jupytext support is exactly what we need to make these notebooks committed to source control more easily manageable.

However, I'm unable to find a query param or other URI modification I can add/do to the URL to tell jupyterlab to open in the Jupytext Notebook Viewer as opposed to whatever the user has configured for the default for .py files. IE something like:

https://jupyterhubdev.private.tld/user-redirect/lab/tree/nfs-location/notebook.py?renderer=Jupytext

or

https://jupyterhubdev.private.tld/user-redirect/lab/jupytext/nfs-location/notebook.py

If this isn't possible today can this be a requested feature?

@mwouts
Copy link
Owner

mwouts commented Feb 7, 2024

Hey @jabbera , thanks for reaching out!

I don't think this is possible at the moment (cc @mahendrapaipuri ?).

The closest that we can offer now is to setup Jupytext as the default viewer but you seem already aware of that option.

@mahendrapaipuri
Copy link
Contributor

As @mwouts pointed out, currently, defaultViwers is JupyterLab native way of changing renderers. The defaultViewers config setting is exposed by DocumentManager extension and not Jupytext. So, we cannot really modify the setting using Jupytext extension (at least not in an elegant way).

If you are using JupyterHub, you have something like c.Spawner.default_url config where you can set it /lab/tree/nfs-location/notebook.py so when users are redirected to their Lab instances the notebooks will be opened in Jupytext format. Do you think that will work for you @jabbera ?

@jabbera
Copy link
Author

jabbera commented Feb 7, 2024

@mahendrapaipuri I don't think that's exactly what I'm talking about. I can't change the default document viewer for all PY files. We have people who have their environment setup in very specific ways and I can't really mess with that. What I need is a way to tell JupyterLab to open a specific file in Jupytext via the URL. That way when we are sending out these dashboard links it doesn't matter how anyone has the document manager configured. Basically I need the Open in Jupytext context menu option triggerable via a query param or URL path modification.

@mahendrapaipuri
Copy link
Contributor

Basically I need the Open in Jupytext context menu option triggerable via a query param or URL path modification.

I am afraid that this needs to be addressed with JupyterLab's docmanager-extension as it is responsible for opening files. Jupytext itself registers its file type Jupytext Notebook with that extension and does not control on how the file will be opened. Does it make sense?

@jabbera
Copy link
Author

jabbera commented Feb 7, 2024

@mahendrapaipuri thanks! I'll follow up there.

@jabbera jabbera closed this as completed Feb 7, 2024
@bluss
Copy link

bluss commented Oct 20, 2024

@jabbera sorry to ask here, but did you find a solution to this? I'm looking at solving a similar issue but on local jupyterlab launch.

@jabbera
Copy link
Author

jabbera commented Oct 20, 2024

Negative and it's severely impacted my use of the extension.

@bluss
Copy link

bluss commented Oct 20, 2024

Ok, sorry to hear that. Thanks for reporting back!

@bluss
Copy link

bluss commented Oct 22, 2024

Partial good news from the linked issue: This feature is available in notebook, but not in lab (not jupyterlab).

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

No branches or pull requests

4 participants