From 9bbdc28d3e3dc3c0ef8b679c28f90632a1c99488 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 22 May 2023 20:13:12 +0200 Subject: [PATCH] maint: upgrade to non-deprecated ruamel.yaml syntax --- helm-chart/binderhub/values.yaml | 10 +++++----- testing/local-binder-k8s-hub/install-jupyterhub-chart | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/helm-chart/binderhub/values.yaml b/helm-chart/binderhub/values.yaml index 752ef8e50..20c568a6c 100644 --- a/helm-chart/binderhub/values.yaml +++ b/helm-chart/binderhub/values.yaml @@ -231,12 +231,12 @@ jupyterhub: have_lab = major >= 3 if have_lab: - # technically, we could accept another jupyter-server-based frontend - print("Launching jupyter-lab", file=sys.stderr) - exe = "jupyter-lab" + # technically, we could accept another jupyter-server-based frontend + print("Launching jupyter-lab", file=sys.stderr) + exe = "jupyter-lab" else: - print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr) - exe = "jupyter-notebook" + print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr) + exe = "jupyter-notebook" # launch the notebook server os.execvp(exe, sys.argv) diff --git a/testing/local-binder-k8s-hub/install-jupyterhub-chart b/testing/local-binder-k8s-hub/install-jupyterhub-chart index d9f7cf5b2..480b7b26c 100755 --- a/testing/local-binder-k8s-hub/install-jupyterhub-chart +++ b/testing/local-binder-k8s-hub/install-jupyterhub-chart @@ -10,7 +10,9 @@ import sys from subprocess import check_call from tempfile import NamedTemporaryFile -from ruamel import yaml +from ruamel.yaml import YAML + +yaml = YAML(typ="safe") here = os.path.abspath(os.path.dirname(__file__)) helm_chart = os.path.join(here, os.pardir, os.pardir, "helm-chart") @@ -24,7 +26,7 @@ def _get_jupyterhub_dependency_version(): chart_yaml = os.path.join(helm_chart, "binderhub", "Chart.yaml") with open(chart_yaml) as f: - dependecies = yaml.safe_load(f) + dependecies = yaml.load(f) for dep in dependecies["dependencies"]: if dep["name"] == "jupyterhub": return dep["version"] @@ -36,7 +38,7 @@ def _get_jupyterhub_dependency_version(): with NamedTemporaryFile(mode="w") as tmp: with open(os.path.join(helm_chart, "binderhub", "values.yaml")) as values_in: - yaml.safe_dump(yaml.safe_load(values_in)["jupyterhub"], tmp.file) + yaml.dump(yaml.load(values_in)["jupyterhub"], tmp.file) cmd = ["helm", "upgrade", "--install", "binderhub-test"] cmd.extend(