mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 22:13:00 +00:00
remove dependency on IPython
- Standalone traitlets has been released, use it directly. - Copy url_path_join from notebook
This commit is contained in:
@@ -31,15 +31,11 @@ from tornado.ioloop import IOLoop, PeriodicCallback
|
|||||||
from tornado.log import app_log, access_log, gen_log
|
from tornado.log import app_log, access_log, gen_log
|
||||||
from tornado import gen, web
|
from tornado import gen, web
|
||||||
|
|
||||||
import IPython
|
from traitlets import (
|
||||||
if V(IPython.__version__) < V('3.0'):
|
|
||||||
raise ImportError("JupyterHub Requires IPython >= 3.0, found %s" % IPython.__version__)
|
|
||||||
|
|
||||||
from IPython.utils.traitlets import (
|
|
||||||
Unicode, Integer, Dict, TraitError, List, Bool, Any,
|
Unicode, Integer, Dict, TraitError, List, Bool, Any,
|
||||||
Type, Set, Instance, Bytes, Float,
|
Type, Set, Instance, Bytes, Float,
|
||||||
)
|
)
|
||||||
from IPython.config import Application, catch_config_error
|
from traitlets.config import Application, catch_config_error
|
||||||
|
|
||||||
here = os.path.dirname(__file__)
|
here = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
@@ -10,8 +10,8 @@ from subprocess import check_call, check_output, CalledProcessError
|
|||||||
from tornado import gen
|
from tornado import gen
|
||||||
import simplepam
|
import simplepam
|
||||||
|
|
||||||
from IPython.config import LoggingConfigurable
|
from traitlets.config import LoggingConfigurable
|
||||||
from IPython.utils.traitlets import Bool, Set, Unicode, Any
|
from traitlets import Bool, Set, Unicode, Any
|
||||||
|
|
||||||
from .handlers.login import LoginHandler
|
from .handlers.login import LoginHandler
|
||||||
from .utils import url_path_join
|
from .utils import url_path_join
|
||||||
|
@@ -17,7 +17,7 @@ from jinja2 import ChoiceLoader, FunctionLoader
|
|||||||
from tornado import ioloop
|
from tornado import ioloop
|
||||||
from tornado.web import HTTPError
|
from tornado.web import HTTPError
|
||||||
|
|
||||||
from IPython.utils.traitlets import (
|
from traitlets import (
|
||||||
Integer,
|
Integer,
|
||||||
Unicode,
|
Unicode,
|
||||||
CUnicode,
|
CUnicode,
|
||||||
|
@@ -16,8 +16,8 @@ from tempfile import TemporaryDirectory
|
|||||||
from tornado import gen
|
from tornado import gen
|
||||||
from tornado.ioloop import IOLoop, PeriodicCallback
|
from tornado.ioloop import IOLoop, PeriodicCallback
|
||||||
|
|
||||||
from IPython.config import LoggingConfigurable
|
from traitlets.config import LoggingConfigurable
|
||||||
from IPython.utils.traitlets import (
|
from traitlets import (
|
||||||
Any, Bool, Dict, Enum, Instance, Integer, Float, List, Unicode,
|
Any, Bool, Dict, Enum, Instance, Integer, Float, List, Unicode,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
try:
|
from traitlets import HasTraits
|
||||||
from traitlets import HasTraits
|
|
||||||
except ImportError:
|
|
||||||
from IPython.utils.traitlets import HasTraits
|
|
||||||
|
|
||||||
from jupyterhub.traitlets import URLPrefix, Command
|
from jupyterhub.traitlets import URLPrefix, Command
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
|
|
||||||
from IPython.utils.traitlets import List, Unicode
|
from traitlets import List, Unicode
|
||||||
|
|
||||||
class URLPrefix(Unicode):
|
class URLPrefix(Unicode):
|
||||||
def validate(self, obj, value):
|
def validate(self, obj, value):
|
||||||
|
@@ -14,11 +14,6 @@ from tornado import web, gen, ioloop
|
|||||||
from tornado.httpclient import AsyncHTTPClient, HTTPError
|
from tornado.httpclient import AsyncHTTPClient, HTTPError
|
||||||
from tornado.log import app_log
|
from tornado.log import app_log
|
||||||
|
|
||||||
try:
|
|
||||||
from jupyter_notebook.utils import url_path_join
|
|
||||||
except:
|
|
||||||
from IPython.html.utils import url_path_join
|
|
||||||
|
|
||||||
|
|
||||||
def random_port():
|
def random_port():
|
||||||
"""get a single random port"""
|
"""get a single random port"""
|
||||||
@@ -172,5 +167,26 @@ def compare_token(compare, token):
|
|||||||
if compare == hashed:
|
if compare == hashed:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def url_path_join(*pieces):
|
||||||
|
"""Join components of url into a relative url
|
||||||
|
|
||||||
|
Use to prevent double slash when joining subpath. This will leave the
|
||||||
|
initial and final / in place
|
||||||
|
|
||||||
|
Copied from notebook.utils.url_path_join
|
||||||
|
"""
|
||||||
|
initial = pieces[0].startswith('/')
|
||||||
|
final = pieces[-1].endswith('/')
|
||||||
|
stripped = [ s.strip('/') for s in pieces ]
|
||||||
|
result = '/'.join(s for s in stripped if s)
|
||||||
|
|
||||||
|
if initial:
|
||||||
|
result = '/' + result
|
||||||
|
if final:
|
||||||
|
result = result + '/'
|
||||||
|
if result == '//':
|
||||||
|
result = '/'
|
||||||
|
|
||||||
|
return result
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
ipython>=3
|
traitlets>=4
|
||||||
tornado>=4
|
tornado>=4
|
||||||
jinja2
|
jinja2
|
||||||
simplepam
|
simplepam
|
||||||
|
Reference in New Issue
Block a user