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

paths: option to exclude user directories #343

Open
minrk opened this issue Feb 15, 2023 · 1 comment
Open

paths: option to exclude user directories #343

minrk opened this issue Feb 15, 2023 · 1 comment

Comments

@minrk
Copy link
Member

minrk commented Feb 15, 2023

Thanks to Jupyter Server 2's IdentityProvider and Authorizer APIs, JupyterHub can almost go without monkeypatching, and implement all of its features via public APIs. However, one JupyterHub feature: disable_user_config is actually harder to implement with the extension mechanism, because it needs to modify the config and template paths of all other extensions. Most, if not all, of these are produced from jupyter_path or jupyter_config_path, and don't inherit from their parent ServerApp. I've resorted to the far-from-ideal patch of the __code__ attribute of the jupyter_core.paths functions to achieve the necessary goal, which was once achieved by a simple subclass override of NotebookApp.

But jupyter_path and jupyter_config_path unconditionally add user paths to their return.

If there were a public option to exclude user paths (ideally an env or module constant like site.ENABLE_USER_SITE so it's a process-global state, not per-call), I think I could achieve this purely via public APIs and remove the last major monkeypatch from jupyterhub.singleuser.

It's a pretty JupyterHub-specific feature, but because the logic resides in jupyter-core and it's unconditional and un-overrideable, I think that's the only way it can be achieved in a public-api way. What do folks think about a jupyter_core.paths.ENABLE_USER_PATHS flag?

@blink1073
Copy link
Contributor

Sounds reasonable to me

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

No branches or pull requests

2 participants