##// END OF EJS Templates
move core.ipapi -> core.getipython
MinRK -
Show More
@@ -1,86 +1,86 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 IPython: tools for interactive and parallel computing in Python.
3 IPython: tools for interactive and parallel computing in Python.
4
4
5 http://ipython.org
5 http://ipython.org
6 """
6 """
7 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
8 # Copyright (c) 2008-2011, IPython Development Team.
8 # Copyright (c) 2008-2011, IPython Development Team.
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
9 # Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
10 # Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
11 # Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
12 #
12 #
13 # Distributed under the terms of the Modified BSD License.
13 # Distributed under the terms of the Modified BSD License.
14 #
14 #
15 # The full license is in the file COPYING.txt, distributed with this software.
15 # The full license is in the file COPYING.txt, distributed with this software.
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Imports
19 # Imports
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21 from __future__ import absolute_import
21 from __future__ import absolute_import
22
22
23 import os
23 import os
24 import sys
24 import sys
25
25
26 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
27 # Setup everything
27 # Setup everything
28 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29
29
30 # Don't forget to also update setup.py when this changes!
30 # Don't forget to also update setup.py when this changes!
31 if sys.version[0:3] < '2.6':
31 if sys.version[0:3] < '2.6':
32 raise ImportError('Python Version 2.6 or above is required for IPython.')
32 raise ImportError('Python Version 2.6 or above is required for IPython.')
33
33
34 # Make it easy to import extensions - they are always directly on pythonpath.
34 # Make it easy to import extensions - they are always directly on pythonpath.
35 # Therefore, non-IPython modules can be added to extensions directory.
35 # Therefore, non-IPython modules can be added to extensions directory.
36 # This should probably be in ipapp.py.
36 # This should probably be in ipapp.py.
37 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
37 sys.path.append(os.path.join(os.path.dirname(__file__), "extensions"))
38
38
39 #-----------------------------------------------------------------------------
39 #-----------------------------------------------------------------------------
40 # Setup the top level names
40 # Setup the top level names
41 #-----------------------------------------------------------------------------
41 #-----------------------------------------------------------------------------
42
42
43 from .config.loader import Config
43 from .config.loader import Config
44 from .core.ipapi import get_ipython
44 from .core.getipython import get_ipython
45 from .core import release
45 from .core import release
46 from .core.application import Application
46 from .core.application import Application
47 from .frontend.terminal.embed import embed
47 from .frontend.terminal.embed import embed
48
48
49 from .core.error import TryNext
49 from .core.error import TryNext
50 from .core.interactiveshell import InteractiveShell
50 from .core.interactiveshell import InteractiveShell
51 from .testing import test
51 from .testing import test
52 from .utils.sysinfo import sys_info
52 from .utils.sysinfo import sys_info
53 from .utils.frame import extract_module_locals
53 from .utils.frame import extract_module_locals
54
54
55 # Release data
55 # Release data
56 __author__ = '%s <%s>' % (release.author, release.author_email)
56 __author__ = '%s <%s>' % (release.author, release.author_email)
57 __license__ = release.license
57 __license__ = release.license
58 __version__ = release.version
58 __version__ = release.version
59 version_info = release.version_info
59 version_info = release.version_info
60
60
61 def embed_kernel(module=None, local_ns=None, **kwargs):
61 def embed_kernel(module=None, local_ns=None, **kwargs):
62 """Embed and start an IPython kernel in a given scope.
62 """Embed and start an IPython kernel in a given scope.
63
63
64 Parameters
64 Parameters
65 ----------
65 ----------
66 module : ModuleType, optional
66 module : ModuleType, optional
67 The module to load into IPython globals (default: caller)
67 The module to load into IPython globals (default: caller)
68 local_ns : dict, optional
68 local_ns : dict, optional
69 The namespace to load into IPython user namespace (default: caller)
69 The namespace to load into IPython user namespace (default: caller)
70
70
71 kwargs : various, optional
71 kwargs : various, optional
72 Further keyword args are relayed to the IPKernelApp constructor,
72 Further keyword args are relayed to the IPKernelApp constructor,
73 allowing configuration of the Kernel. Will only have an effect
73 allowing configuration of the Kernel. Will only have an effect
74 on the first embed_kernel call for a given process.
74 on the first embed_kernel call for a given process.
75
75
76 """
76 """
77
77
78 (caller_module, caller_locals) = extract_module_locals(1)
78 (caller_module, caller_locals) = extract_module_locals(1)
79 if module is None:
79 if module is None:
80 module = caller_module
80 module = caller_module
81 if local_ns is None:
81 if local_ns is None:
82 local_ns = caller_locals
82 local_ns = caller_locals
83
83
84 # Only import .zmq when we really need it
84 # Only import .zmq when we really need it
85 from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel
85 from IPython.kernel.zmq.embed import embed_kernel as real_embed_kernel
86 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
86 real_embed_kernel(module=module, local_ns=local_ns, **kwargs)
1 NO CONTENT: file renamed from IPython/core/ipapi.py to IPython/core/getipython.py
NO CONTENT: file renamed from IPython/core/ipapi.py to IPython/core/getipython.py
@@ -1,58 +1,58 b''
1 # encoding: utf-8
1 # encoding: utf-8
2
2
3 def test_import_completer():
3 def test_import_completer():
4 from IPython.core import completer
4 from IPython.core import completer
5
5
6 def test_import_crashhandler():
6 def test_import_crashhandler():
7 from IPython.core import crashhandler
7 from IPython.core import crashhandler
8
8
9 def test_import_debugger():
9 def test_import_debugger():
10 from IPython.core import debugger
10 from IPython.core import debugger
11
11
12 def test_import_fakemodule():
12 def test_import_fakemodule():
13 from IPython.core import fakemodule
13 from IPython.core import fakemodule
14
14
15 def test_import_excolors():
15 def test_import_excolors():
16 from IPython.core import excolors
16 from IPython.core import excolors
17
17
18 def test_import_history():
18 def test_import_history():
19 from IPython.core import history
19 from IPython.core import history
20
20
21 def test_import_hooks():
21 def test_import_hooks():
22 from IPython.core import hooks
22 from IPython.core import hooks
23
23
24 def test_import_ipapi():
24 def test_import_getipython():
25 from IPython.core import ipapi
25 from IPython.core import getipython
26
26
27 def test_import_interactiveshell():
27 def test_import_interactiveshell():
28 from IPython.core import interactiveshell
28 from IPython.core import interactiveshell
29
29
30 def test_import_logger():
30 def test_import_logger():
31 from IPython.core import logger
31 from IPython.core import logger
32
32
33 def test_import_macro():
33 def test_import_macro():
34 from IPython.core import macro
34 from IPython.core import macro
35
35
36 def test_import_magic():
36 def test_import_magic():
37 from IPython.core import magic
37 from IPython.core import magic
38
38
39 def test_import_oinspect():
39 def test_import_oinspect():
40 from IPython.core import oinspect
40 from IPython.core import oinspect
41
41
42 def test_import_prefilter():
42 def test_import_prefilter():
43 from IPython.core import prefilter
43 from IPython.core import prefilter
44
44
45 def test_import_prompts():
45 def test_import_prompts():
46 from IPython.core import prompts
46 from IPython.core import prompts
47
47
48 def test_import_release():
48 def test_import_release():
49 from IPython.core import release
49 from IPython.core import release
50
50
51 def test_import_shadowns():
51 def test_import_shadowns():
52 from IPython.core import shadowns
52 from IPython.core import shadowns
53
53
54 def test_import_ultratb():
54 def test_import_ultratb():
55 from IPython.core import ultratb
55 from IPython.core import ultratb
56
56
57 def test_import_usage():
57 def test_import_usage():
58 from IPython.core import usage
58 from IPython.core import usage
General Comments 0
You need to be logged in to leave comments. Login now