jupyterhub / kubespawner

Kubernetes spawner for JupyterHub
https://jupyterhub-kubespawner.readthedocs.io
BSD 3-Clause "New" or "Revised" License
531 stars 299 forks source link

Support for callables in env no longer works #815

Closed PerilousApricot closed 3 months ago

PerilousApricot commented 6 months ago

Bug description

When upgrading kubespawner (via an associated z2jh helm upgrade from 2.0.0 to 3.2.1), kubespawner lost the ability to pass in callable to the environment variables dict. In my jupyterhub config, I have the following:

      def dynamic_home(spawner):
          import pwd
          return pwd.getpwnam(spawner.userdata['name']).pw_dir

      def dynamic_user(spawner):
          return spawner.userdata['name']

      def dynamic_shell(spawner):
          import pwd
          return pwd.getpwnam(spawner.userdata['name']).pw_shell

      c.KubeSpawner.environment = {"HOME": dynamic_home,
                                   "USER": dynamic_user,
                                   "SHELL": dynamic_shell,
                                   "JUPYTER_CONFIG_DIR": '/home/jovyan/jupyterhub_prod/config'}

And, according to the docs, this should be supported:

The environment configurable should be set by JupyterHub administrators to add installation specific environment variables. It is a dict where the key is the name of the environment variable, and the value can be a string or a callable. If it is a callable, it will be called with one parameter (the spawner instance), and should return a string fairly quickly (no blocking operations please!).

However, attempting to spawn a notebook with the previous configuration snippet results in an error:

