jupyter-server-proxy
jupyter-server-proxy copied to clipboard
Passing notebook work directory and token to SupervisedProcess
Hi, we are working on a file browser (https://github.com/imjoy-team/jupyter-elfinder) for managing files on remote servers.
Because it's specifically designed to work with jupyter server, we would like to access more env variables (e.g.: notebook work directory and token).
It seems there is no way to access those variables currently. Is there any consideration for not doing so? Otherwise, I am happy to make a PR.
We need to also consider:
-
where should we expose those variables, via environment variables (
SuperviseAndProxyHandler.get_env
) or process arguments (config.process_args
) -
which are the variables to expose ? For my application, I need the work dir of notebook server (
web_app.settings["server_root_dir"]
)and the token (web_app.settings["token"]
). -
should we always set the cwd for launching supervised processes the same as notebook work directory?
Have you thought about writing your own proxy that subclasses jupyter-server-proxy, or alternatively integrating the browser as a jupyter extension? If you require the notebook token it sounds like you're making API requests, so this might be easier?
@manics Thanks for the suggestions.
Normally, we won't need the notebook token for the web page to make request to the proxied server (because authentication will be done automatically via the xsrf cookies), however, in some cases, when we need to make request from a webworker or a page hosted from another domain, we cannot use the cookies and without a token the request won't pass the proxy.
So I think this feature is not too specific to our project, be can be useful for those cases for other project as well.
Sure we can make a different package for supporting these, obviously that's not ideal if this can be considered here.
@oeway did you manage to get this working with a subclass? If so, we can see what needed to be changed there, and possibly bring it back upstream.
No I don't have it now @yuvipanda I will let you know if I get sometime to work on it.