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

docmanager:open called from ipylab takes absolute paths #104

Open
nthiery opened this issue Aug 31, 2022 · 3 comments
Open

docmanager:open called from ipylab takes absolute paths #104

nthiery opened this issue Aug 31, 2022 · 3 comments

Comments

@nthiery
Copy link

nthiery commented Aug 31, 2022

The docmanager:open command, at least when called from ipylab, seems to interpret paths as absolute
from the lab root.

Option 1: this is a feature (possibly consistent with other pieces of JupyterLab); documentation mentionning the fact and suggesting how to open files referred to by a relative path from the current notebook would be helpful.

Option 2: it's a bug :-)

Thanks in advance!

@nthiery
Copy link
Author

nthiery commented Aug 31, 2022

Oh, and since I would use the ability to open a relative path in the
deployment of my courses for my 200 students class starting next
Tuesday, I am eager to beta-test anything, or any suggestion of workaround :-)

@jtpio
Copy link
Owner

jtpio commented Sep 2, 2022

Thanks @nthiery for reporting.

So it looks like the docmanager:open commands indeed takes a path relative to the JupyterLab root.

But since the kernel is decoupled and has access to the whole file system it could indeed be tricky to do this. Unless there is a way to retrieve the path of the JupyterLab root from the Python kernel, and then compute the relative path to the file before using the docmanager:open command from Python.

@nthiery
Copy link
Author

nthiery commented Sep 2, 2022

Thanks for the feedback!

Would it be complicated to extend the docmanager:open command in JupyterLab to also support relative paths? E.g. with some option "relative=True"?

Of course, from a user perspective it would be better to follow the standard convention: a path is absolute if it starts with '/'; but I can see that, depending on the history, this could be a problem for backward compatibility to change it at this stage.

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

2 participants