1616
1717__all__ = ["MarbleClient" ]
1818
19- JUPYTERLAB_ENV_VARIABLES = ("PAVICS_HOST_URL" , "JUPYTERHUB_API_URL" , "JUPYTERHUB_USER" , "JUPYTERHUB_API_TOKEN" )
20-
2119
2220def check_jupyterlab (f ):
2321 """
@@ -26,10 +24,15 @@ def check_jupyterlab(f):
2624
2725 This is used as a pre-check for functions that only work in a Marble Jupyterlab
2826 environment.
27+
28+ Note that this checks if either the BIRDHOUSE_HOST_URL or PAVICS_HOST_URL are present to support
29+ versions of birdhouse-deploy prior to 2.4.0.
2930 """
3031 @wraps (f )
3132 def wrapper (* args , ** kwargs ):
32- if all (os .getenv (jupyter_var ) for jupyter_var in JUPYTERLAB_ENV_VARIABLES ):
33+ birdhouse_host_var = ("PAVICS_HOST_URL" , "BIRDHOUSE_HOST_URL" )
34+ jupyterhub_env_vars = ("JUPYTERHUB_API_URL" , "JUPYTERHUB_USER" , "JUPYTERHUB_API_TOKEN" )
35+ if any (os .getenv (var ) for var in birdhouse_host_var ) and all (os .getenv (var ) for var in jupyterhub_env_vars ):
3336 return f (* args , ** kwargs )
3437 raise JupyterEnvironmentError ("Not in a Marble jupyterlab environment" )
3538 return wrapper
@@ -72,7 +75,8 @@ def this_node(self) -> MarbleNode:
7275
7376 Note that this function only works in a Marble Jupyterlab environment.
7477 """
75- url_string = os .getenv ("PAVICS_HOST_URL" )
78+ # PAVICS_HOST_URL is the deprecated variable used in older versions (<2.4.0) of birdhouse-deploy
79+ url_string = os .getenv ("BIRDHOUSE_HOST_URL" , os .getenv ("PAVICS_HOST_URL" ))
7680 host_url = urlparse (url_string )
7781 for node in self .nodes .values ():
7882 if urlparse (node .url ).hostname == host_url .hostname :
0 commit comments