[E 2024-01-02 19:44:56.877 JupyterHub user:884] Unhandled error starting meloam's server: expected string or bytes-like object, got 'function'
    Traceback (most recent call last):
      File "/usr/local/lib/python3.11/site-packages/jupyterhub/user.py", line 798, in spawn
        url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 2718, in _start
        pod = await self.get_pod_manifest()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 1998, in get_pod_manifest
        return make_pod(
               ^^^^^^^^^
      File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 490, in make_pod
        "deps": _get_env_var_deps(env),
                ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 470, in _get_env_var_deps
        deps = set(re.findall(re_k8s_env_reference_pattern, env.value))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/re/__init__.py", line 216, in findall
        return _compile(pattern, flags).findall(string)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: expected string or bytes-like object, got 'function'

Which (naively) appears to be an issue where the callable isn't first called to get a string back.

How to reproduce

  1. In a jupyterhub + kubespawner configuration, set the following configuration value:

      def dynamic_home(spawner):
          import pwd
          return pwd.getpwnam(spawner.userdata['name']).pw_dir
    
      c.KubeSpawner.environment = {"HOME": dynamic_home}
  2. Attempt to spawn a user

Expected behaviour

I would expect a new user pod to be spawned with the HOME environment variable set to the user's home directory

Actual behaviour

The spawning fails.

Your personal set up

This cluster is running k8s version:

Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.7", GitCommit:"07a61d861519c45ef5c89bc22dda289328f29343", GitTreeState:"clean", BuildDate:"2023-10-18T11:33:23Z", GoVersion:"go1.20.10", Compiler:"gc", Platform:"linux/amd64"}

with z2jh version 3.2.1.

Full environment ``` accre==4.0.0 aiohttp==3.9.1 aiosignal==1.3.1 alembic==1.12.1 asn1crypto==1.5.1 async-generator==1.10 attrs==23.1.0 bcrypt==4.0.1 certifi==2023.11.17 certipy==0.1.3 cffi==1.16.0 charset-normalizer==3.3.2 cryptography==41.0.5 dcim==0.3.0 escapism==1.0.1 frozenlist==1.4.0 greenlet==3.0.1 idna==3.6 Jinja2==3.1.2 jsonschema==4.20.0 jsonschema-specifications==2023.11.1 jupyter-telemetry==0.1.0 jupyterhub==4.0.2 jupyterhub-firstuseauthenticator==1.0.0 jupyterhub-hmacauthenticator==1.0 jupyterhub-idle-culler==1.2.1 jupyterhub-kubespawner==6.2.0 jupyterhub-ldapauthenticator==1.3.2 jupyterhub-ltiauthenticator==1.6.1 jupyterhub-nativeauthenticator==1.2.0 jupyterhub-tmpauthenticator==1.0.0 kubernetes-asyncio==28.2.1 ldap3==2.9.1 Mako==1.3.0 MarkupSafe==2.1.3 multidict==6.0.4 mwoauth==0.4.0 nullauthenticator==1.0.0 oauthenticator==16.2.1 oauthlib==3.2.2 onetimepass==1.0.1 packaging==23.2 pamela==1.1.0 pg8000==1.30.3 prometheus-client==0.19.0 proxmoxer==2.0.1 psycopg2==2.9.9 py-spy==0.3.14 pyasn1==0.5.1 pycparser==2.21 pycurl==7.45.2 PyJWT==2.8.0 PyMySQL==1.1.0 pyOpenSSL==23.3.0 pystache==0.6.5 python-dateutil==2.8.2 python-json-logger==2.0.7 python-slugify==8.0.1 PyYAML==6.0.1 referencing==0.31.0 requests==2.31.0 requests-oauthlib==1.3.1 rpds-py==0.13.1 ruamel.yaml==0.18.5 ruamel.yaml.clib==0.2.8 scramp==1.4.4 six==1.16.0 SQLAlchemy==2.0.23 sqlalchemy-cockroachdb==2.0.1 statsd==4.0.1 text-unidecode==1.3 tornado==6.3.3 traitlets==5.13.0 typing_extensions==4.8.0 urllib3==2.1.0 yarl==1.9.3 zxcvbn==4.4.28 ```
Configuration I'm happy to post the configuration, though z2jh builds it dynamically, is there a way to get z2jh to spit out the "rendered" version of the config? This is a pprint.pprint() dump of the spawner ``` {'_cross_validation_lock': False, '_fs_gid_metadata': {}, '_gid_metadata': {}, '_oauth_client_allowed_scopes_metadata': {}, '_oauth_roles_metadata': {}, '_options_form_metadata': {}, '_profile_list_metadata': {}, '_server': Server(url=http://hub-6f754c444-tlt2j:58283/user/meloam/, bind_url=http://*:58283/user/meloam/), '_server_token_scopes_metadata': {}, '_spawn_future': .finish_user_spawn() running at /usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py:988> cb=[BaseHandler.spawn_single_user.._clear_spawn_future() at /usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py:1029, <3 more>, with_timeout..error_callback() at /usr/local/lib/python3.11/site-packages/tornado/gen.py:623]>, '_spawn_pending': True, '_start_future': None, '_start_pending': True, '_trait_notifiers': {'config': {'change': []}, 'hub_connect_ip': {'change': []}, 'hub_connect_port': {'change': []}, 'orm_spawner': {'change': []}, traitlets.All: {'change': []}}, '_trait_validators': {'config': , 'default_url': , 'image_pull_secrets': , 'log': , 'notebook_dir': }, '_trait_values': {'_deprecated_db_session': , '_poll_callback': None, 'admin_access': True, 'allow_privilege_escalation': False, 'api_token': 'REDACTED'', 'auth_state_hook': , 'authenticator': , 'automount_service_account_token': None, 'cmd': ['jupyterhub-singleuser'], 'common_labels': {'app': 'jupyterhub', 'chart': 'jupyterhub-2.0.0', 'heritage': 'jupyterhub', 'release': 'jupyterhub'}, 'component_label': 'singleuser-server', 'config': {'ACCRECILogonOAuthenticator': {'add_user_cmd': ['python3', '/add-user.py'], 'authorize_url': 'REDACTED', 'client_id': 'REDACTED', 'client_secret': 'REDACTED', 'create_system_users': True, 'login_service': 'Jupyter ' 'at ' 'ACCRE', 'oauth_callback_url': 'REDACTED'', 'post_auth_hook': }, 'Authenticator': {'admin_users': ['meloam'], 'enable_auth_state': True}, 'ConfigurableHTTPProxy': {'api_url': 'http://proxy-api:8001', 'should_start': False}, 'CryptKeeper': {'keys': ['REDACTED']}, 'JupyterHub': {'admin_access': True, 'allow_named_servers': False, 'authenticator_class': , 'base_url': '/', 'cleanup_servers': False, 'concurrent_spawn_limit': 64, 'config_file': '/usr/local/etc/jupyterhub/jupyterhub_config.py', 'cookie_secret': 'REDACTED', 'db_url': 'sqlite:///jupyterhub.sqlite', 'hub_bind_url': 'http://:8081', 'hub_connect_url': 'http://hub:8081', 'last_activity_interval': 60, 'load_roles': [], 'log_level': 'DEBUG', 'logo_file': '/templates/jupyter-on-accre.svg', 'services': [{'command': ['/usr/local/bin/python', '/idle_culler.py', '--timeout=3600'], 'name': 'idle-culler'}], 'spawner_class': 'kubespawner.KubeSpawner', 'template_paths': ['/home/jovyan/dev/templates/', '/templates', '/usr/local/share/jupyterhub/templates/'], 'template_vars': {}, 'tornado_settings': {'slow_spawn_timeout': 0}, 'upgrade_db': True}, 'KubeSpawner': {'allow_privilege_escalation': False, 'auth_state_hook': , 'common_labels': {'app': 'jupyterhub', 'chart': 'jupyterhub-2.0.0', 'heritage': 'jupyterhub', 'release': 'jupyterhub'}, 'environment': {'HOME': , 'JUPYTER_CONFIG_DIR': '/home/jovyan/jupyterhub_prod/config', 'SHELL': , 'USER': }, 'events_enabled': True, 'extra_annotations': {}, 'extra_containers': [], 'extra_labels': {'hub.jupyter.org/network-access-hub': 'true'}, 'extra_pod_config': {}, 'extra_resource_guarantees': {}, 'extra_resource_limits': {}, 'fs_gid': 100, 'gid': , 'image': 'ghcr.io/accre/cms-jupyter:testingv5.1x', 'image_pull_policy': 'Always', 'init_containers': [{'args': None, 'command': ['iptables', '-A', 'OUTPUT', '-d', '169.254.169.254', '-j', 'DROP'], 'env': None, 'env_from': None, 'image': 'jupyterhub/k8s-network-tools:2.0.0', 'image_pull_policy': None, 'lifecycle': None, 'liveness_probe': None, 'name': 'block-cloud-metadata', 'ports': None, 'readiness_probe': None, 'resize_policy': None, 'resources': {}, 'restart_policy': None, 'security_context': {'allow_privilege_escalation': None, 'capabilities': {'add': ['NET_ADMIN'], 'drop': None}, 'privileged': True, 'proc_mount': None, 'read_only_root_filesystem': None, 'run_as_group': None, 'run_as_non_root': None, 'run_as_user': 0, 'se_linux_options': None, 'seccomp_profile': None, 'windows_options': None}, 'startup_probe': None, 'stdin': None, 'stdin_once': None, 'termination_message_path': None, 'termination_message_policy': None, 'tty': None, 'volume_devices': None, 'volume_mounts': None, 'working_dir': None}], 'lifecycle_hooks': {}, 'mem_guarantee': '1G', 'modify_pod_hook': , 'namespace': 'jhub-prod', 'node_affinity_preferred': [{'preference': {'matchExpressions': [{'key': 'hub.jupyter.org/node-purpose', 'operator': 'In', 'values': ['user']}]}, 'weight': 100}], 'node_affinity_required': [], 'node_selector': {}, 'notebook_dir': '~', 'options_form': , 'options_from_form': , 'pod_affinity_preferred': [], 'pod_affinity_required': [], 'pod_anti_affinity_preferred': [], 'pod_anti_affinity_required': [], 'profile_list': [], 'scheduler_name': 'jupyterhub-user-scheduler', 'service_account': 'sa-meloam', 'start_timeout': 300, 'storage_extra_labels': {}, 'tolerations': [{'effect': 'NoSchedule', 'key': 'hub.jupyter.org/dedicated', 'operator': 'Equal', 'value': 'user'}, {'effect': 'NoSchedule', 'key': 'hub.jupyter.org_dedicated', 'operator': 'Equal', 'value': 'user'}], 'uid': , 'volume_mounts': , 'volumes': , 'working_dir': '/home/{username}'}, 'Spawner': {'cmd': 'jupyterhub-singleuser', 'consecutive_failure_limit': 5}}, 'consecutive_failure_limit': 5, 'cookie_options': {}, 'debug': False, 'default_url': '', 'delete_grace_period': 1, 'delete_pvc': True, 'delete_stopped_pods': True, 'disable_user_config': False, 'dns_name_template': '{name}.{namespace}.svc.cluster.local', 'enable_user_namespaces': False, 'environment': {'HOME': , 'JUPYTER_CONFIG_DIR': '/home/jovyan/jupyterhub_prod/config', 'SHELL': , 'USER': }, 'events_enabled': True, 'extra_annotations': {}, 'extra_containers': [], 'extra_labels': {'hub.jupyter.org/network-access-hub': 'true'}, 'extra_pod_config': {}, 'extra_resource_guarantees': {}, 'extra_resource_limits': {}, 'fs_gid': 100, 'gid': , 'handler': , 'http_timeout': 30, 'hub': , 'hub_connect_ip': '', 'hub_connect_port': 0, 'hub_connect_url': None, 'image': 'ghcr.io/accre/cms-jupyter:testingv5.1x', 'image_pull_policy': 'Always', 'init_containers': [{'args': None, 'command': ['iptables', '-A', 'OUTPUT', '-d', '169.254.169.254', '-j', 'DROP'], 'env': None, 'env_from': None, 'image': 'jupyterhub/k8s-network-tools:2.0.0', 'image_pull_policy': None, 'lifecycle': None, 'liveness_probe': None, 'name': 'block-cloud-metadata', 'ports': None, 'readiness_probe': None, 'resize_policy': None, 'resources': {}, 'restart_policy': None, 'security_context': {'allow_privilege_escalation': None, 'capabilities': {'add': ['NET_ADMIN'], 'drop': None}, 'privileged': True, 'proc_mount': None, 'read_only_root_filesystem': None, 'run_as_group': None, 'run_as_non_root': None, 'run_as_user': 0, 'se_linux_options': None, 'seccomp_profile': None, 'windows_options': None}, 'startup_probe': None, 'stdin': None, 'stdin_once': None, 'termination_message_path': None, 'termination_message_policy': None, 'tty': None, 'volume_devices': None, 'volume_mounts': None, 'working_dir': None}], 'internal_certs_location': '', 'internal_ssl': False, 'ip': '0.0.0.0', 'k8s_api_host': '', 'k8s_api_request_retry_timeout': 30, 'k8s_api_request_timeout': 3, 'k8s_api_ssl_ca_cert': '', 'k8s_api_threadpool_workers': 0, 'k8s_api_verify_ssl': None, 'lifecycle_hooks': {}, 'mem_guarantee': 1073741824, 'modify_pod_hook': , 'namespace': 'jhub-prod', 'node_affinity_preferred': [{'preference': {'matchExpressions': [{'key': 'hub.jupyter.org/node-purpose', 'operator': 'In', 'values': ['user']}]}, 'weight': 100}], 'node_affinity_required': [], 'node_selector': {}, 'notebook_dir': '~', 'oauth_client_allowed_scopes': [], 'oauth_client_id': 'jupyterhub-user-meloam', 'oauth_roles': [], 'options_form': , 'options_from_form': , 'orm_spawner': , 'parent': None, 'pod_affinity_preferred': [], 'pod_affinity_required': [], 'pod_anti_affinity_preferred': [], 'pod_anti_affinity_required': [], 'pod_connect_ip': '', 'pod_name_template': 'jupyter-{username}--{servername}', 'poll_interval': 30, 'port': 8888, 'post_stop_hook': None, 'pre_spawn_hook': None, 'priority_class_name': '', 'privileged': False, 'profile_form_template': '', 'profile_list': [], 'proxy_spec': '/user/meloam/', 'pvc_name_template': 'claim-{username}--{servername}', 'scheduler_name': 'jupyterhub-user-scheduler', 'secret_mount_path': '/etc/jupyterhub/ssl/', 'secret_name_template': 'jupyter-{username}{servername}', 'server_token_scopes': [], 'service_account': 'sa-meloam', 'services_enabled': False, 'start_timeout': 300, 'storage_capacity': None, 'storage_class': None, 'storage_extra_labels': {}, 'storage_pvc_ensure': False, 'tolerations': [{'effect': 'NoSchedule', 'key': 'hub.jupyter.org/dedicated', 'operator': 'Equal', 'value': 'user'}, {'effect': 'NoSchedule', 'key': 'hub.jupyter.org_dedicated', 'operator': 'Equal', 'value': 'user'}], 'trusted_alt_names': [], 'uid': , 'user': , 'user_namespace_template': '{hubnamespace}-{username}', 'user_options': {'img': 'ACCRE Jupyter Image', 'lab': 'off', 'res': '1 Core, 2GB ram, 4day timeout', 'ver': 'TestVersion'}, 'volume_mounts': [{'mountPath': '/var/lib/sss/pipes/nss', 'name': 'pipe1'}, {'mountPath': '/var/lib/sss/mc', 'name': 'pipe2', 'readOnly': True}, {'mountPath': '/home', 'name': 'home'}, {'mountPath': '/cvmfs', 'name': 'cvmfs', 'readOnly': True}], 'volumes': [{'hostPath': {'path': '/var/lib/sss/pipes/nss'}, 'name': 'pipe1'}, {'hostPath': {'path': '/var/lib/sss/mc'}, 'name': 'pipe2'}, {'hostPath': {'path': '/mnt/ceph/home'}, 'name': 'home'}, {'hostPath': {'path': '/cvmfs'}, 'name': 'cvmfs'}], 'will_resume': False, 'working_dir': '/home/meloam'}, '_uid_metadata': {}, 'api': , 'dns_name': 'jupyter-meloam.jhub-prod.svc.cluster.local', 'pod_name': 'jupyter-meloam', 'pvc_name': 'claim-meloam', 'secret_name': 'jupyter-meloam', 'userdata': {'name': 'meloam'}} ```
Logs ``` [E 2024-01-02 19:44:56.877 JupyterHub user:884] Unhandled error starting meloam's server: expected string or bytes-like object, got 'function' Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/jupyterhub/user.py", line 798, in spawn url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 2718, in _start pod = await self.get_pod_manifest() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 1998, in get_pod_manifest return make_pod( ^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 490, in make_pod "deps": _get_env_var_deps(env), ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 470, in _get_env_var_deps deps = set(re.findall(re_k8s_env_reference_pattern, env.value)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/re/__init__.py", line 216, in findall return _compile(pattern, flags).findall(string) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected string or bytes-like object, got 'function' [D 2024-01-02 19:44:56.882 JupyterHub user:982] Stopping meloam [D 2024-01-02 19:44:56.900 JupyterHub user:1002] Deleting oauth client jupyterhub-user-meloam [D 2024-01-02 19:44:57.004 JupyterHub user:1005] Finished stopping meloam [E 2024-01-02 19:44:57.202 JupyterHub gen:630] Exception in Future .finish_user_spawn() done, defined at /usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py:981> exception=TypeError("expected string or bytes-like object, got 'function'")> after timeout Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/tornado/gen.py", line 625, in error_callback future.result() File "/usr/local/lib/python3.11/site-packages/jupyterhub/handlers/base.py", line 988, in finish_user_spawn await spawn_future File "/usr/local/lib/python3.11/site-packages/jupyterhub/user.py", line 902, in spawn raise e File "/usr/local/lib/python3.11/site-packages/jupyterhub/user.py", line 798, in spawn url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 2718, in _start pod = await self.get_pod_manifest() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/spawner.py", line 1998, in get_pod_manifest return make_pod( ^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 490, in make_pod "deps": _get_env_var_deps(env), ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/kubespawner/objects.py", line 470, in _get_env_var_deps deps = set(re.findall(re_k8s_env_reference_pattern, env.value)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/re/__init__.py", line 216, in findall return _compile(pattern, flags).findall(string) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected string or bytes-like object, got 'function' ```
welcome[bot] commented 6 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

moschlar commented 3 months ago

This currently bites me too on trying to upgrade from z2jh 2 to z2jh 3...

Maybe a possible workaround would be to use a Spawner.pre_spawn_hook!?

moschlar commented 3 months ago

Although from reading the code, I can not figure out why it does not work in the first place (i.e. why is https://github.com/jupyterhub/jupyterhub/blob/ca6032381aa137f03cb9349265fa74ed5e4c5c19/jupyterhub/spawner.py#L1101 apparently not relevant?)...

manics commented 3 months ago

KubeSpawner calls the parent function to evaluate callables as you've pointed out: https://github.com/jupyterhub/kubespawner/blob/f99b98fc731517129ebfb7ef3fee293f28d75a75/kubespawner/spawner.py#L2161

but in addition it adds template expansion of values, which is causing the problem: https://github.com/jupyterhub/kubespawner/blob/f99b98fc731517129ebfb7ef3fee293f28d75a75/kubespawner/spawner.py#L2169

I think the correct fix is to only expand non-callable values (since if you're using a callable you most likely don't want the result to be interpreted as a template).

moschlar commented 3 months ago

@manics I still don't get why the template expansion should cause this - it should ignore anything that is not list, dict or str, shouldn't it?

consideRatio commented 3 months ago

I really appreciate this issue writeup @PerilousApricot - thank you! My favorite part is the inclusion of the docs reference that makes it definite its a bug in the project!

And, according to the docs, this should be supported:

The environment configurable should be set by JupyterHub administrators to add installation specific environment variables. It is a dict where the key is the name of the environment variable, and the value can be a string or a callable. If it is a callable, it will be called with one parameter (the spawner instance), and should return a string fairly quickly (no blocking operations please!).

Thank you @manics for the fix and thank you @jabbera and @moschlar for reporting on this as well!