Skip to content

Commit

Permalink
Merge pull request #127 from yuvipanda/optional-deps
Browse files Browse the repository at this point in the history
Make etcd3 & python-consul2 soft dependencies
  • Loading branch information
GeorgianaElena authored May 10, 2021
2 parents f2d8366 + 7b31ffa commit d8d729c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 d8d729c

Please sign in to comment.