##// END OF EJS Templates
update dependency imports...
Min RK -
Show More
@@ -42,7 +42,6 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b" 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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 b''
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 b' 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 b' 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 b' 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 b' 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 b' 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 b' 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
21 from IPython.core import usage
22 from IPython.core.completer import IPCompleter
22 from IPython.core.completer import IPCompleter
@@ -34,8 +34,8 b' from IPython.core.shellapp import ('
34 from IPython.extensions.storemagic import StoreMagics
34 from IPython.extensions.storemagic import StoreMagics
35 from IPython.terminal.interactiveshell import TerminalInteractiveShell
35 from IPython.terminal.interactiveshell import TerminalInteractiveShell
36 from IPython.utils import warn
36 from IPython.utils import warn
37 from IPython.utils.path import get_ipython_dir
37 from IPython.paths import get_ipython_dir
38 from IPython.utils.traitlets import (
38 from traitlets import (
39 Bool, List, Dict,
39 Bool, List, Dict,
40 )
40 )
41
41
@@ -207,20 +207,20 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
207 ]
207 ]
208
208
209 subcommands = dict(
209 subcommands = dict(
210 qtconsole=('IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp',
210 qtconsole=('jupyter_qtconsole.console.qtconsoleapp.IPythonQtConsoleApp',
211 """Launch the IPython Qt Console."""
211 """DEPRECATD: Launch the Jupyter Qt Console."""
212 ),
212 ),
213 notebook=('IPython.html.notebookapp.NotebookApp',
213 notebook=('jupyter_notebook.notebookapp.NotebookApp',
214 """Launch the IPython HTML Notebook Server."""
214 """DEPRECATED: Launch the IPython HTML Notebook Server."""
215 ),
215 ),
216 profile = ("IPython.core.profileapp.ProfileApp",
216 profile = ("IPython.core.profileapp.ProfileApp",
217 "Create and manage IPython profiles."
217 "Create and manage IPython profiles."
218 ),
218 ),
219 kernel = ("IPython.kernel.zmq.kernelapp.IPKernelApp",
219 kernel = ("ipython_kernel.kernelapp.IPKernelApp",
220 "Start a kernel without an attached frontend."
220 "Start a kernel without an attached frontend."
221 ),
221 ),
222 console=('IPython.terminal.console.app.ZMQTerminalIPythonApp',
222 console=('jupyter_console.app.ZMQTerminalIPythonApp',
223 """Launch the IPython terminal-based Console."""
223 """DEPRECATED: Launch the Jupyter terminal-based Console."""
224 ),
224 ),
225 locate=('IPython.terminal.ipapp.LocateIPythonApp',
225 locate=('IPython.terminal.ipapp.LocateIPythonApp',
226 LocateIPythonApp.description
226 LocateIPythonApp.description
@@ -228,19 +228,19 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):'
228 history=('IPython.core.historyapp.HistoryApp',
228 history=('IPython.core.historyapp.HistoryApp',
229 "Manage the IPython history database."
229 "Manage the IPython history database."
230 ),
230 ),
231 nbconvert=('IPython.nbconvert.nbconvertapp.NbConvertApp',
231 nbconvert=('jupyter_nbconvert.nbconvertapp.NbConvertApp',
232 "Convert notebooks to/from other formats."
232 "DEPRECATED: Convert notebooks to/from other formats."
233 ),
233 ),
234 trust=('IPython.nbformat.sign.TrustNotebookApp',
234 trust=('jupyter_nbformat.sign.TrustNotebookApp',
235 "Sign notebooks to trust their potentially unsafe contents at load."
235 "DEPRECATED: Sign notebooks to trust their potentially unsafe contents at load."
236 ),
236 ),
237 kernelspec=('IPython.kernel.kernelspecapp.KernelSpecApp',
237 kernelspec=('jupyter_client.kernelspecapp.KernelSpecApp',
238 "Manage IPython kernel specifications."
238 "DEPRECATED: Manage Jupyter kernel specifications."
239 ),
239 ),
240 )
240 )
241 subcommands['install-nbextension'] = (
241 subcommands['install-nbextension'] = (
242 "IPython.html.nbextensions.NBExtensionApp",
242 "jupyter_notebook.nbextensions.NBExtensionApp",
243 "Install IPython notebook extension files"
243 "DEPRECATED: Install Jupyter notebook extension files"
244 )
244 )
245
245
246 # *do* autocreate requested profile, but don't create the config file.
246 # *do* autocreate requested profile, but don't create the config file.
@@ -209,7 +209,7 b" test_group_names.append('autoreload')"
209 #-----------------------------------------------------------------------------
209 #-----------------------------------------------------------------------------
210
210
211 def check_exclusions_exist():
211 def check_exclusions_exist():
212 from IPython.utils.path import get_ipython_package_dir
212 from IPython.paths import get_ipython_package_dir
213 from IPython.utils.warn import warn
213 from IPython.utils.warn import warn
214 parent = os.path.dirname(get_ipython_package_dir())
214 parent = os.path.dirname(get_ipython_package_dir())
215 for sec in test_sections:
215 for sec in test_sections:
@@ -165,16 +165,6 b' class PyTestController(TestController):'
165 ipydir = TemporaryDirectory()
165 ipydir = TemporaryDirectory()
166 self.dirs.append(ipydir)
166 self.dirs.append(ipydir)
167 self.env['IPYTHONDIR'] = ipydir.name
167 self.env['IPYTHONDIR'] = ipydir.name
168 # FIXME: install IPython kernel in temporary IPython dir
169 # remove after big split
170 try:
171 from jupyter_client.kernelspec import KernelSpecManager
172 except ImportError:
173 pass
174 else:
175 ksm = KernelSpecManager(ipython_dir=ipydir.name)
176 ksm.install_native_kernel_spec(user=True)
177
178 self.workingdir = workingdir = TemporaryDirectory()
168 self.workingdir = workingdir = TemporaryDirectory()
179 self.dirs.append(workingdir)
169 self.dirs.append(workingdir)
180 self.env['IPTEST_WORKING_DIR'] = workingdir.name
170 self.env['IPTEST_WORKING_DIR'] = workingdir.name
@@ -36,7 +36,7 b' try:'
36 except ImportError:
36 except ImportError:
37 has_nose = False
37 has_nose = False
38
38
39 from IPython.config.loader import Config
39 from traitlets.config.loader import Config
40 from IPython.utils.process import get_output_error_code
40 from IPython.utils.process import get_output_error_code
41 from IPython.utils.text import list_strings
41 from IPython.utils.text import list_strings
42 from IPython.utils.io import temp_pyfile, Tee
42 from IPython.utils.io import temp_pyfile, Tee
@@ -213,9 +213,9 b" def temp_pyfile(src, ext='.py'):"
213 return fname, f
213 return fname, f
214
214
215 def atomic_writing(*args, **kwargs):
215 def atomic_writing(*args, **kwargs):
216 """DEPRECATED: moved to IPython.html.services.contents.fileio"""
216 """DEPRECATED: moved to jupyter_notebook.services.contents.fileio"""
217 warn("IPython.utils.io.atomic_writing has moved to IPython.html.services.contents.fileio")
217 warn("IPython.utils.io.atomic_writing has moved to jupyter_notebook.services.contents.fileio")
218 from IPython.html.services.contents.fileio import atomic_writing
218 from jupyter_notebook.services.contents.fileio import atomic_writing
219 return atomic_writing(*args, **kwargs)
219 return atomic_writing(*args, **kwargs)
220
220
221 def raw_print(*args, **kw):
221 def raw_print(*args, **kw):
@@ -25,6 +25,7 b' import nose.tools as nt'
25 from nose import with_setup
25 from nose import with_setup
26
26
27 import IPython
27 import IPython
28 from IPython import paths
28 from IPython.testing import decorators as dec
29 from IPython.testing import decorators as dec
29 from IPython.testing.decorators import (skip_if_not_win32, skip_win32,
30 from IPython.testing.decorators import (skip_if_not_win32, skip_win32,
30 onlyif_unicode_paths,)
31 onlyif_unicode_paths,)
@@ -253,7 +254,7 b' def test_filefind():'
253 """Various tests for filefind"""
254 """Various tests for filefind"""
254 f = tempfile.NamedTemporaryFile()
255 f = tempfile.NamedTemporaryFile()
255 # print 'fname:',f.name
256 # print 'fname:',f.name
256 alt_dirs = path.get_ipython_dir()
257 alt_dirs = paths.get_ipython_dir()
257 t = path.filefind(f.name, alt_dirs)
258 t = path.filefind(f.name, alt_dirs)
258 # print 'found:',t
259 # print 'found:',t
259
260
@@ -298,7 +299,7 b' def test_not_writable_ipdir():'
298 # assume I'm root and skip the test
299 # assume I'm root and skip the test
299 raise SkipTest("I can't create directories that I can't write to")
300 raise SkipTest("I can't create directories that I can't write to")
300 with AssertPrints('is not a writable location', channel='stderr'):
301 with AssertPrints('is not a writable location', channel='stderr'):
301 ipdir = path.get_ipython_dir()
302 ipdir = paths.get_ipython_dir()
302 env.pop('IPYTHON_DIR', None)
303 env.pop('IPYTHON_DIR', None)
303
304
304 def test_unquote_filename():
305 def test_unquote_filename():
@@ -37,7 +37,7 b' no error.'
37
37
38 To add to a collection which may have already been defined elsewhere,
38 To add to a collection which may have already been defined elsewhere,
39 you can use methods like those found on lists, dicts and sets: append,
39 you can use methods like those found on lists, dicts and sets: append,
40 extend, :meth:`~IPython.config.loader.LazyConfigValue.prepend` (like
40 extend, :meth:`~traitlets.config.loader.LazyConfigValue.prepend` (like
41 extend, but at the front), add and update (which works both for dicts
41 extend, but at the front), add and update (which works both for dicts
42 and sets)::
42 and sets)::
43
43
@@ -12,7 +12,7 b' The main concepts'
12 There are a number of abstractions that the IPython configuration system uses.
12 There are a number of abstractions that the IPython configuration system uses.
13 Each of these abstractions is represented by a Python class.
13 Each of these abstractions is represented by a Python class.
14
14
15 Configuration object: :class:`~IPython.config.loader.Config`
15 Configuration object: :class:`~traitlets.config.loader.Config`
16 A configuration object is a simple dictionary-like class that holds
16 A configuration object is a simple dictionary-like class that holds
17 configuration attributes and sub-configuration objects. These classes
17 configuration attributes and sub-configuration objects. These classes
18 support dotted attribute style access (``cfg.Foo.bar``) in addition to the
18 support dotted attribute style access (``cfg.Foo.bar``) in addition to the
@@ -20,7 +20,7 b' Configuration object: :class:`~IPython.config.loader.Config`'
20 The Config object is a wrapper around a simple dictionary with some convenience methods,
20 The Config object is a wrapper around a simple dictionary with some convenience methods,
21 such as merging and automatic section creation.
21 such as merging and automatic section creation.
22
22
23 Application: :class:`~IPython.config.application.Application`
23 Application: :class:`~traitlets.config.application.Application`
24 An application is a process that does a specific job. The most obvious
24 An application is a process that does a specific job. The most obvious
25 application is the :command:`ipython` command line program. Each
25 application is the :command:`ipython` command line program. Each
26 application reads *one or more* configuration files and a single set of
26 application reads *one or more* configuration files and a single set of
@@ -34,30 +34,30 b' Application: :class:`~IPython.config.application.Application`'
34 Applications always have a `log` attribute that is a configured Logger.
34 Applications always have a `log` attribute that is a configured Logger.
35 This allows centralized logging configuration per-application.
35 This allows centralized logging configuration per-application.
36
36
37 Configurable: :class:`~IPython.config.configurable.Configurable`
37 Configurable: :class:`~traitlets.config.configurable.Configurable`
38 A configurable is a regular Python class that serves as a base class for
38 A configurable is a regular Python class that serves as a base class for
39 all main classes in an application. The
39 all main classes in an application. The
40 :class:`~IPython.config.configurable.Configurable` base class is
40 :class:`~traitlets.config.configurable.Configurable` base class is
41 lightweight and only does one things.
41 lightweight and only does one things.
42
42
43 This :class:`~IPython.config.configurable.Configurable` is a subclass
43 This :class:`~traitlets.config.configurable.Configurable` is a subclass
44 of :class:`~IPython.utils.traitlets.HasTraits` that knows how to configure
44 of :class:`~traitlets.HasTraits` that knows how to configure
45 itself. Class level traits with the metadata ``config=True`` become
45 itself. Class level traits with the metadata ``config=True`` become
46 values that can be configured from the command line and configuration
46 values that can be configured from the command line and configuration
47 files.
47 files.
48
48
49 Developers create :class:`~IPython.config.configurable.Configurable`
49 Developers create :class:`~traitlets.config.configurable.Configurable`
50 subclasses that implement all of the logic in the application. Each of
50 subclasses that implement all of the logic in the application. Each of
51 these subclasses has its own configuration information that controls how
51 these subclasses has its own configuration information that controls how
52 instances are created.
52 instances are created.
53
53
54 Singletons: :class:`~IPython.config.configurable.SingletonConfigurable`
54 Singletons: :class:`~traitlets.config.configurable.SingletonConfigurable`
55 Any object for which there is a single canonical instance. These are
55 Any object for which there is a single canonical instance. These are
56 just like Configurables, except they have a class method
56 just like Configurables, except they have a class method
57 :meth:`~IPython.config.configurable.SingletonConfigurable.instance`,
57 :meth:`~traitlets.config.configurable.SingletonConfigurable.instance`,
58 that returns the current active instance (or creates one if it
58 that returns the current active instance (or creates one if it
59 does not exist). Examples of singletons include
59 does not exist). Examples of singletons include
60 :class:`~IPython.config.application.Application`s and
60 :class:`~traitlets.config.application.Application`s and
61 :class:`~IPython.core.interactiveshell.InteractiveShell`. This lets
61 :class:`~IPython.core.interactiveshell.InteractiveShell`. This lets
62 objects easily connect to the current running Application without passing
62 objects easily connect to the current running Application without passing
63 objects around everywhere. For instance, to get the current running
63 objects around everywhere. For instance, to get the current running
@@ -100,7 +100,7 b' Python configuration Files'
100 --------------------------
100 --------------------------
101
101
102 A Python configuration file is a pure Python file that populates a configuration object.
102 A Python configuration file is a pure Python file that populates a configuration object.
103 This configuration object is a :class:`~IPython.config.loader.Config` instance.
103 This configuration object is a :class:`~traitlets.config.loader.Config` instance.
104 While in a configuration file, to get a reference to this object, simply call the :func:`get_config`
104 While in a configuration file, to get a reference to this object, simply call the :func:`get_config`
105 function, which is available in the global namespace of the script.
105 function, which is available in the global namespace of the script.
106
106
@@ -116,13 +116,13 b' attributes on it. All you have to know is:'
116 * The type of each attribute.
116 * The type of each attribute.
117
117
118 The answers to these questions are provided by the various
118 The answers to these questions are provided by the various
119 :class:`~IPython.config.configurable.Configurable` subclasses that an
119 :class:`~traitlets.config.configurable.Configurable` subclasses that an
120 application uses. Let's look at how this would work for a simple configurable
120 application uses. Let's look at how this would work for a simple configurable
121 subclass::
121 subclass::
122
122
123 # Sample configurable:
123 # Sample configurable:
124 from IPython.config.configurable import Configurable
124 from traitlets.config.configurable import Configurable
125 from IPython.utils.traitlets import Int, Float, Unicode, Bool
125 from traitlets import Int, Float, Unicode, Bool
126
126
127 class MyClass(Configurable):
127 class MyClass(Configurable):
128 name = Unicode(u'defaultname', config=True)
128 name = Unicode(u'defaultname', config=True)
@@ -145,16 +145,16 b' to configure this class in a configuration file::'
145 After this configuration file is loaded, the values set in it will override
145 After this configuration file is loaded, the values set in it will override
146 the class defaults anytime a :class:`MyClass` is created. Furthermore,
146 the class defaults anytime a :class:`MyClass` is created. Furthermore,
147 these attributes will be type checked and validated anytime they are set.
147 these attributes will be type checked and validated anytime they are set.
148 This type checking is handled by the :mod:`IPython.utils.traitlets` module,
148 This type checking is handled by the :mod:`traitlets` module,
149 which provides the :class:`Unicode`, :class:`Int` and :class:`Float` types.
149 which provides the :class:`Unicode`, :class:`Int` and :class:`Float` types.
150 In addition to these traitlets, the :mod:`IPython.utils.traitlets` provides
150 In addition to these traitlets, the :mod:`traitlets` provides
151 traitlets for a number of other types.
151 traitlets for a number of other types.
152
152
153 .. note::
153 .. note::
154
154
155 Underneath the hood, the :class:`Configurable` base class is a subclass of
155 Underneath the hood, the :class:`Configurable` base class is a subclass of
156 :class:`IPython.utils.traitlets.HasTraits`. The
156 :class:`traitlets.HasTraits`. The
157 :mod:`IPython.utils.traitlets` module is a lightweight version of
157 :mod:`traitlets` module is a lightweight version of
158 :mod:`enthought.traits`. Our implementation is a pure Python subset
158 :mod:`enthought.traits`. Our implementation is a pure Python subset
159 (mostly API compatible) of :mod:`enthought.traits` that does not have any
159 (mostly API compatible) of :mod:`enthought.traits` that does not have any
160 of the automatic GUI generation capabilities. Our plan is to achieve 100%
160 of the automatic GUI generation capabilities. Our plan is to achieve 100%
@@ -172,17 +172,17 b' Here, ``ClassName`` is the name of the class whose configuration attribute you'
172 want to set, ``attribute_name`` is the name of the attribute you want to set
172 want to set, ``attribute_name`` is the name of the attribute you want to set
173 and ``attribute_value`` the the value you want it to have. The ``ClassName``
173 and ``attribute_value`` the the value you want it to have. The ``ClassName``
174 attribute of ``c`` is not the actual class, but instead is another
174 attribute of ``c`` is not the actual class, but instead is another
175 :class:`~IPython.config.loader.Config` instance.
175 :class:`~traitlets.config.loader.Config` instance.
176
176
177 .. note::
177 .. note::
178
178
179 The careful reader may wonder how the ``ClassName`` (``MyClass`` in
179 The careful reader may wonder how the ``ClassName`` (``MyClass`` in
180 the above example) attribute of the configuration object ``c`` gets
180 the above example) attribute of the configuration object ``c`` gets
181 created. These attributes are created on the fly by the
181 created. These attributes are created on the fly by the
182 :class:`~IPython.config.loader.Config` instance, using a simple naming
182 :class:`~traitlets.config.loader.Config` instance, using a simple naming
183 convention. Any attribute of a :class:`~IPython.config.loader.Config`
183 convention. Any attribute of a :class:`~traitlets.config.loader.Config`
184 instance whose name begins with an uppercase character is assumed to be a
184 instance whose name begins with an uppercase character is assumed to be a
185 sub-configuration and a new empty :class:`~IPython.config.loader.Config`
185 sub-configuration and a new empty :class:`~traitlets.config.loader.Config`
186 instance is dynamically created for that attribute. This allows deeply
186 instance is dynamically created for that attribute. This allows deeply
187 hierarchical information created easily (``c.Foo.Bar.value``) on the fly.
187 hierarchical information created easily (``c.Foo.Bar.value``) on the fly.
188
188
@@ -190,7 +190,7 b' JSON configuration Files'
190 ------------------------
190 ------------------------
191
191
192 A JSON configuration file is simply a file that contains a
192 A JSON configuration file is simply a file that contains a
193 :class:`~IPython.config.loader.Config` dictionary serialized to JSON.
193 :class:`~traitlets.config.loader.Config` dictionary serialized to JSON.
194 A JSON configuration file has the same base name as a Python configuration file,
194 A JSON configuration file has the same base name as a Python configuration file,
195 but with a .json extension.
195 but with a .json extension.
196
196
@@ -261,8 +261,8 b' There is another aspect of configuration where inheritance comes into play.'
261 Sometimes, your classes will have an inheritance hierarchy that you want
261 Sometimes, your classes will have an inheritance hierarchy that you want
262 to be reflected in the configuration system. Here is a simple example::
262 to be reflected in the configuration system. Here is a simple example::
263
263
264 from IPython.config.configurable import Configurable
264 from traitlets.config.configurable import Configurable
265 from IPython.utils.traitlets import Int, Float, Unicode, Bool
265 from traitlets import Int, Float, Unicode, Bool
266
266
267 class Foo(Configurable):
267 class Foo(Configurable):
268 name = Unicode(u'fooname', config=True)
268 name = Unicode(u'fooname', config=True)
@@ -438,7 +438,7 b' with a given Application. Configuring IPython from the command-line may look'
438 very similar to an IPython config file
438 very similar to an IPython config file
439
439
440 IPython applications use a parser called
440 IPython applications use a parser called
441 :class:`~IPython.config.loader.KeyValueLoader` to load values into a Config
441 :class:`~traitlets.config.loader.KeyValueLoader` to load values into a Config
442 object. Values are assigned in much the same way as in a config file:
442 object. Values are assigned in much the same way as in a config file:
443
443
444 .. code-block:: bash
444 .. code-block:: bash
@@ -184,7 +184,7 b' not work with this. Instead, we do this::'
184 ...
184 ...
185
185
186 This gives the new class a metaclass of :class:`~IPython.qt.util.MetaQObjectHasTraits`,
186 This gives the new class a metaclass of :class:`~IPython.qt.util.MetaQObjectHasTraits`,
187 and the parent classes :class:`~IPython.utils.traitlets.HasTraits` and
187 and the parent classes :class:`~traitlets.HasTraits` and
188 :class:`~IPython.qt.util.SuperQObject`.
188 :class:`~IPython.qt.util.SuperQObject`.
189
189
190
190
@@ -268,11 +268,11 b' As of this release, a signifiant portion of IPython has been refactored. This'
268 refactoring is founded on a number of new abstractions. The main new classes
268 refactoring is founded on a number of new abstractions. The main new classes
269 that implement these abstractions are:
269 that implement these abstractions are:
270
270
271 * :class:`IPython.utils.traitlets.HasTraits`.
271 * :class:`traitlets.HasTraits`.
272 * :class:`IPython.config.configurable.Configurable`.
272 * :class:`traitlets.config.configurable.Configurable`.
273 * :class:`IPython.config.application.Application`.
273 * :class:`traitlets.config.application.Application`.
274 * :class:`IPython.config.loader.ConfigLoader`.
274 * :class:`traitlets.config.loader.ConfigLoader`.
275 * :class:`IPython.config.loader.Config`
275 * :class:`traitlets.config.loader.Config`
276
276
277 We are still in the process of writing developer focused documentation about
277 We are still in the process of writing developer focused documentation about
278 these classes, but for now our :ref:`configuration documentation
278 these classes, but for now our :ref:`configuration documentation
@@ -383,7 +383,7 b' Additional new features'
383
383
384 .. sourcecode:: python
384 .. sourcecode:: python
385
385
386 from IPython.config.application import Application
386 from traitlets.config.application import Application
387 logger = Application.instance().log
387 logger = Application.instance().log
388
388
389 * You can now get help on an object halfway through typing a command. For
389 * You can now get help on an object halfway through typing a command. For
@@ -403,7 +403,7 b' Additional new features'
403 configuration system :ref:`documentation <config_index>` for more details.
403 configuration system :ref:`documentation <config_index>` for more details.
404
404
405 * The :class:`~IPython.core.interactiveshell.InteractiveShell` class is now a
405 * The :class:`~IPython.core.interactiveshell.InteractiveShell` class is now a
406 :class:`~IPython.config.configurable.Configurable` subclass and has traitlets
406 :class:`~traitlets.config.configurable.Configurable` subclass and has traitlets
407 that determine the defaults and runtime environment. The ``__init__`` method
407 that determine the defaults and runtime environment. The ``__init__`` method
408 has also been refactored so this class can be instantiated and run without
408 has also been refactored so this class can be instantiated and run without
409 the old :mod:`ipmaker` module.
409 the old :mod:`ipmaker` module.
@@ -426,7 +426,7 b' Additional new features'
426 strings like ``foo.bar.Bar`` to the actual class.
426 strings like ``foo.bar.Bar`` to the actual class.
427
427
428 * Completely refactored the :mod:`IPython.core.prefilter` module into
428 * Completely refactored the :mod:`IPython.core.prefilter` module into
429 :class:`~IPython.config.configurable.Configurable` subclasses. Added a new
429 :class:`~traitlets.config.configurable.Configurable` subclasses. Added a new
430 layer into the prefilter system, called "transformations" that all new
430 layer into the prefilter system, called "transformations" that all new
431 prefilter logic should use (rather than the older "checker/handler"
431 prefilter logic should use (rather than the older "checker/handler"
432 approach).
432 approach).
@@ -439,22 +439,22 b' Additional new features'
439 instance and call it. In later calls, it just calls the previously created
439 instance and call it. In later calls, it just calls the previously created
440 :class:`~IPython.frontend.terminal.embed.InteractiveShellEmbed`.
440 :class:`~IPython.frontend.terminal.embed.InteractiveShellEmbed`.
441
441
442 * Created a configuration system (:mod:`IPython.config.configurable`) that is
442 * Created a configuration system (:mod:`traitlets.config.configurable`) that is
443 based on :mod:`IPython.utils.traitlets`. Configurables are arranged into a
443 based on :mod:`traitlets`. Configurables are arranged into a
444 runtime containment tree (not inheritance) that i) automatically propagates
444 runtime containment tree (not inheritance) that i) automatically propagates
445 configuration information and ii) allows singletons to discover each other in
445 configuration information and ii) allows singletons to discover each other in
446 a loosely coupled manner. In the future all parts of IPython will be
446 a loosely coupled manner. In the future all parts of IPython will be
447 subclasses of :class:`~IPython.config.configurable.Configurable`. All IPython
447 subclasses of :class:`~traitlets.config.configurable.Configurable`. All IPython
448 developers should become familiar with the config system.
448 developers should become familiar with the config system.
449
449
450 * Created a new :class:`~IPython.config.loader.Config` for holding
450 * Created a new :class:`~traitlets.config.loader.Config` for holding
451 configuration information. This is a dict like class with a few extras: i)
451 configuration information. This is a dict like class with a few extras: i)
452 it supports attribute style access, ii) it has a merge function that merges
452 it supports attribute style access, ii) it has a merge function that merges
453 two :class:`~IPython.config.loader.Config` instances recursively and iii) it
453 two :class:`~traitlets.config.loader.Config` instances recursively and iii) it
454 will automatically create sub-:class:`~IPython.config.loader.Config`
454 will automatically create sub-:class:`~traitlets.config.loader.Config`
455 instances for attributes that start with an uppercase character.
455 instances for attributes that start with an uppercase character.
456
456
457 * Created new configuration loaders in :mod:`IPython.config.loader`. These
457 * Created new configuration loaders in :mod:`traitlets.config.loader`. These
458 loaders provide a unified loading interface for all configuration
458 loaders provide a unified loading interface for all configuration
459 information including command line arguments and configuration files. We
459 information including command line arguments and configuration files. We
460 have two default implementations based on :mod:`argparse` and plain python
460 have two default implementations based on :mod:`argparse` and plain python
@@ -474,12 +474,12 b' Additional new features'
474 as strings, like ``foo.bar.Bar``. This is needed for forward declarations.
474 as strings, like ``foo.bar.Bar``. This is needed for forward declarations.
475 But, this was implemented in a careful way so that string to class
475 But, this was implemented in a careful way so that string to class
476 resolution is done at a single point, when the parent
476 resolution is done at a single point, when the parent
477 :class:`~IPython.utils.traitlets.HasTraitlets` is instantiated.
477 :class:`~traitlets.HasTraitlets` is instantiated.
478
478
479 * :mod:`IPython.utils.ipstruct` has been refactored to be a subclass of
479 * :mod:`IPython.utils.ipstruct` has been refactored to be a subclass of
480 dict. It also now has full docstrings and doctests.
480 dict. It also now has full docstrings and doctests.
481
481
482 * Created a Traits like implementation in :mod:`IPython.utils.traitlets`. This
482 * Created a Traits like implementation in :mod:`traitlets`. This
483 is a pure Python, lightweight version of a library that is similar to
483 is a pure Python, lightweight version of a library that is similar to
484 Enthought's Traits project, but has no dependencies on Enthought's code. We
484 Enthought's Traits project, but has no dependencies on Enthought's code. We
485 are using this for validation, defaults and notification in our new component
485 are using this for validation, defaults and notification in our new component
@@ -511,7 +511,7 b' Backwards incompatible changes'
511 ``ipython profile create <name>``.
511 ``ipython profile create <name>``.
512
512
513 * All IPython applications have been rewritten to use
513 * All IPython applications have been rewritten to use
514 :class:`~IPython.config.loader.KeyValueConfigLoader`. This means that
514 :class:`~traitlets.config.loader.KeyValueConfigLoader`. This means that
515 command-line options have changed. Now, all configurable values are accessible
515 command-line options have changed. Now, all configurable values are accessible
516 from the command-line with the same syntax as in a configuration file.
516 from the command-line with the same syntax as in a configuration file.
517
517
@@ -517,7 +517,7 b' Official Public API'
517 We have begun organizing our API for easier public use, with an eye towards an
517 We have begun organizing our API for easier public use, with an eye towards an
518 official IPython 1.0 release which will firmly maintain this API compatible for
518 official IPython 1.0 release which will firmly maintain this API compatible for
519 its entire lifecycle. There is now an :mod:`IPython.display` module that
519 its entire lifecycle. There is now an :mod:`IPython.display` module that
520 aggregates all display routines, and the :mod:`IPython.config` namespace has
520 aggregates all display routines, and the :mod:`traitlets.config` namespace has
521 all public configuration tools. We will continue improving our public API
521 all public configuration tools. We will continue improving our public API
522 layout so that users only need to import names one level deeper than the main
522 layout so that users only need to import names one level deeper than the main
523 ``IPython`` package to access all public namespaces.
523 ``IPython`` package to access all public namespaces.
@@ -78,7 +78,7 b' New features'
78
78
79 * All of the parallel computing capabilities from `ipython1-dev` have been
79 * All of the parallel computing capabilities from `ipython1-dev` have been
80 merged into IPython proper. This resulted in the following new subpackages:
80 merged into IPython proper. This resulted in the following new subpackages:
81 :mod:`IPython.kernel`, :mod:`IPython.kernel.core`, :mod:`IPython.config`,
81 :mod:`IPython.kernel`, :mod:`IPython.kernel.core`, :mod:`traitlets.config`,
82 :mod:`IPython.tools` and :mod:`IPython.testing`.
82 :mod:`IPython.tools` and :mod:`IPython.testing`.
83
83
84 * As part of merging in the `ipython1-dev` stuff, the `setup.py` script and
84 * As part of merging in the `ipython1-dev` stuff, the `setup.py` script and
@@ -17,7 +17,7 b' from __future__ import print_function'
17
17
18 # Try running this code both at the command line and from inside IPython (with
18 # Try running this code both at the command line and from inside IPython (with
19 # %run example-embed.py)
19 # %run example-embed.py)
20 from IPython.config.loader import Config
20 from traitlets.config.loader import Config
21 try:
21 try:
22 get_ipython
22 get_ipython
23 except NameError:
23 except NameError:
@@ -110,7 +110,7 b''
110 "outputs": [],
110 "outputs": [],
111 "source": [
111 "source": [
112 "from IPython.html import widgets\n",
112 "from IPython.html import widgets\n",
113 "from IPython.utils.traitlets import Unicode\n",
113 "from traitlets import Unicode\n",
114 "\n",
114 "\n",
115 "class HelloWidget(widgets.DOMWidget):\n",
115 "class HelloWidget(widgets.DOMWidget):\n",
116 " _view_name = Unicode('HelloView', sync=True)"
116 " _view_name = Unicode('HelloView', sync=True)"
@@ -570,7 +570,7 b''
570 },
570 },
571 "outputs": [],
571 "outputs": [],
572 "source": [
572 "source": [
573 "from IPython.utils.traitlets import CInt\n",
573 "from traitlets import CInt\n",
574 "class SpinnerWidget(widgets.DOMWidget):\n",
574 "class SpinnerWidget(widgets.DOMWidget):\n",
575 " _view_name = Unicode('SpinnerView', sync=True)\n",
575 " _view_name = Unicode('SpinnerView', sync=True)\n",
576 " value = CInt(0, sync=True)"
576 " value = CInt(0, sync=True)"
@@ -757,7 +757,7 b''
757 "w2 = widgets.IntSlider()\n",
757 "w2 = widgets.IntSlider()\n",
758 "display(w1,w2)\n",
758 "display(w1,w2)\n",
759 "\n",
759 "\n",
760 "from IPython.utils.traitlets import link\n",
760 "from traitlets import link\n",
761 "mylink = link((w1, 'value'), (w2, 'value'))"
761 "mylink = link((w1, 'value'), (w2, 'value'))"
762 ]
762 ]
763 },
763 },
@@ -24,7 +24,7 b''
24 "\n",
24 "\n",
25 "from IPython.html import widgets # Widget definitions\n",
25 "from IPython.html import widgets # Widget definitions\n",
26 "from IPython.display import display # Used to display widgets in the notebook\n",
26 "from IPython.display import display # Used to display widgets in the notebook\n",
27 "from IPython.utils.traitlets import Unicode # Used to declare attributes of our widget"
27 "from traitlets import Unicode # Used to declare attributes of our widget"
28 ]
28 ]
29 },
29 },
30 {
30 {
@@ -11567,7 +11567,7 b' div#notebook {'
11567 <div class=" highlight hl-ipython3"><pre><span class="c"># Widget related imports</span>
11567 <div class=" highlight hl-ipython3"><pre><span class="c"># Widget related imports</span>
11568 <span class="kn">from</span> <span class="nn">IPython.html</span> <span class="k">import</span> <span class="n">widgets</span>
11568 <span class="kn">from</span> <span class="nn">IPython.html</span> <span class="k">import</span> <span class="n">widgets</span>
11569 <span class="kn">from</span> <span class="nn">IPython.display</span> <span class="k">import</span> <span class="n">display</span><span class="p">,</span> <span class="n">clear_output</span><span class="p">,</span> <span class="n">Javascript</span>
11569 <span class="kn">from</span> <span class="nn">IPython.display</span> <span class="k">import</span> <span class="n">display</span><span class="p">,</span> <span class="n">clear_output</span><span class="p">,</span> <span class="n">Javascript</span>
11570 <span class="kn">from</span> <span class="nn">IPython.utils.traitlets</span> <span class="k">import</span> <span class="n">Unicode</span>
11570 <span class="kn">from</span> <span class="nn">traitlets</span> <span class="k">import</span> <span class="n">Unicode</span>
11571
11571
11572 <span class="c"># nbconvert related imports</span>
11572 <span class="c"># nbconvert related imports</span>
11573 <span class="kn">from</span> <span class="nn">IPython.nbconvert</span> <span class="k">import</span> <span class="n">get_export_names</span><span class="p">,</span> <span class="n">export_by_name</span>
11573 <span class="kn">from</span> <span class="nn">IPython.nbconvert</span> <span class="k">import</span> <span class="n">get_export_names</span><span class="p">,</span> <span class="n">export_by_name</span>
@@ -11,7 +11,7 b''
11 "# Widget related imports\n",
11 "# Widget related imports\n",
12 "from IPython.html import widgets\n",
12 "from IPython.html import widgets\n",
13 "from IPython.display import display, clear_output, Javascript\n",
13 "from IPython.display import display, clear_output, Javascript\n",
14 "from IPython.utils.traitlets import Unicode\n",
14 "from traitlets import Unicode\n",
15 "\n",
15 "\n",
16 "# nbconvert related imports\n",
16 "# nbconvert related imports\n",
17 "from IPython.nbconvert import get_export_names, export_by_name\n",
17 "from IPython.nbconvert import get_export_names, export_by_name\n",
@@ -11,7 +11,7 b''
11 "import base64\n",
11 "import base64\n",
12 "from __future__ import print_function # py 2.7 compat.\n",
12 "from __future__ import print_function # py 2.7 compat.\n",
13 "from IPython.html import widgets # Widget definitions.\n",
13 "from IPython.html import widgets # Widget definitions.\n",
14 "from IPython.utils.traitlets import Unicode # Traitlet needed to add synced attributes to the widget."
14 "from traitlets import Unicode # Traitlet needed to add synced attributes to the widget."
15 ]
15 ]
16 },
16 },
17 {
17 {
@@ -374,7 +374,7 b''
374 },
374 },
375 "outputs": [],
375 "outputs": [],
376 "source": [
376 "source": [
377 "from IPython.utils.traitlets import link\n",
377 "from traitlets import link\n",
378 "a = FloatText()\n",
378 "a = FloatText()\n",
379 "b = FloatSlider()\n",
379 "b = FloatSlider()\n",
380 "c = FloatProgress()\n",
380 "c = FloatProgress()\n",
@@ -297,8 +297,8 b''
297 "I like my cython to be nicely highlighted\n",
297 "I like my cython to be nicely highlighted\n",
298 "\n",
298 "\n",
299 "```javascript\n",
299 "```javascript\n",
300 "IPython.config.cell_magic_highlight['magic_text/x-cython'] = {}\n",
300 "traitlets.config.cell_magic_highlight['magic_text/x-cython'] = {}\n",
301 "IPython.config.cell_magic_highlight['magic_text/x-cython'].reg = [/^%%cython/]\n",
301 "traitlets.config.cell_magic_highlight['magic_text/x-cython'].reg = [/^%%cython/]\n",
302 "```\n",
302 "```\n",
303 "\n",
303 "\n",
304 "`text/x-cython` is the name of CodeMirror mode name, `magic_` prefix will just patch the mode so that the first line that contains a magic does not screw up the highlighting. `reg`is a list or regular expression that will trigger the change of mode."
304 "`text/x-cython` is the name of CodeMirror mode name, `magic_` prefix will just patch the mode so that the first line that contains a magic does not screw up the highlighting. `reg`is a list or regular expression that will trigger the change of mode."
@@ -114,7 +114,7 b''
114 },
114 },
115 "outputs": [],
115 "outputs": [],
116 "source": [
116 "source": [
117 "from IPython.config import Config\n",
117 "from traitlets.config import Config\n",
118 "from IPython.nbconvert import HTMLExporter\n",
118 "from IPython.nbconvert import HTMLExporter\n",
119 "\n",
119 "\n",
120 "# The `basic` template is used here.\n",
120 "# The `basic` template is used here.\n",
@@ -359,7 +359,7 b''
359 },
359 },
360 "outputs": [],
360 "outputs": [],
361 "source": [
361 "source": [
362 "from IPython.config import Config\n",
362 "from traitlets.config import Config\n",
363 "\n",
363 "\n",
364 "c = Config({\n",
364 "c = Config({\n",
365 " 'ExtractOutputPreprocessor':{'enabled':True}\n",
365 " 'ExtractOutputPreprocessor':{'enabled':True}\n",
@@ -409,7 +409,7 b''
409 "outputs": [],
409 "outputs": [],
410 "source": [
410 "source": [
411 "from IPython.nbconvert.preprocessors import Preprocessor\n",
411 "from IPython.nbconvert.preprocessors import Preprocessor\n",
412 "import IPython.config\n",
412 "import traitlets.config\n",
413 "print(\"Four relevant docstring\")\n",
413 "print(\"Four relevant docstring\")\n",
414 "print('=============================')\n",
414 "print('=============================')\n",
415 "print(Preprocessor.__doc__)\n",
415 "print(Preprocessor.__doc__)\n",
@@ -444,7 +444,7 b''
444 },
444 },
445 "outputs": [],
445 "outputs": [],
446 "source": [
446 "source": [
447 "from IPython.utils.traitlets import Integer"
447 "from traitlets import Integer"
448 ]
448 ]
449 },
449 },
450 {
450 {
General Comments 0
You need to be logged in to leave comments. Login now