From 1b87e9c66889d1e133843828c76c6f2071f3e98d Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:29:14 +0100 Subject: [PATCH] Use separate `env_keep` defaults for `LocalProcessSpawner` Since none of the current defaults (except `JUPYTERHUB_SINGLEUSER_APP`) make sense for spawners other than `LocalProcessSpawner`. --- jupyterhub/spawner.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/jupyterhub/spawner.py b/jupyterhub/spawner.py index 17fd7957..dfe57c2c 100644 --- a/jupyterhub/spawner.py +++ b/jupyterhub/spawner.py @@ -701,17 +701,7 @@ class Spawner(LoggingConfigurable): ) env_keep = List( - [ - 'LD_LIBRARY_PATH', - 'PATH', - 'PYTHONPATH', - 'CONDA_ROOT', - 'CONDA_DEFAULT_ENV', - 'VIRTUAL_ENV', - 'LANG', - 'LC_ALL', - 'JUPYTERHUB_SINGLEUSER_APP', - ], + ['JUPYTERHUB_SINGLEUSER_APP'], help=""" List of environment variables for the single-user server to inherit from the JupyterHub process. @@ -1717,6 +1707,20 @@ class LocalProcessSpawner(Spawner): """, ) + @default("env_keep") + def _env_keep_default(self): + return [ + "CONDA_DEFAULT_ENV", + "CONDA_ROOT", + "JUPYTERHUB_SINGLEUSER_APP", + "LANG", + "LC_ALL", + "LD_LIBRARY_PATH", + "PATH", + "PYTHONPATH", + "VIRTUAL_ENV", + ] + def make_preexec_fn(self, name): """ Return a function that can be used to set the user id of the spawned process to user with name `name`