##// END OF EJS Templates
update dependency imports...
Min RK -
r21253:ff3b995a
parent child
Show More
@@ -42,7 +42,6 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
42 # Setup the top level names
42 # Setup the top level names
43 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
44
44
45 from .config.loader import Config
46 from .core.getipython import get_ipython
45 from .core.getipython import get_ipython
47 from .core import release
46 from .core import release
48 from .core.application import Application
47 from .core.application import Application
@@ -88,7 +87,7 def embed_kernel(module=None, local_ns=None, **kwargs):
88 local_ns = caller_locals
87 local_ns = caller_locals
89
88
90 # Only import .zmq when we really need it
89 # Only import .zmq when we really need it
91 from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel
90 from ipython_kernel.embed import embed_kernel as real_embed_kernel
92 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
91 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
93
92
94 def start_ipython(argv=None, **kwargs):
93 def start_ipython(argv=None, **kwargs):
@@ -24,11 +24,11 import os
24 import re
24 import re
25 import sys
25 import sys
26
26
27 from IPython.config.configurable import Configurable
27 from traitlets.config.configurable import Configurable
28 from IPython.core.error import UsageError
28 from IPython.core.error import UsageError
29
29
30 from IPython.utils.py3compat import string_types
30 from IPython.utils.py3compat import string_types
31 from IPython.utils.traitlets import List, Instance
31 from traitlets import List, Instance
32 from IPython.utils.warn import error
32 from IPython.utils.warn import error
33
33
34 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
@@ -19,13 +19,14 import os
19 import shutil
19 import shutil
20 import sys
20 import sys
21
21
22 from IPython.config.application import Application, catch_config_error
22 from traitlets.config.application import Application, catch_config_error
23 from IPython.config.loader import ConfigFileNotFound, PyFileConfigLoader
23 from traitlets.config.loader import ConfigFileNotFound, PyFileConfigLoader
24 from IPython.core import release, crashhandler
24 from IPython.core import release, crashhandler
25 from IPython.core.profiledir import ProfileDir, ProfileDirError
25 from IPython.core.profiledir import ProfileDir, ProfileDirError
26 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir, ensure_dir_exists
26 from IPython.paths import get_ipython_dir, get_ipython_package_dir
27 from IPython.utils.path import ensure_dir_exists
27 from IPython.utils import py3compat
28 from IPython.utils import py3compat
28 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, Set, Instance, Undefined
29 from traitlets import List, Unicode, Type, Bool, Dict, Set, Instance, Undefined
29
30
30 if os.name == 'nt':
31 if os.name == 'nt':
31 programdata = os.environ.get('PROGRAMDATA', None)
32 programdata = os.environ.get('PROGRAMDATA', None)
@@ -18,10 +18,10 Authors:
18 # Imports
18 # Imports
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20
20
21 from IPython.config.configurable import Configurable
21 from traitlets.config.configurable import Configurable
22
22
23 from IPython.utils.py3compat import builtin_mod, iteritems
23 from IPython.utils.py3compat import builtin_mod, iteritems
24 from IPython.utils.traitlets import Instance
24 from traitlets import Instance
25
25
26 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
27 # Classes and functions
27 # Classes and functions
@@ -64,7 +64,7 import sys
64 import unicodedata
64 import unicodedata
65 import string
65 import string
66
66
67 from IPython.config.configurable import Configurable
67 from traitlets.config.configurable import Configurable
68 from IPython.core.error import TryNext
68 from IPython.core.error import TryNext
69 from IPython.core.inputsplitter import ESC_MAGIC
69 from IPython.core.inputsplitter import ESC_MAGIC
70 from IPython.core.latex_symbols import latex_symbols, reverse_latex_symbol
70 from IPython.core.latex_symbols import latex_symbols, reverse_latex_symbol
@@ -74,7 +74,7 from IPython.utils.decorators import undoc
74 from IPython.utils.dir2 import dir2
74 from IPython.utils.dir2 import dir2
75 from IPython.utils.process import arg_split
75 from IPython.utils.process import arg_split
76 from IPython.utils.py3compat import builtin_mod, string_types, PY3
76 from IPython.utils.py3compat import builtin_mod, string_types, PY3
77 from IPython.utils.traitlets import CBool, Enum
77 from traitlets import CBool, Enum
78
78
79 #-----------------------------------------------------------------------------
79 #-----------------------------------------------------------------------------
80 # Globals
80 # Globals
@@ -930,9 +930,9 def set_matplotlib_formats(*formats, **kwargs):
930 """
930 """
931 from IPython.core.interactiveshell import InteractiveShell
931 from IPython.core.interactiveshell import InteractiveShell
932 from IPython.core.pylabtools import select_figure_formats
932 from IPython.core.pylabtools import select_figure_formats
933 from IPython.kernel.zmq.pylab.config import InlineBackend
934 # build kwargs, starting with InlineBackend config
933 # build kwargs, starting with InlineBackend config
935 kw = {}
934 kw = {}
935 from ipython_kernel.pylab.config import InlineBackend
936 cfg = InlineBackend.instance()
936 cfg = InlineBackend.instance()
937 kw.update(cfg.print_figure_kwargs)
937 kw.update(cfg.print_figure_kwargs)
938 kw.update(**kwargs)
938 kw.update(**kwargs)
@@ -961,7 +961,7 def set_matplotlib_close(close=True):
961 Should all matplotlib figures be automatically closed after each cell is
961 Should all matplotlib figures be automatically closed after each cell is
962 run?
962 run?
963 """
963 """
964 from IPython.kernel.zmq.pylab.config import InlineBackend
964 from ipython_kernel.pylab.config import InlineBackend
965 cfg = InlineBackend.instance()
965 cfg = InlineBackend.instance()
966 cfg.close_figures = close
966 cfg.close_figures = close
967
967
@@ -21,8 +21,8 Authors:
21
21
22 import sys
22 import sys
23
23
24 from IPython.config.configurable import Configurable
24 from traitlets.config.configurable import Configurable
25 from IPython.utils.traitlets import Any
25 from traitlets import Any
26
26
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28 # Classes and functions
28 # Classes and functions
@@ -12,10 +12,10 from __future__ import print_function
12 import sys
12 import sys
13
13
14 from IPython.core.formatters import _safe_get_formatter_method
14 from IPython.core.formatters import _safe_get_formatter_method
15 from IPython.config.configurable import Configurable
15 from traitlets.config.configurable import Configurable
16 from IPython.utils import io
16 from IPython.utils import io
17 from IPython.utils.py3compat import builtin_mod
17 from IPython.utils.py3compat import builtin_mod
18 from IPython.utils.traitlets import Instance, Float
18 from traitlets import Instance, Float
19 from IPython.utils.warn import warn
19 from IPython.utils.warn import warn
20
20
21 # TODO: Move the various attributes (cache_size, [others now moved]). Some
21 # TODO: Move the various attributes (cache_size, [others now moved]). Some
@@ -17,9 +17,9 spec.
17
17
18 from __future__ import print_function
18 from __future__ import print_function
19
19
20 from IPython.config.configurable import Configurable
20 from traitlets.config.configurable import Configurable
21 from IPython.utils import io
21 from IPython.utils import io
22 from IPython.utils.traitlets import List
22 from traitlets import List
23
23
24 # This used to be defined here - it is imported for backwards compatibility
24 # This used to be defined here - it is imported for backwards compatibility
25 from .display import publish_display_data
25 from .display import publish_display_data
@@ -8,9 +8,9 import os
8 from shutil import copyfile
8 from shutil import copyfile
9 import sys
9 import sys
10
10
11 from IPython.config.configurable import Configurable
11 from traitlets.config.configurable import Configurable
12 from IPython.utils.path import ensure_dir_exists
12 from IPython.utils.path import ensure_dir_exists
13 from IPython.utils.traitlets import Instance
13 from traitlets import Instance
14 from IPython.utils.py3compat import PY3
14 from IPython.utils.py3compat import PY3
15 if PY3:
15 if PY3:
16 from imp import reload
16 from imp import reload
@@ -19,11 +19,11 import warnings
19
19
20 from decorator import decorator
20 from decorator import decorator
21
21
22 from IPython.config.configurable import Configurable
22 from traitlets.config.configurable import Configurable
23 from IPython.core.getipython import get_ipython
23 from IPython.core.getipython import get_ipython
24 from IPython.utils.sentinel import Sentinel
24 from IPython.utils.sentinel import Sentinel
25 from IPython.lib import pretty
25 from IPython.lib import pretty
26 from IPython.utils.traitlets import (
26 from traitlets import (
27 Bool, Dict, Integer, Unicode, CUnicode, ObjectName, List,
27 Bool, Dict, Integer, Unicode, CUnicode, ObjectName, List,
28 ForwardDeclaredInstance,
28 ForwardDeclaredInstance,
29 )
29 )
@@ -27,12 +27,12 except ImportError:
27 import threading
27 import threading
28
28
29 # Our own packages
29 # Our own packages
30 from IPython.config.configurable import Configurable
30 from traitlets.config.configurable import Configurable
31 from decorator import decorator
31 from decorator import decorator
32 from IPython.utils.decorators import undoc
32 from IPython.utils.decorators import undoc
33 from IPython.utils.path import locate_profile
33 from IPython.utils.path import locate_profile
34 from IPython.utils import py3compat
34 from IPython.utils import py3compat
35 from IPython.utils.traitlets import (
35 from traitlets import (
36 Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError,
36 Any, Bool, Dict, Instance, Integer, List, Unicode, TraitError,
37 )
37 )
38 from IPython.utils.warn import warn
38 from IPython.utils.warn import warn
@@ -177,7 +177,7 class HistoryAccessor(HistoryAccessorBase):
177 hist_file : str
177 hist_file : str
178 Path to an SQLite history database stored by IPython. If specified,
178 Path to an SQLite history database stored by IPython. If specified,
179 hist_file overrides profile.
179 hist_file overrides profile.
180 config : :class:`~IPython.config.loader.Config`
180 config : :class:`~traitlets.config.loader.Config`
181 Config object. hist_file can also be set through this.
181 Config object. hist_file can also be set through this.
182 """
182 """
183 # We need a pointer back to the shell for various tasks.
183 # We need a pointer back to the shell for various tasks.
@@ -9,9 +9,9 from __future__ import print_function
9 import os
9 import os
10 import sqlite3
10 import sqlite3
11
11
12 from IPython.config.application import Application
12 from traitlets.config.application import Application
13 from IPython.core.application import BaseIPythonApplication
13 from IPython.core.application import BaseIPythonApplication
14 from IPython.utils.traitlets import Bool, Int, Dict
14 from traitlets import Bool, Int, Dict
15 from IPython.utils.io import ask_yes_no
15 from IPython.utils.io import ask_yes_no
16
16
17 trim_hist_help = """Trim the IPython history database to the last 1000 entries.
17 trim_hist_help = """Trim the IPython history database to the last 1000 entries.
@@ -29,7 +29,7 from io import open as io_open
29
29
30 from pickleshare import PickleShareDB
30 from pickleshare import PickleShareDB
31
31
32 from IPython.config.configurable import SingletonConfigurable
32 from traitlets.config.configurable import SingletonConfigurable
33 from IPython.core import debugger, oinspect
33 from IPython.core import debugger, oinspect
34 from IPython.core import magic
34 from IPython.core import magic
35 from IPython.core import page
35 from IPython.core import page
@@ -64,7 +64,8 from IPython.utils import openpy
64 from IPython.utils.decorators import undoc
64 from IPython.utils.decorators import undoc
65 from IPython.utils.io import ask_yes_no
65 from IPython.utils.io import ask_yes_no
66 from IPython.utils.ipstruct import Struct
66 from IPython.utils.ipstruct import Struct
67 from IPython.utils.path import get_home_dir, get_ipython_dir, get_py_filename, unquote_filename, ensure_dir_exists
67 from IPython.paths import get_ipython_dir
68 from IPython.utils.path import get_home_dir, get_py_filename, unquote_filename, ensure_dir_exists
68 from IPython.utils.process import system, getoutput
69 from IPython.utils.process import system, getoutput
69 from IPython.utils.py3compat import (builtin_mod, unicode_type, string_types,
70 from IPython.utils.py3compat import (builtin_mod, unicode_type, string_types,
70 with_metaclass, iteritems)
71 with_metaclass, iteritems)
@@ -72,7 +73,7 from IPython.utils.strdispatch import StrDispatch
72 from IPython.utils.syspathcontext import prepended_to_syspath
73 from IPython.utils.syspathcontext import prepended_to_syspath
73 from IPython.utils.text import (format_screen, LSString, SList,
74 from IPython.utils.text import (format_screen, LSString, SList,
74 DollarFormatter)
75 DollarFormatter)
75 from IPython.utils.traitlets import (Integer, Bool, CBool, CaselessStrEnum, Enum,
76 from traitlets import (Integer, Bool, CBool, CaselessStrEnum, Enum,
76 List, Dict, Unicode, Instance, Type)
77 List, Dict, Unicode, Instance, Type)
77 from IPython.utils.warn import warn, error
78 from IPython.utils.warn import warn, error
78 import IPython.core.hooks
79 import IPython.core.hooks
@@ -2688,7 +2689,7 class InteractiveShell(SingletonConfigurable):
2688 def get_cells():
2689 def get_cells():
2689 """generator for sequence of code blocks to run"""
2690 """generator for sequence of code blocks to run"""
2690 if fname.endswith('.ipynb'):
2691 if fname.endswith('.ipynb'):
2691 from IPython.nbformat import read
2692 from jupyter_nbformat import read
2692 with io_open(fname) as f:
2693 with io_open(fname) as f:
2693 nb = read(f, as_version=4)
2694 nb = read(f, as_version=4)
2694 if not nb.cells:
2695 if not nb.cells:
@@ -23,7 +23,7 import types
23 from getopt import getopt, GetoptError
23 from getopt import getopt, GetoptError
24
24
25 # Our own
25 # Our own
26 from IPython.config.configurable import Configurable
26 from traitlets.config.configurable import Configurable
27 from IPython.core import oinspect
27 from IPython.core import oinspect
28 from IPython.core.error import UsageError
28 from IPython.core.error import UsageError
29 from IPython.core.inputsplitter import ESC_MAGIC, ESC_MAGIC2
29 from IPython.core.inputsplitter import ESC_MAGIC, ESC_MAGIC2
@@ -32,7 +32,7 from IPython.utils.ipstruct import Struct
32 from IPython.utils.process import arg_split
32 from IPython.utils.process import arg_split
33 from IPython.utils.py3compat import string_types, iteritems
33 from IPython.utils.py3compat import string_types, iteritems
34 from IPython.utils.text import dedent
34 from IPython.utils.text import dedent
35 from IPython.utils.traitlets import Bool, Dict, Instance, MetaHasTraits
35 from traitlets import Bool, Dict, Instance, MetaHasTraits
36 from IPython.utils.warn import error
36 from IPython.utils.warn import error
37
37
38 #-----------------------------------------------------------------------------
38 #-----------------------------------------------------------------------------
@@ -596,7 +596,7 Defaulting color scheme to 'NoColor'"""
596 """
596 """
597 args = magic_arguments.parse_argstring(self.notebook, s)
597 args = magic_arguments.parse_argstring(self.notebook, s)
598
598
599 from IPython.nbformat import write, v4
599 from jupyter_nbformat import write, v4
600 args.filename = unquote_filename(args.filename)
600 args.filename = unquote_filename(args.filename)
601 if args.export:
601 if args.export:
602 cells = []
602 cells = []
@@ -106,7 +106,7 class ConfigMagics(Magics):
106 In [5]: %config IPCompleter.greedy = feeling_greedy
106 In [5]: %config IPCompleter.greedy = feeling_greedy
107
107
108 """
108 """
109 from IPython.config.loader import Config
109 from traitlets.config.loader import Config
110 # some IPython objects are Configurable, but do not yet have
110 # some IPython objects are Configurable, but do not yet have
111 # any configurable traits. Exclude them from the effects of
111 # any configurable traits. Exclude them from the effects of
112 # this magic, as their presence is just noise:
112 # this magic, as their presence is just noise:
@@ -14,7 +14,7 from __future__ import print_function
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15
15
16 # Our own packages
16 # Our own packages
17 from IPython.config.application import Application
17 from traitlets.config.application import Application
18 from IPython.core import magic_arguments
18 from IPython.core import magic_arguments
19 from IPython.core.magic import Magics, magics_class, line_magic
19 from IPython.core.magic import Magics, magics_class, line_magic
20 from IPython.testing.skipdoctest import skip_doctest
20 from IPython.testing.skipdoctest import skip_doctest
@@ -22,7 +22,7 from subprocess import Popen, PIPE
22 import atexit
22 import atexit
23
23
24 # Our own packages
24 # Our own packages
25 from IPython.config.configurable import Configurable
25 from traitlets.config.configurable import Configurable
26 from IPython.core import magic_arguments
26 from IPython.core import magic_arguments
27 from IPython.core.magic import (
27 from IPython.core.magic import (
28 Magics, magics_class, line_magic, cell_magic
28 Magics, magics_class, line_magic, cell_magic
@@ -30,7 +30,7 from IPython.core.magic import (
30 from IPython.lib.backgroundjobs import BackgroundJobManager
30 from IPython.lib.backgroundjobs import BackgroundJobManager
31 from IPython.utils import py3compat
31 from IPython.utils import py3compat
32 from IPython.utils.process import arg_split
32 from IPython.utils.process import arg_split
33 from IPython.utils.traitlets import List, Dict
33 from traitlets import List, Dict
34
34
35 #-----------------------------------------------------------------------------
35 #-----------------------------------------------------------------------------
36 # Magic implementation classes
36 # Magic implementation classes
@@ -18,8 +18,8 Authors:
18 # Imports
18 # Imports
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20
20
21 from IPython.config.configurable import Configurable
21 from traitlets.config.configurable import Configurable
22 from IPython.utils.traitlets import List
22 from traitlets import List
23
23
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
25 # Main payload class
25 # Main payload class
@@ -28,7 +28,7 from keyword import iskeyword
28 import re
28 import re
29
29
30 from IPython.core.autocall import IPyAutocall
30 from IPython.core.autocall import IPyAutocall
31 from IPython.config.configurable import Configurable
31 from traitlets.config.configurable import Configurable
32 from IPython.core.inputsplitter import (
32 from IPython.core.inputsplitter import (
33 ESC_MAGIC,
33 ESC_MAGIC,
34 ESC_QUOTE,
34 ESC_QUOTE,
@@ -38,7 +38,7 from IPython.core.inputsplitter import (
38 from IPython.core.macro import Macro
38 from IPython.core.macro import Macro
39 from IPython.core.splitinput import LineInfo
39 from IPython.core.splitinput import LineInfo
40
40
41 from IPython.utils.traitlets import (
41 from traitlets import (
42 List, Integer, Unicode, CBool, Bool, Instance, CRegExp
42 List, Integer, Unicode, CBool, Bool, Instance, CRegExp
43 )
43 )
44
44
@@ -24,15 +24,15 from __future__ import print_function
24
24
25 import os
25 import os
26
26
27 from IPython.config.application import Application
27 from traitlets.config.application import Application
28 from IPython.core.application import (
28 from IPython.core.application import (
29 BaseIPythonApplication, base_flags
29 BaseIPythonApplication, base_flags
30 )
30 )
31 from IPython.core.profiledir import ProfileDir
31 from IPython.core.profiledir import ProfileDir
32 from IPython.utils.importstring import import_item
32 from IPython.utils.importstring import import_item
33 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
33 from IPython.paths import get_ipython_dir, get_ipython_package_dir
34 from IPython.utils import py3compat
34 from IPython.utils import py3compat
35 from IPython.utils.traitlets import Unicode, Bool, Dict
35 from traitlets import Unicode, Bool, Dict
36
36
37 #-----------------------------------------------------------------------------
37 #-----------------------------------------------------------------------------
38 # Constants
38 # Constants
@@ -261,25 +261,19 class ProfileCreate(BaseIPythonApplication):
261 from IPython.terminal.ipapp import TerminalIPythonApp
261 from IPython.terminal.ipapp import TerminalIPythonApp
262 apps = [TerminalIPythonApp]
262 apps = [TerminalIPythonApp]
263 for app_path in (
263 for app_path in (
264 'IPython.kernel.zmq.kernelapp.IPKernelApp',
264 'ipython_kernel.kernelapp.IPKernelApp',
265 'IPython.terminal.console.app.ZMQTerminalIPythonApp',
266 'IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp',
267 'IPython.html.notebookapp.NotebookApp',
268 'IPython.nbconvert.nbconvertapp.NbConvertApp',
269 ):
265 ):
270 app = self._import_app(app_path)
266 app = self._import_app(app_path)
271 if app is not None:
267 if app is not None:
272 apps.append(app)
268 apps.append(app)
273 if self.parallel:
269 if self.parallel:
274 from IPython.parallel.apps.ipcontrollerapp import IPControllerApp
270 from ipython_parallel.apps.ipcontrollerapp import IPControllerApp
275 from IPython.parallel.apps.ipengineapp import IPEngineApp
271 from ipython_parallel.apps.ipengineapp import IPEngineApp
276 from IPython.parallel.apps.ipclusterapp import IPClusterStart
272 from ipython_parallel.apps.ipclusterapp import IPClusterStart
277 from IPython.parallel.apps.iploggerapp import IPLoggerApp
278 apps.extend([
273 apps.extend([
279 IPControllerApp,
274 IPControllerApp,
280 IPEngineApp,
275 IPEngineApp,
281 IPClusterStart,
276 IPClusterStart,
282 IPLoggerApp,
283 ])
277 ])
284 for App in apps:
278 for App in apps:
285 app = App()
279 app = App()
@@ -8,10 +8,11 import os
8 import shutil
8 import shutil
9 import errno
9 import errno
10
10
11 from IPython.config.configurable import LoggingConfigurable
11 from traitlets.config.configurable import LoggingConfigurable
12 from IPython.utils.path import get_ipython_package_dir, expand_path, ensure_dir_exists
12 from IPython.paths import get_ipython_package_dir
13 from IPython.utils.path import expand_path, ensure_dir_exists
13 from IPython.utils import py3compat
14 from IPython.utils import py3compat
14 from IPython.utils.traitlets import Unicode, Bool
15 from traitlets import Unicode, Bool
15
16
16 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
17 # Module errors
18 # Module errors
@@ -137,34 +138,16 class ProfileDir(LoggingConfigurable):
137 def _static_dir_changed(self, name, old, new):
138 def _static_dir_changed(self, name, old, new):
138 self.check_startup_dir()
139 self.check_startup_dir()
139
140
140 def check_static_dir(self):
141 self._mkdir(self.static_dir)
142 custom = os.path.join(self.static_dir, 'custom')
143 self._mkdir(custom)
144 try:
145 from jupyter_notebook import DEFAULT_STATIC_FILES_PATH
146 except ImportError:
147 return
148 for fname in ('custom.js', 'custom.css'):
149 src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname)
150 dest = os.path.join(custom, fname)
151 if not os.path.exists(src):
152 self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src)
153 continue
154 if not os.path.exists(dest):
155 shutil.copy(src, dest)
156
157 def check_dirs(self):
141 def check_dirs(self):
158 self.check_security_dir()
142 self.check_security_dir()
159 self.check_log_dir()
143 self.check_log_dir()
160 self.check_pid_dir()
144 self.check_pid_dir()
161 self.check_startup_dir()
145 self.check_startup_dir()
162 self.check_static_dir()
163
146
164 def copy_config_file(self, config_file, path=None, overwrite=False):
147 def copy_config_file(self, config_file, path=None, overwrite=False):
165 """Copy a default config file into the active profile directory.
148 """Copy a default config file into the active profile directory.
166
149
167 Default configuration files are kept in :mod:`IPython.config.default`.
150 Default configuration files are kept in :mod:`IPython.core.profile`.
168 This function moves these from that location to the working profile
151 This function moves these from that location to the working profile
169 directory.
152 directory.
170 """
153 """
@@ -28,10 +28,10 import time
28
28
29 from string import Formatter
29 from string import Formatter
30
30
31 from IPython.config.configurable import Configurable
31 from traitlets.config.configurable import Configurable
32 from IPython.core import release
32 from IPython.core import release
33 from IPython.utils import coloransi, py3compat
33 from IPython.utils import coloransi, py3compat
34 from IPython.utils.traitlets import (Unicode, Instance, Dict, Bool, Int)
34 from traitlets import (Unicode, Instance, Dict, Bool, Int)
35
35
36 #-----------------------------------------------------------------------------
36 #-----------------------------------------------------------------------------
37 # Color schemes for prompts
37 # Color schemes for prompts
@@ -23,7 +23,7 backends = {'tk': 'TkAgg',
23 'osx': 'MacOSX',
23 'osx': 'MacOSX',
24 'nbagg': 'nbAgg',
24 'nbagg': 'nbAgg',
25 'notebook': 'nbAgg',
25 'notebook': 'nbAgg',
26 'inline' : 'module://IPython.kernel.zmq.pylab.backend_inline'}
26 'inline' : 'module://ipython_kernel.pylab.backend_inline'}
27
27
28 # We also need a reverse backends2guis mapping that will properly choose which
28 # We also need a reverse backends2guis mapping that will properly choose which
29 # GUI support to activate based on the desired matplotlib backend. For the
29 # GUI support to activate based on the desired matplotlib backend. For the
@@ -182,7 +182,7 def select_figure_formats(shell, formats, **kwargs):
182 Extra keyword arguments to be passed to fig.canvas.print_figure.
182 Extra keyword arguments to be passed to fig.canvas.print_figure.
183 """
183 """
184 from matplotlib.figure import Figure
184 from matplotlib.figure import Figure
185 from IPython.kernel.zmq.pylab import backend_inline
185 from ipython_kernel.pylab import backend_inline
186
186
187 svg_formatter = shell.display_formatter.formatters['image/svg+xml']
187 svg_formatter = shell.display_formatter.formatters['image/svg+xml']
188 png_formatter = shell.display_formatter.formatters['image/png']
188 png_formatter = shell.display_formatter.formatters['image/png']
@@ -233,7 +233,7 def find_gui_and_backend(gui=None, gui_select=None):
233 Returns
233 Returns
234 -------
234 -------
235 A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',
235 A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',
236 'WXAgg','Qt4Agg','module://IPython.kernel.zmq.pylab.backend_inline').
236 'WXAgg','Qt4Agg','module://ipython_kernel.pylab.backend_inline').
237 """
237 """
238
238
239 import matplotlib
239 import matplotlib
@@ -334,7 +334,7 def configure_inline_support(shell, backend):
334 # continuing (such as in terminal-only shells in environments without
334 # continuing (such as in terminal-only shells in environments without
335 # zeromq available).
335 # zeromq available).
336 try:
336 try:
337 from IPython.kernel.zmq.pylab.backend_inline import InlineBackend
337 from ipython_kernel.pylab.backend_inline import InlineBackend
338 except ImportError:
338 except ImportError:
339 return
339 return
340 from matplotlib import pyplot
340 from matplotlib import pyplot
@@ -345,7 +345,7 def configure_inline_support(shell, backend):
345 shell.configurables.append(cfg)
345 shell.configurables.append(cfg)
346
346
347 if backend == backends['inline']:
347 if backend == backends['inline']:
348 from IPython.kernel.zmq.pylab.backend_inline import flush_figures
348 from ipython_kernel.pylab.backend_inline import flush_figures
349 shell.events.register('post_execute', flush_figures)
349 shell.events.register('post_execute', flush_figures)
350
350
351 # Save rcParams that will be overwrittern
351 # Save rcParams that will be overwrittern
@@ -355,7 +355,7 def configure_inline_support(shell, backend):
355 # load inline_rc
355 # load inline_rc
356 pyplot.rcParams.update(cfg.rc)
356 pyplot.rcParams.update(cfg.rc)
357 else:
357 else:
358 from IPython.kernel.zmq.pylab.backend_inline import flush_figures
358 from ipython_kernel.pylab.backend_inline import flush_figures
359 try:
359 try:
360 shell.events.unregister('post_execute', flush_figures)
360 shell.events.unregister('post_execute', flush_figures)
361 except ValueError:
361 except ValueError:
@@ -14,14 +14,14 import glob
14 import os
14 import os
15 import sys
15 import sys
16
16
17 from IPython.config.application import boolean_flag
17 from traitlets.config.application import boolean_flag
18 from IPython.config.configurable import Configurable
18 from traitlets.config.configurable import Configurable
19 from IPython.config.loader import Config
19 from traitlets.config.loader import Config
20 from IPython.core import pylabtools
20 from IPython.core import pylabtools
21 from IPython.utils import py3compat
21 from IPython.utils import py3compat
22 from IPython.utils.contexts import preserve_keys
22 from IPython.utils.contexts import preserve_keys
23 from IPython.utils.path import filefind
23 from IPython.utils.path import filefind
24 from IPython.utils.traitlets import (
24 from traitlets import (
25 Unicode, Instance, List, Bool, CaselessStrEnum
25 Unicode, Instance, List, Bool, CaselessStrEnum
26 )
26 )
27 from IPython.lib.inputhook import guis
27 from IPython.lib.inputhook import guis
@@ -12,7 +12,7 from contextlib import contextmanager
12
12
13 import nose.tools as nt
13 import nose.tools as nt
14
14
15 from IPython.config.loader import Config
15 from traitlets.config.loader import Config
16 from IPython.core import completer
16 from IPython.core import completer
17 from IPython.external.decorators import knownfailureif
17 from IPython.external.decorators import knownfailureif
18 from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory
18 from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory
@@ -9,7 +9,7 import nose.tools as nt
9
9
10 from IPython.core import display
10 from IPython.core import display
11 from IPython.core.getipython import get_ipython
11 from IPython.core.getipython import get_ipython
12 from IPython.utils import path as ipath
12 from IPython import paths as ipath
13
13
14 import IPython.testing.decorators as dec
14 import IPython.testing.decorators as dec
15
15
@@ -60,7 +60,7 def test_image_filename_defaults():
60 nt.assert_is_none(img._repr_jpeg_())
60 nt.assert_is_none(img._repr_jpeg_())
61
61
62 def _get_inline_config():
62 def _get_inline_config():
63 from IPython.kernel.zmq.pylab.config import InlineBackend
63 from ipython_kernel.pylab.config import InlineBackend
64 return InlineBackend.instance()
64 return InlineBackend.instance()
65
65
66 @dec.skip_without('matplotlib')
66 @dec.skip_without('matplotlib')
@@ -10,7 +10,7 except:
10 import nose.tools as nt
10 import nose.tools as nt
11
11
12 from IPython import get_ipython
12 from IPython import get_ipython
13 from IPython.config import Config
13 from traitlets.config import Config
14 from IPython.core.formatters import (
14 from IPython.core.formatters import (
15 PlainTextFormatter, HTMLFormatter, PDFFormatter, _mod_name_key,
15 PlainTextFormatter, HTMLFormatter, PDFFormatter, _mod_name_key,
16 DisplayFormatter, JSONFormatter,
16 DisplayFormatter, JSONFormatter,
@@ -16,7 +16,7 from datetime import datetime
16 import nose.tools as nt
16 import nose.tools as nt
17
17
18 # our own packages
18 # our own packages
19 from IPython.config.loader import Config
19 from traitlets.config.loader import Config
20 from IPython.utils.tempdir import TemporaryDirectory
20 from IPython.utils.tempdir import TemporaryDirectory
21 from IPython.core.history import HistoryManager, extract_hist_ranges
21 from IPython.core.history import HistoryManager, extract_hist_ranges
22 from IPython.utils import py3compat
22 from IPython.utils import py3compat
@@ -607,8 +607,8 class TestModules(unittest.TestCase, tt.TempFileMixin):
607 """
607 """
608 self.mktmp("import sys\n"
608 self.mktmp("import sys\n"
609 "print('numpy' in sys.modules)\n"
609 "print('numpy' in sys.modules)\n"
610 "print('IPython.parallel' in sys.modules)\n"
610 "print('ipython_parallel' in sys.modules)\n"
611 "print('IPython.kernel.zmq' in sys.modules)\n"
611 "print('ipython_kernel' in sys.modules)\n"
612 )
612 )
613 out = "False\nFalse\nFalse\n"
613 out = "False\nFalse\nFalse\n"
614 tt.ipexec_validate(self.fname, out)
614 tt.ipexec_validate(self.fname, out)
@@ -28,7 +28,7 import inspect, os, sys, textwrap
28 # Our own
28 # Our own
29 from IPython.core.error import UsageError
29 from IPython.core.error import UsageError
30 from IPython.core.magic import Magics, magics_class, line_magic
30 from IPython.core.magic import Magics, magics_class, line_magic
31 from IPython.utils.traitlets import Bool
31 from traitlets import Bool
32 from IPython.utils.py3compat import string_types
32 from IPython.utils.py3compat import string_types
33
33
34 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
@@ -1,6 +1,6
1 import tempfile, os
1 import tempfile, os
2
2
3 from IPython.config.loader import Config
3 from traitlets.config.loader import Config
4 import nose.tools as nt
4 import nose.tools as nt
5
5
6 ip = get_ipython()
6 ip = get_ipython()
@@ -60,7 +60,7 import sys
60 import tarfile
60 import tarfile
61 import zipfile
61 import zipfile
62
62
63 from IPython.utils.path import get_ipython_dir
63 from IPython.paths import get_ipython_dir
64
64
65 try:
65 try:
66 from urllib.request import urlopen # Py 3
66 from urllib.request import urlopen # Py 3
@@ -8,5 +8,5 warnings.warn("IPython.lib.kernel moved to IPython.kernel.connect in IPython 1.0
8 DeprecationWarning
8 DeprecationWarning
9 )
9 )
10
10
11 from IPython.kernel.connect import *
11 from ipython_kernel.connect import *
12
12
@@ -12,9 +12,9 import shutil
12 import subprocess
12 import subprocess
13
13
14 from IPython.utils.process import find_cmd, FindCmdError
14 from IPython.utils.process import find_cmd, FindCmdError
15 from IPython.config import get_config
15 from traitlets.config import get_config
16 from IPython.config.configurable import SingletonConfigurable
16 from traitlets.config.configurable import SingletonConfigurable
17 from IPython.utils.traitlets import List, Bool, Unicode
17 from traitlets import List, Bool, Unicode
18 from IPython.utils.py3compat import cast_unicode, cast_unicode_py2 as u
18 from IPython.utils.py3compat import cast_unicode, cast_unicode_py2 as u
19
19
20
20
@@ -18,7 +18,7 from IPython.core.interactiveshell import InteractiveShell
18 from IPython.terminal.interactiveshell import TerminalInteractiveShell
18 from IPython.terminal.interactiveshell import TerminalInteractiveShell
19 from IPython.terminal.ipapp import load_default_config
19 from IPython.terminal.ipapp import load_default_config
20
20
21 from IPython.utils.traitlets import Bool, CBool, Unicode
21 from traitlets import Bool, CBool, Unicode
22 from IPython.utils.io import ask_yes_no
22 from IPython.utils.io import ask_yes_no
23
23
24
24
@@ -31,7 +31,7 from IPython.utils.terminal import toggle_set_term_title, set_term_title
31 from IPython.utils.process import abbrev_cwd
31 from IPython.utils.process import abbrev_cwd
32 from IPython.utils.warn import warn, error
32 from IPython.utils.warn import warn, error
33 from IPython.utils.text import num_ini_spaces, SList, strip_email_quotes
33 from IPython.utils.text import num_ini_spaces, SList, strip_email_quotes
34 from IPython.utils.traitlets import Integer, CBool, Unicode
34 from traitlets import Integer, CBool, Unicode
35
35
36 #-----------------------------------------------------------------------------
36 #-----------------------------------------------------------------------------
37 # Utilities
37 # Utilities
@@ -15,8 +15,8 import logging
15 import os
15 import os
16 import sys
16 import sys
17
17
18 from IPython.config.loader import Config
18 from traitlets.config.loader import Config
19 from IPython.config.application import boolean_flag, catch_config_error, Application
19 from traitlets.config.application import boolean_flag, catch_config_error, Application
20 from IPython.core import release
20 from IPython.core import release
21 from IPython.core import usage