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

Support symlinked app directory #6240

Merged
merged 5 commits into from Apr 24, 2019
Merged

Conversation

@saulshanabrook
Copy link
Member

@saulshanabrook saulshanabrook commented Apr 24, 2019

This fixes #6166 by not resolving an application directory that is a symlinked until it is needed. This allows users to have an app dir that is a symlink, then they can rebuild jupyterlab into a new app dir, switch the symlink while the server is up, and have the new app_dir used.

TODO

  • Test that application directory reflects symlink instead of resolved directory
  • resolve symlinks later
  • test live swapping jupyterlab dir to see if it updates.

Checklist

  • Look through open pull requests to see if someone has already started working on this.
  • Note what issue(s) this pull request addresses. (We strongly encourage the community to open an issue describing proposed work before opening a pull request.)
  • Provide a detailed description of the pull request. (Why are these changes necessary? How have they been implemented?)
  • For UI/UX changes, include before/after screenshots
  • Include a narrative description of visual or user interaction changes. How does your design effectively address the problem?
  • Provide a list of Jupyterlab packages the pull request modifies.
  • Describe any backwards incompatible changes to Jupyterlab’s public APIs.
@jupyterlab-dev-mode
Copy link

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Apr 24, 2019

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 24, 2019

@blink1073 mentions in #6166 (comment) that he meant to use abspath, which makes sense to me. That won't resolve symbolic links, but will get us an absolute path.

@saulshanabrook
Copy link
Member Author

@saulshanabrook saulshanabrook commented Apr 24, 2019

OK I changed this to use abspath So jupyter lab path now correctly points to the symlink, if you app dir is a symlink, instead of resolving it.

However, I am testing this and if I modify the symlink, the old path is still used when requesting files, if I keep the server going.

Anyone have pointers on what is actually serving the static directory? Not sure where to add debugging to see how it's resolving these files...

EDIT: So the jupyterlab_server is serving the static path, it looks like: https://github.com/jupyterlab/jupyterlab_server/blob/346c7d0c4857035fe63e9ffc88b3fa84b75f01de/jupyterlab_server/handlers.py#L204-L210

I only *needed* to switch this in `pjoin` for it to resolve static files
lazily, but I figured it wouldn't hurt to switch all of them and now
they will all behave better with symlinks
@saulshanabrook saulshanabrook marked this pull request as ready for review Apr 24, 2019
@saulshanabrook
Copy link
Member Author

@saulshanabrook saulshanabrook commented Apr 24, 2019

OK I tested this locally by setting my app directory to a symlink, running JL, switching the symlink, updating files in the new app directory, and seeing them reflected in my running JL when I reload.

Copy link
Member

@blink1073 blink1073 left a comment

Looks good, thanks!

@blink1073 blink1073 merged commit 13a8543 into jupyterlab:master Apr 24, 2019
9 checks passed
@jasongrout jasongrout added this to the 1.0 milestone Apr 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants