diff --git a/dev-requirements.txt b/dev-requirements.txt index e820a967..0eae2139 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,3 +5,7 @@ codecov black notebook>=4.0 websockets +# etcd3 & python-consul2 are now soft dependencies +# Adding them here prevents CI from failing +etcd3 +python-consul2 \ No newline at end of file diff --git a/jupyterhub_traefik_proxy/consul.py b/jupyterhub_traefik_proxy/consul.py index 33416ccd..3459aab0 100644 --- a/jupyterhub_traefik_proxy/consul.py +++ b/jupyterhub_traefik_proxy/consul.py @@ -25,7 +25,6 @@ import base64 import asyncio -import consul.aio import escapism from tornado.concurrent import run_on_executor from traitlets import Any, default, Unicode @@ -56,6 +55,10 @@ def _default_kv_url(self): @default("kv_client") def _default_client(self): + try: + import consul.aio + except ImportError: + raise ImportError("Please install python-consul2 package to use traefik-proxy with consul") consul_service = urlparse(self.kv_url) if self.kv_password: client = consul.aio.Consul( diff --git a/jupyterhub_traefik_proxy/etcd.py b/jupyterhub_traefik_proxy/etcd.py index 95d22bb4..9b0e0d15 100644 --- a/jupyterhub_traefik_proxy/etcd.py +++ b/jupyterhub_traefik_proxy/etcd.py @@ -23,7 +23,6 @@ import os from urllib.parse import urlparse -import etcd3 from tornado.concurrent import run_on_executor from traitlets import Any, default, Unicode @@ -73,6 +72,10 @@ def _default_kv_url(self): @default("kv_client") def _default_client(self): etcd_service = urlparse(self.kv_url) + try: + import etcd3 + except ImportError: + raise ImportError("Please install etcd3 package to use traefik-proxy with etcd3") if self.kv_password: return etcd3.client( host=str(etcd_service.hostname), diff --git a/requirements.txt b/requirements.txt index 1cfa126c..ccb6dc38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,5 @@ aiohttp escapism -etcd3 jupyterhub>=0.9 passlib -python-consul2 toml