From 663ddaeb2c05e7a6f6575ba433db857688d6c8cc Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Fri, 19 May 2023 15:13:06 -0500 Subject: [PATCH 1/8] add jupyterhub-traefik-proxy 1.0.0 --- recipes/meta.yaml | 149 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 recipes/meta.yaml diff --git a/recipes/meta.yaml b/recipes/meta.yaml new file mode 100644 index 0000000000000..50cfd376e1a0b --- /dev/null +++ b/recipes/meta.yaml @@ -0,0 +1,149 @@ +{% set version = "1.0.0" %} + +package: + name: jupyterhub-traefik-proxy-split + version: {{ version }} + +source: + url: https://github.com/jupyterhub/traefik-proxy/archive/refs/tags/{{ version }}.tar.gz + sha256: 2dc4df9ecbdff275b8868fe8f8712be77dd4575f2102ba71978cd739cc2202b3 + +build: + noarch: python + number: 0 + +requirements: + host: + - python >=3.6 + run: + - python >=3.6 + +outputs: + - name: jupyterhub-traefik-proxy + build: + noarch: python + script: + # TODO: remove after https://github.com/jupyterhub/traefik-proxy/pull/207 + - {{ PYTHON }} -c "__import__('shutil').rmtree('performance')" + - {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation + requirements: + host: + - pip + - python >=3.6 + run: + - aiohttp + - escapism + - jupyterhub >=0.9 + - passlib + - python >=3.6 + - toml + - traefik >=2,<3 + test: + imports: + - jupyterhub_traefik_proxy + - jupyterhub_traefik_proxy.fileprovider + commands: + - pip check + requires: + - pip + + - name: jupyterhub-traefik-proxy-with-consul + build: + noarch: python + requirements: + host: + - pip + - python >=3.6 + run: + - {{ pin_subpackage("jupyterhub-traefik-proxy", max_pin="x.x.x") }} + - python >=3.6 + - python-consul2 + test: + imports: + - jupyterhub_traefik_proxy + - jupyterhub_traefik_proxy.consul + commands: + - pip check + requires: + - pip + + - name: jupyterhub-traefik-proxy-with-etcd + build: + noarch: python + requirements: + host: + - pip + - python >=3.6 + run: + - {{ pin_subpackage("jupyterhub-traefik-proxy", max_pin="x.x.x") }} + - etcdpy + - python >=3.6 + test: + imports: + - jupyterhub_traefik_proxy + - jupyterhub_traefik_proxy.etcd + commands: + - pip check + requires: + - pip + + - name: jupyterhub-traefik-proxy-with-yaml + build: + noarch: python + requirements: + host: + - pip + - python >=3.6 + run: + - {{ pin_subpackage("jupyterhub-traefik-proxy", max_pin="x.x.x") }} + - python >=3.6 + - ruamel.yaml + test: + imports: + - jupyterhub_traefik_proxy + commands: + - pip check + requires: + - pip + + - name: jupyterhub-traefik-proxy-with-all + build: + noarch: python + requirements: + host: + - pip + - python >=3.6 + run: + - {{ pin_subpackage("jupyterhub-traefik-proxy-with-consul", max_pin="x.x.x") }} + - {{ pin_subpackage("jupyterhub-traefik-proxy-with-etcd", max_pin="x.x.x") }} + - {{ pin_subpackage("jupyterhub-traefik-proxy-with-yaml", max_pin="x.x.x") }} + - {{ pin_subpackage("jupyterhub-traefik-proxy", max_pin="x.x.x") }} + - python >=3.6 + test: + source_files: + - tests + imports: + - jupyterhub_traefik_proxy + commands: + - pip check + - cd tests && python -m pytest -vv --asyncio-mode=auto --cov=jupyterhub_traefik_proxy --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail -k "not (etcd or consul)" --cov-fail-under=72 + requires: + - notebook >=4.0,<7.0 + - pip + - pytest + - pytest-asyncio + - pytest-cov + - websockets + - urllib3 <2 + +about: + home: https://jupyterhub-traefik-proxy.readthedocs.io + summary: JupyterHub proxy implementation with traefik + dev_url: https://github.com/jupyterhub/traefik-proxy + license: BSD-3-Clause + license_file: LICENSE + +extra: + feedstock-name: jupyterhub-traefik-proxy + recipe-maintainers: + - bollwyvl From 76bff294de196c44c1b3a3d79a6797e2d9c57116 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Fri, 19 May 2023 15:13:31 -0500 Subject: [PATCH 2/8] make recipe folder --- recipes/{ => jupyterhub-traefik-proxy}/meta.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename recipes/{ => jupyterhub-traefik-proxy}/meta.yaml (100%) diff --git a/recipes/meta.yaml b/recipes/jupyterhub-traefik-proxy/meta.yaml similarity index 100% rename from recipes/meta.yaml rename to recipes/jupyterhub-traefik-proxy/meta.yaml From 359ea6b4eb594bad669bd35739b894bda8b00803 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Mon, 22 May 2023 09:11:09 -0500 Subject: [PATCH 3/8] try 127.0.0.1 --- .../000-ipv4-localhost.diff | 59 +++++++++++++++++++ recipes/jupyterhub-traefik-proxy/meta.yaml | 2 + 2 files changed, 61 insertions(+) create mode 100644 recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff diff --git a/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff b/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff new file mode 100644 index 0000000000000..69d0df3be31d1 --- /dev/null +++ b/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff @@ -0,0 +1,59 @@ +diff --git a/tests/conftest.py b/tests/conftest.py +index e35c0da..c8dfed5 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -224,13 +224,13 @@ def _make_etcd_proxy(*, auth=False, client_ca=None, **extra_kwargs): + client_ca = str(client_ca) + kwargs.update( + dict( +- etcd_url="https://localhost:2379", ++ etcd_url="https://127.0.0.1:2379", + etcd_username=Config.etcd_user, + etcd_password=Config.etcd_password, + etcd_client_kwargs=dict( + grpc_options=[ +- ("grpc.ssl_target_name_override", "localhost"), +- ("grpc.default_authority", "localhost"), ++ ("grpc.ssl_target_name_override", "127.0.0.1"), ++ ("grpc.default_authority", "127.0.0.1"), + ], + ca_cert=client_ca, + ), +@@ -550,16 +550,16 @@ async def launch_etcd_auth(etcd_ssl_key_cert, etcd_client_ca): + f"--peer-trusted-ca-file={etcd_client_ca}", + f"--cert-file={cert}", + f"--key-file={key}", +- "--initial-cluster=default=https://localhost:2380", +- "--initial-advertise-peer-urls=https://localhost:2380", +- "--listen-peer-urls=https://localhost:2380", +- "--listen-client-urls=https://localhost:2379", +- "--advertise-client-urls=https://localhost:2379", ++ "--initial-cluster=default=https://127.0.0.1:2380", ++ "--initial-advertise-peer-urls=https://127.0.0.1:2380", ++ "--listen-peer-urls=https://127.0.0.1:2380", ++ "--listen-client-urls=https://127.0.0.1:2379", ++ "--advertise-client-urls=https://127.0.0.1:2379", + "--log-level=debug", + ], + ) + etcdctl_args = [ +- "--endpoints=localhost:2379", ++ "--endpoints=127.0.0.1:2379", + "--user", + f"{Config.etcd_user}:{Config.etcd_password}", + f"--cacert={etcd_client_ca}", +@@ -575,11 +575,11 @@ async def launch_etcd_auth(etcd_ssl_key_cert, etcd_client_ca): + c = etcd3.client( + user=Config.etcd_user, + password=Config.etcd_password, +- host="localhost", ++ host="127.0.0.1", + port=2379, + grpc_options=[ +- ("grpc.ssl_target_name_override", "localhost"), +- ("grpc.default_authority", "localhost"), ++ ("grpc.ssl_target_name_override", "127.0.0.1"), ++ ("grpc.default_authority", "127.0.0.1"), + ], + ca_cert=etcd_client_ca, + ) diff --git a/recipes/jupyterhub-traefik-proxy/meta.yaml b/recipes/jupyterhub-traefik-proxy/meta.yaml index 50cfd376e1a0b..bfe74736bb763 100644 --- a/recipes/jupyterhub-traefik-proxy/meta.yaml +++ b/recipes/jupyterhub-traefik-proxy/meta.yaml @@ -7,6 +7,8 @@ package: source: url: https://github.com/jupyterhub/traefik-proxy/archive/refs/tags/{{ version }}.tar.gz sha256: 2dc4df9ecbdff275b8868fe8f8712be77dd4575f2102ba71978cd739cc2202b3 + patches: + - 000-ipv4-localhost.diff build: noarch: python From 2e85070d3947f1602f5dd35daf4f532a93616d50 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 23 May 2023 07:23:37 -0500 Subject: [PATCH 4/8] more 127.0.0.1 --- .../000-ipv4-localhost.diff | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff b/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff index 69d0df3be31d1..f23b1c226031b 100644 --- a/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff +++ b/recipes/jupyterhub-traefik-proxy/000-ipv4-localhost.diff @@ -1,3 +1,16 @@ +diff --git a/jupyterhub_traefik_proxy/proxy.py b/jupyterhub_traefik_proxy/proxy.py +index ddbefbe..28c218d 100644 +--- a/jupyterhub_traefik_proxy/proxy.py ++++ b/jupyterhub_traefik_proxy/proxy.py +@@ -153,7 +153,7 @@ class TraefikProxy(Proxy): + ) + + traefik_api_url = Unicode( +- "http://localhost:8099", ++ "http://127.0.0.1:8099", + config=True, + help="""traefik authenticated api endpoint url""", + ) diff --git a/tests/conftest.py b/tests/conftest.py index e35c0da..c8dfed5 100644 --- a/tests/conftest.py From 23996cce9721ff1b7abd3b1beb29f1d4a50b1bff Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 23 May 2023 07:37:48 -0500 Subject: [PATCH 5/8] bump down coverage --- recipes/jupyterhub-traefik-proxy/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/jupyterhub-traefik-proxy/meta.yaml b/recipes/jupyterhub-traefik-proxy/meta.yaml index bfe74736bb763..2df2739c225b6 100644 --- a/recipes/jupyterhub-traefik-proxy/meta.yaml +++ b/recipes/jupyterhub-traefik-proxy/meta.yaml @@ -128,7 +128,7 @@ outputs: - jupyterhub_traefik_proxy commands: - pip check - - cd tests && python -m pytest -vv --asyncio-mode=auto --cov=jupyterhub_traefik_proxy --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail -k "not (etcd or consul)" --cov-fail-under=72 + - cd tests && python -m pytest -vv --asyncio-mode=auto --cov=jupyterhub_traefik_proxy --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail -k "not (etcd or consul)" --cov-fail-under=70 requires: - notebook >=4.0,<7.0 - pip From 3bc70ce112abfcce0980f3596cbb63698f0dcfce Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 23 May 2023 08:11:35 -0500 Subject: [PATCH 6/8] move test invocation to run_test.py, add osx skips --- recipes/jupyterhub-traefik-proxy/meta.yaml | 2 +- recipes/jupyterhub-traefik-proxy/run_test.py | 35 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 recipes/jupyterhub-traefik-proxy/run_test.py diff --git a/recipes/jupyterhub-traefik-proxy/meta.yaml b/recipes/jupyterhub-traefik-proxy/meta.yaml index 2df2739c225b6..99ff58960e9cc 100644 --- a/recipes/jupyterhub-traefik-proxy/meta.yaml +++ b/recipes/jupyterhub-traefik-proxy/meta.yaml @@ -128,7 +128,7 @@ outputs: - jupyterhub_traefik_proxy commands: - pip check - - cd tests && python -m pytest -vv --asyncio-mode=auto --cov=jupyterhub_traefik_proxy --cov-branch --cov-report=term-missing:skip-covered --no-cov-on-fail -k "not (etcd or consul)" --cov-fail-under=70 + # more tests in run_tests.py requires: - notebook >=4.0,<7.0 - pip diff --git a/recipes/jupyterhub-traefik-proxy/run_test.py b/recipes/jupyterhub-traefik-proxy/run_test.py new file mode 100644 index 0000000000000..6a4d92c883037 --- /dev/null +++ b/recipes/jupyterhub-traefik-proxy/run_test.py @@ -0,0 +1,35 @@ +import sys +import subprocess +import platform +import os +from pathlib import Path + +SRC_DIR = Path(os.environ["SRC_DIR"]) +TESTS = SRC_DIR / "tests" + +# pytest arg inputs... etcd is available on conda-forge, so _could_ be tested, but... +SKIPS = ["etcd", "consul"] +# slightly higher locally, but... +COV_FAIL_UNDER = 70 + +# osx-specific skips +if platform.system() == "Darwin": + SKIPS += ["(add_get_delete and external_file_proxy_toml)"] + +PYTEST_ARGS = [ + sys.executable, + "-m", + "pytest", + "-vv", + "--asyncio-mode=auto", + "--cov=jupyterhub_traefik_proxy", + "--cov-report=term-missing:skip-covered", + "--no-cov-on-fail", + f"--cov-fail-under={COV_FAIL_UNDER}", + "-k", + f"""not ({" or ".join(SKIPS)})""", +] + +if __name__ == "__main__": + print("\t".join(PYTEST_ARGS)) + sys.exit(subprocess.call(PYTEST_ARGS, cwd=str(TESTS))) From 587229149c98803050932b299e8c636dd93e874a Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Tue, 23 May 2023 08:59:51 -0500 Subject: [PATCH 7/8] don't use SRC_DIR --- recipes/jupyterhub-traefik-proxy/run_test.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/jupyterhub-traefik-proxy/run_test.py b/recipes/jupyterhub-traefik-proxy/run_test.py index 6a4d92c883037..b438ca866cdf2 100644 --- a/recipes/jupyterhub-traefik-proxy/run_test.py +++ b/recipes/jupyterhub-traefik-proxy/run_test.py @@ -1,11 +1,10 @@ import sys import subprocess import platform -import os from pathlib import Path -SRC_DIR = Path(os.environ["SRC_DIR"]) -TESTS = SRC_DIR / "tests" +HERE = Path(__file__).parent +TESTS = HERE / "tests" # pytest arg inputs... etcd is available on conda-forge, so _could_ be tested, but... SKIPS = ["etcd", "consul"] From 666562ec4e7b6a7cddee9751598fb169be676d48 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Thu, 25 May 2023 08:56:51 -0500 Subject: [PATCH 8/8] 1.0.1, rename run_test --- recipes/jupyterhub-traefik-proxy/meta.yaml | 12 ++++++------ .../{run_test.py => run_test_all.py} | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) rename recipes/jupyterhub-traefik-proxy/{run_test.py => run_test_all.py} (90%) diff --git a/recipes/jupyterhub-traefik-proxy/meta.yaml b/recipes/jupyterhub-traefik-proxy/meta.yaml index 99ff58960e9cc..324a5f45049ce 100644 --- a/recipes/jupyterhub-traefik-proxy/meta.yaml +++ b/recipes/jupyterhub-traefik-proxy/meta.yaml @@ -1,12 +1,12 @@ -{% set version = "1.0.0" %} +{% set version = "1.0.1" %} package: name: jupyterhub-traefik-proxy-split version: {{ version }} source: - url: https://github.com/jupyterhub/traefik-proxy/archive/refs/tags/{{ version }}.tar.gz - sha256: 2dc4df9ecbdff275b8868fe8f8712be77dd4575f2102ba71978cd739cc2202b3 + url: https://pypi.org/packages/source/j/jupyterhub-traefik-proxy/jupyterhub-traefik-proxy-{{ version }}.tar.gz + sha256: 19f242763eb0ee4861537ed956cafe78db49c3bf653e7726717adce39599e2f5 patches: - 000-ipv4-localhost.diff @@ -25,8 +25,6 @@ outputs: build: noarch: python script: - # TODO: remove after https://github.com/jupyterhub/traefik-proxy/pull/207 - - {{ PYTHON }} -c "__import__('shutil').rmtree('performance')" - {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation requirements: host: @@ -122,13 +120,15 @@ outputs: - {{ pin_subpackage("jupyterhub-traefik-proxy", max_pin="x.x.x") }} - python >=3.6 test: + files: + - run_test_all.py source_files: - tests imports: - jupyterhub_traefik_proxy commands: - pip check - # more tests in run_tests.py + - python run_test_all.py requires: - notebook >=4.0,<7.0 - pip diff --git a/recipes/jupyterhub-traefik-proxy/run_test.py b/recipes/jupyterhub-traefik-proxy/run_test_all.py similarity index 90% rename from recipes/jupyterhub-traefik-proxy/run_test.py rename to recipes/jupyterhub-traefik-proxy/run_test_all.py index b438ca866cdf2..4dde217de6759 100644 --- a/recipes/jupyterhub-traefik-proxy/run_test.py +++ b/recipes/jupyterhub-traefik-proxy/run_test_all.py @@ -4,7 +4,6 @@ from pathlib import Path HERE = Path(__file__).parent -TESTS = HERE / "tests" # pytest arg inputs... etcd is available on conda-forge, so _could_ be tested, but... SKIPS = ["etcd", "consul"] @@ -31,4 +30,4 @@ if __name__ == "__main__": print("\t".join(PYTEST_ARGS)) - sys.exit(subprocess.call(PYTEST_ARGS, cwd=str(TESTS))) + sys.exit(subprocess.call(PYTEST_ARGS))