You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running in JupyterHub, we would like to inject some fields to page config that are based on the incoming request (e.g. based on the authenticated user, which can vary from one request to the next). However, the way page config is populated in LabHandler.get makes it hard to find a hook to add/modify fields.
Proposed Solution
Add a hook for 'extra page config' that can be a callable, so that page config can be extended. Possibly this could be discovered via jupyter-server extensions, so that each extension could add its own page config? For us, at least some mechanism would need to to take the current request into account.
What would suffice for us:
page_config= ...
# apply extra page config hookifself.settings.get("extra_page_config", None):
page_config=self.settings["extra_page_config"](self, copy.copy(page_config))
... # continue as before
but just one hook might not suffice if multiple extensions also want to do this. I'm not sure they will, though, because extensions generally have their own place to put settings. JupyterHub does need to modify the root page config itself.
Additional context
JupyterHub's server-extension code where we would call this hook is here. We generally inject some things into Jupyter handler base classes. I'd like to do this via existing extension APIs as much as possible. Ultimately, I'd like to get to the point where jupyterhub-singleuser is implemented as a Jupyter Server Extension, but the necessary extension points don't exist yet.
The text was updated successfully, but these errors were encountered:
minrk
transferred this issue from jupyterlab/jupyterlab
Nov 18, 2021
I see (lab) extensions load settings from disk already, so it really is only the "taking the request into account" bit that JupyterHub needs that seems to be missing.
Problem
When running in JupyterHub, we would like to inject some fields to page config that are based on the incoming request (e.g. based on the authenticated user, which can vary from one request to the next). However, the way page config is populated in LabHandler.get makes it hard to find a hook to add/modify fields.
Proposed Solution
Add a hook for 'extra page config' that can be a callable, so that page config can be extended. Possibly this could be discovered via jupyter-server extensions, so that each extension could add its own page config? For us, at least some mechanism would need to to take the current request into account.
What would suffice for us:
but just one hook might not suffice if multiple extensions also want to do this. I'm not sure they will, though, because extensions generally have their own place to put settings. JupyterHub does need to modify the root page config itself.
Additional context
JupyterHub's server-extension code where we would call this hook is here. We generally inject some things into Jupyter handler base classes. I'd like to do this via existing extension APIs as much as possible. Ultimately, I'd like to get to the point where jupyterhub-singleuser is implemented as a Jupyter Server Extension, but the necessary extension points don't exist yet.
The text was updated successfully, but these errors were encountered: