Skip to content

Commit 4b39272

Browse files
committed
updates for birdhouse-deploy 2.4.0
1 parent 1d5726d commit 4b39272

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

marble_client/client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
__all__ = ["MarbleClient"]
1818

19-
JUPYTERLAB_ENV_VARIABLES = ("PAVICS_HOST_URL", "JUPYTERHUB_API_URL", "JUPYTERHUB_USER", "JUPYTERHUB_API_TOKEN")
20-
2119

2220
def 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:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ line-length = 120
3636
[tool.pytest.ini_options]
3737
markers = [
3838
"load_from_cache: marks tests that should load the registry from a cached version",
39+
"jupyterlab_environment: marks tests that test features that are only available in a Marble jupyterlab environment"
3940
]

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def first_url(registry_content):
9595
def jupyterlab_environment(request, monkeypatch, first_url, requests_mock):
9696
if "jupyterlab_environment" in request.keywords:
9797
kwargs = request.keywords["jupyterlab_environment"].kwargs
98-
monkeypatch.setenv("PAVICS_HOST_URL", kwargs.get("url", first_url))
98+
monkeypatch.setenv("BIRDHOUSE_HOST_URL", kwargs.get("url", first_url))
9999

100100
jupyterhub_api_url = kwargs.get("jupyterhub_api_url", "http://jupyterhub.example.com")
101101
jupyterhub_user = kwargs.get("jupyterhub_user", "example_user")

0 commit comments

Comments
 (0)