mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 06:22:59 +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 import gen, web
|
||||
|
||||
import IPython
|
||||
if V(IPython.__version__) < V('3.0'):
|
||||
raise ImportError("JupyterHub Requires IPython >= 3.0, found %s" % IPython.__version__)
|
||||
|
||||
from IPython.utils.traitlets import (
|
||||
from traitlets import (
|
||||
Unicode, Integer, Dict, TraitError, List, Bool, Any,
|
||||
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__)
|
||||
|
||||
|
@@ -10,8 +10,8 @@ from subprocess import check_call, check_output, CalledProcessError
|
||||
from tornado import gen
|
||||
import simplepam
|
||||
|
||||
from IPython.config import LoggingConfigurable
|
||||
from IPython.utils.traitlets import Bool, Set, Unicode, Any
|
||||
from traitlets.config import LoggingConfigurable
|
||||
from traitlets import Bool, Set, Unicode, Any
|
||||
|
||||
from .handlers.login import LoginHandler
|
||||
from .utils import url_path_join
|
||||
|
@@ -17,7 +17,7 @@ from jinja2 import ChoiceLoader, FunctionLoader
|
||||
from tornado import ioloop
|
||||
from tornado.web import HTTPError
|
||||
|
||||
from IPython.utils.traitlets import (
|
||||
from traitlets import (
|
||||
Integer,
|
||||
Unicode,
|
||||
CUnicode,
|
||||
|
@@ -16,8 +16,8 @@ from tempfile import TemporaryDirectory
|
||||
from tornado import gen
|
||||
from tornado.ioloop import IOLoop, PeriodicCallback
|
||||
|
||||
from IPython.config import LoggingConfigurable
|
||||
from IPython.utils.traitlets import (
|
||||
from traitlets.config import LoggingConfigurable
|
||||
from traitlets import (
|
||||
Any, Bool, Dict, Enum, Instance, Integer, Float, List, Unicode,
|
||||
)
|
||||
|
||||
|
@@ -1,7 +1,4 @@
|
||||
try:
|
||||
from traitlets import HasTraits
|
||||
except ImportError:
|
||||
from IPython.utils.traitlets import HasTraits
|
||||
|
||||
from jupyterhub.traitlets import URLPrefix, Command
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
from IPython.utils.traitlets import List, Unicode
|
||||
from traitlets import List, Unicode
|
||||
|
||||
class URLPrefix(Unicode):
|
||||
def validate(self, obj, value):
|
||||
|
@@ -14,11 +14,6 @@ from tornado import web, gen, ioloop
|
||||
from tornado.httpclient import AsyncHTTPClient, HTTPError
|
||||
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():
|
||||
"""get a single random port"""
|
||||
@@ -174,3 +169,24 @@ def compare_token(compare, token):
|
||||
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
|
||||
jinja2
|
||||
simplepam
|
||||
|
Reference in New Issue
Block a user