Skip to content

Conversation

@dometto
Copy link

@dometto dometto commented Nov 19, 2025

Thanks for this neat package!

I would like to use the setup_rserver function from this module to add multiple RStudio servers to a JupyterHub environment. This can in principle be done by manually calling c.ServerProxy.servers.update({...}) from within a jupyter-server-proxy file. However, currently setup_rserver does not:

  1. Allow specifying the server name (prefix)
  2. Allow specifying the launcher entry title
  3. Allow specifying the path to the R interpreter that should be used

This PR addresses these issues by adding optional keyword arguments to setup_rserver, and by using rserver's --rsession-which-r option when it is available.

This makes it possible to add multiple servers from within a jupyter-server config file like so:

from jupyter_rsession_proxy import setup_rserver
c.ServerProxy.servers.update({
  "rstudio1": setup_rserver(prefix="rstudio1", r_path="/usr/bin/R", launcher_title="RStudio (default R)"),
  "rstudio2": setup_rserver(prefix="rstudio2", r_path="/opt/miniconda3/bin/R", launcher_title="RStudio (other R)")
})

@ryanlovett
Copy link
Collaborator

ryanlovett commented Nov 20, 2025

This seems like a useful addition! Ideally jupyter-server-proxy would be able to support multiple instances of an application like /rstudio/0, /rstudio/1, or /rstudio/{name} similar to how jupyter server manages /terminals/, but that would require more work.

One possible issue about the implementation in this PR is the relationship between jupyter-server-proxy's URL prefix as determined by the dictionary key and the prefix parameter that is being added. With this PR they would have to match. If someone (accidentally?) configures:

{"foo": setup_rserver(prefix="bar")},
  • RStudio starts with: --www-root-path=/user/username/bar/
  • RStudio might generate absolute URLs containing paths like: /user/username/bar/some-page.html
  • User accesses: /user/username/foo/ but clicks links to /user/username/bar/

One could try to address this with documentation. Another method is to wrap setup_rserver so that it seeds "foo" as the key and the prefix.

@dometto
Copy link
Author

dometto commented Nov 20, 2025

Thanks for the suggestions @ryanlovett! I'm happy to add some documentation, or to wrap setup_rserver, whichever you or other maintainers prefer.

@dometto
Copy link
Author

dometto commented Nov 24, 2025

@ryanlovett I've added some documentation now. Let me know if you think this is clear, and suffices.

I've opted against wrapping setup_rserver in another function for now, because I was worried this might lead to a breaking change (given the entrypoint in setup.py would, I think, also have to be changed). But happy to do whatever seems best to the maintaining team!

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants