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

Access files outside of notebook-dir #534

Closed
mlucool opened this issue Jun 2, 2021 · 4 comments · Fixed by #549
Closed

Access files outside of notebook-dir #534

mlucool opened this issue Jun 2, 2021 · 4 comments · Fixed by #549

Comments

@mlucool
Copy link

mlucool commented Jun 2, 2021

Problem

There are many cases when a user would want to access file outside of their notebook-dir. For example, @krassowski has created a workaround to allow for symlinks to open python paths in LSP (lsp installation, more info). In other cases, a user may want to open a notebook that lives out of their notebook-dir (e.g. in a shared directory). Today the best option is again to symlink.

We should allow for users allow for one more more directories to be accessible outside of the notebook root directory. For example, I may set --notebook-dir=~/jupyter and then set the new flag --allowed-dirs=/ to allow for any file to be opened in my OS.

Proposed Solution

Add a traitlet which allows users to configure additional directories to allow Jupyter to open. In my usecase above I would set allowed-dirs to a parent of my notebook-dir, so this could be as simple as setting --notebook-dir to / and defaulting the file browser to open to ~/jupyter, but I suspect others would want something more general.

@kevin-bates
Copy link
Member

Hi Marc. I agree that the root_dir (aka, notebook_dir) is restrictive. I'm assuming these "external" locations would be things serviced by the api/contents endpoints where, today, all path references are relative to the root_dir and, if not located within the root_dir result in 404 errors.

I have some questions and thoughts but perhaps it might be best to discuss this at tomorrow's Server Dev meeting if you can make it? If not, we can continue the discussion here.

@mlucool
Copy link
Author

mlucool commented Jun 3, 2021

I can make the first half hour of today's meeting

@kevin-bates
Copy link
Member

Awesome - thanks for taking the time to talk about this.

@kevin-bates
Copy link
Member

I've included a summary of the discussion here (thanks everyone!). You can also find it in the team-compass link that @Zsailer just included immediately above this comment.

Approach:

  • Add a new trait to represent the "preferred" or "starting" directory (e.g., preferred_dir)
  • preferred_dir
    • will default to root_dir (aka notebook_dir)
    • is required to be an existing directory residing at or within root_dir
    • is a "suggestion" to client applications. Client applications can honor preferred_dir and start their file-browser at preferred_dir instead of root_dir.

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

Successfully merging a pull request may close this issue.

2 participants