Skip to content

Commit

Permalink
Make etcd3 & python-consul2 soft dependencies
Browse files Browse the repository at this point in the history
Fixes #125
  • Loading branch information
yuvipanda committed Mar 28, 2021
1 parent 467c893 commit a208e00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion jupyterhub_traefik_proxy/consul.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion jupyterhub_traefik_proxy/etcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
aiohttp
escapism
etcd3
jupyterhub>=0.9
passlib
python-consul2
toml

0 comments on commit a208e00

Please sign in to comment.