##// END OF EJS Templates
Added compatibility layer for Shell/ipapi/iplib....
Brian Granger -
Show More
@@ -0,0 +1,29 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 """
4 A backwards compatibility layer for IPython.Shell.
5
6 Previously, IPython had an IPython.Shell module. IPython.Shell has been moved
7 to IPython.core.shell and is being refactored. This new module is provided
8 for backwards compatability. We strongly encourage everyone to start using
9 the new code in IPython.core.shell.
10 """
11
12 #-----------------------------------------------------------------------------
13 # Copyright (C) 2008-2009 The IPython Development Team
14 #
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
17 #-----------------------------------------------------------------------------
18
19 from warnings import warn
20
21 msg = """
22 This module (IPython.Shell) has been moved to a new location
23 (IPython.core.shell) and is being refactored. Please update your code
24 to use the new IPython.core.shell module"""
25
26 warn(msg, category=DeprecationWarning, stacklevel=1)
27
28 from IPython.core.shell import *
29
@@ -0,0 +1,29 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 """
4 A backwards compatibility layer for IPython.ipapi.
5
6 Previously, IPython had an IPython.ipapi module. IPython.ipapi has been moved
7 to IPython.core.ipapi and is being refactored. This new module is provided
8 for backwards compatability. We strongly encourage everyone to start using
9 the new code in IPython.core.ipapi.
10 """
11
12 #-----------------------------------------------------------------------------
13 # Copyright (C) 2008-2009 The IPython Development Team
14 #
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
17 #-----------------------------------------------------------------------------
18
19 from warnings import warn
20
21 msg = """
22 This module (IPython.ipapi) has been moved to a new location
23 (IPython.core.ipapi) and is being refactored. Please update your code
24 to use the new IPython.core.ipapi module"""
25
26 warn(msg, category=DeprecationWarning, stacklevel=1)
27
28 from IPython.core.ipapi import *
29
@@ -0,0 +1,28 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 """
4 A backwards compatibility layer for IPython.iplib.
5
6 Previously, IPython had an IPython.iplib module. IPython.iplib has been moved
7 to IPython.core.iplib and is being refactored. This new module is provided
8 for backwards compatability. We strongly encourage everyone to start using
9 the new code in IPython.core.iplib.
10 """
11
12 #-----------------------------------------------------------------------------
13 # Copyright (C) 2008-2009 The IPython Development Team
14 #
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
17 #-----------------------------------------------------------------------------
18
19 from warnings import warn
20
21 msg = """
22 This module (IPython.iplib) has been moved to a new location
23 (IPython.core.iplib) and is being refactored. Please update your code
24 to use the new IPython.core.iplib module"""
25
26 warn(msg, category=DeprecationWarning, stacklevel=1)
27
28 from IPython.core.iplib import *
@@ -1,266 +1,274 b''
1 =============================
1 =============================
2 IPython module reorganization
2 IPython module reorganization
3 =============================
3 ============================='
4
4
5 Currently, IPython has many top-level modules that serve many different purposes.
5 Currently, IPython has many top-level modules that serve many different
6 The lack of organization make it very difficult for developers to work on IPython
6 purposes. The lack of organization make it very difficult for developers to
7 and understand its design. This document contains notes about how we will reorganize
7 work on IPython and understand its design. This document contains notes about
8 the modules into sub-packages.
8 how we will reorganize the modules into sub-packages.
9
9
10 .. warning::
10 .. warning::
11
11
12 This effort will possibly break third party packages that use IPython as
12 This effort will possibly break third party packages that use IPython as
13 a library or hack on the IPython internals.
13 a library or hack on the IPython internals.
14
14
15 .. warning::
15 .. warning::
16
16
17 This effort will result in the removal from IPython of certain modules
17 This effort will result in the removal from IPython of certain modules
18 that are not used anymore, don't currently work, are unmaintained, etc.
18 that are not used anymore, don't currently work, are unmaintained, etc.
19
19
20
20
21 Current subpackges
21 Current subpackges
22 ==================
22 ==================
23
23
24 IPython currently has the following sub-packages:
24 IPython currently has the following sub-packages:
25
25
26 * :mod:`IPython.config`
26 * :mod:`IPython.config`
27
27
28 * :mod:`IPython.Extensions`
28 * :mod:`IPython.Extensions`
29
29
30 * :mod:`IPython.external`
30 * :mod:`IPython.external`
31
31
32 * :mod:`IPython.frontend`
32 * :mod:`IPython.frontend`
33
33
34 * :mod:`IPython.gui`
34 * :mod:`IPython.gui`
35
35
36 * :mod:`IPython.kernel`
36 * :mod:`IPython.kernel`
37
37
38 * :mod:`IPython.testing`
38 * :mod:`IPython.testing`
39
39
40 * :mod:`IPython.tests`
40 * :mod:`IPython.tests`
41
41
42 * :mod:`IPython.tools`
42 * :mod:`IPython.tools`
43
43
44 * :mod:`IPython.UserConfig`
44 * :mod:`IPython.UserConfig`
45
45
46 New Subpackages to be created
46 New Subpackages to be created
47 =============================
47 =============================
48
48
49 We propose to create the following new sub-packages:
49 We propose to create the following new sub-packages:
50
50
51 * :mod:`IPython.core`. This sub-package will contain the core of the IPython
51 * :mod:`IPython.core`. This sub-package will contain the core of the IPython
52 interpreter, but none of its extended capabilities.
52 interpreter, but none of its extended capabilities.
53
53
54 * :mod:`IPython.lib`. IPython has many extended capabilities that are not part
54 * :mod:`IPython.lib`. IPython has many extended capabilities that are not part
55 of the IPython core. These things will go here. Any better names than
55 of the IPython core. These things will go here. Any better names than
56 :mod:`IPython.lib`?
56 :mod:`IPython.lib`?
57
57
58 * :mod:`IPython.utils`. This sub-package will contain anything that might
58 * :mod:`IPython.utils`. This sub-package will contain anything that might
59 eventually be found in the Python standard library, like things in
59 eventually be found in the Python standard library, like things in
60 :mod:`genutils`. Each sub-module in this sub-package should contain
60 :mod:`genutils`. Each sub-module in this sub-package should contain
61 functions and classes that serve a single purpose.
61 functions and classes that serve a single purpose.
62
62
63 * :mod:`IPython.deathrow`. This is for code that is untested and/or rotting
63 * :mod:`IPython.deathrow`. This is for code that is untested and/or rotting
64 and needs to be removed from IPython. Eventually all this code will either
64 and needs to be removed from IPython. Eventually all this code will either
65 i) be revived by someone willing to maintain it with tests and docs and
65 i) be revived by someone willing to maintain it with tests and docs and
66 re-included into IPython or 2) be removed from IPython proper, but put into
66 re-included into IPython or 2) be removed from IPython proper, but put into
67 a separate top-level (not IPython) package that we keep around. No new code
67 a separate top-level (not IPython) package that we keep around. No new code
68 will be allowed here.
68 will be allowed here.
69
69
70 * :mod:`IPython.quarantine`. This is for code that doesn't meet IPython's
70 * :mod:`IPython.quarantine`. This is for code that doesn't meet IPython's
71 standards, but that we plan on keeping. To be moved out of this sub-package
71 standards, but that we plan on keeping. To be moved out of this sub-package
72 a module needs to have a maintainer, tests and documentation.
72 a module needs to have a maintainer, tests and documentation.
73
73
74 Prodecure
74 Prodedure
75 =========
75 =========
76
76
77 1. Move the file to its new location with its new name.
77 1. Move the file to its new location with its new name.
78 2. Rename all import statements to reflect the change.
78 2. Rename all import statements to reflect the change.
79 3. Run PyFlakes on each changes module.
79 3. Run PyFlakes on each changes module.
80 3. Add tests/test_imports.py to test it.
80 3. Add tests/test_imports.py to test it.
81
81
82 Need to modify iptests to properly skip modules that are no longer top
82 Status
83 level modules.
83 ======
84
85 The new subpackages have been created and the top-level modules have been
86 moved and renamed. Import tests have been created for all of the moved and
87 renamed modules. The build infrastructure (setup.py and friends) have been
88 updated and tested on Mac and Windows. Finally, a compatibility layer has been
89 added for iplib, ipapi and Shell. The follow things still need to be done::
90
91 * I need to modify iptests to properly skip modules that are no longer top
92 level modules.
84
93
85 Need to update the top level IPython/__init__.py file.
94 * I Need to update the top level IPython/__init__.py file. We need to make
95 sure that as we change how this is setup, that all modules still import.
86
96
87 Need to get installation working correctly.
97 * When running python setup.py sdist, the Sphinx API docs fail to build
98 because of something going on with IPython.core.fakemodule
88
99
89 When running python setup.py sdist, the Sphinx API docs fail to build because
100 * :file:`Extensions`. This needs to be gone through separately. Minimally,
90 of something going on with IPython.core.fakemodule
101 the package should be renamed to :file:`extensions` and the PYTHONPATH
102 setting in __init__.py needs to be updated.
91
103
92 Where things will be moved
104 Where things have been moved
93 ==========================
105 ============================
94
106
95 Top-level modules:
107 Top-level modules:
96
108
97 * :file:`background_jobs.py`. Move to :file:`IPython/lib/backgroundjobs.py`.
109 * :file:`background_jobs.py`. Move to :file:`IPython/lib/backgroundjobs.py`.
98
110
99 * :file:`ColorANSI.py`. Move to :file:`IPython/utils/coloransi.py`.
111 * :file:`ColorANSI.py`. Move to :file:`IPython/utils/coloransi.py`.
100
112
101 * :file:`completer.py`. Move to :file:`IPython/core/completer.py`.
113 * :file:`completer.py`. Move to :file:`IPython/core/completer.py`.
102
114
103 * :file:`ConfigLoader.py`. Move to :file:`IPython/config/configloader.py`.
115 * :file:`ConfigLoader.py`. Move to :file:`IPython/config/configloader.py`.
104
116
105 * :file:`CrashHandler.py`. Move to :file:`IPython/core/crashhandler`.
117 * :file:`CrashHandler.py`. Move to :file:`IPython/core/crashhandler`.
106
118
107 * :file:`Debugger.py`. Move to :file:`IPython/core/debugger.py`.
119 * :file:`Debugger.py`. Move to :file:`IPython/core/debugger.py`.
108
120
109 * :file:`deep_reload.py`. Move to :file:`IPython/lib/deepreload.py`.
121 * :file:`deep_reload.py`. Move to :file:`IPython/lib/deepreload.py`.
110
122
111 * :file:`demo.py`. Move to :file:`IPython/lib/demo.py`.
123 * :file:`demo.py`. Move to :file:`IPython/lib/demo.py`.
112
124
113 * :file:`DPyGetOpt.py`. Move to :mod:`IPython.utils` and replace with newer options parser.
125 * :file:`DPyGetOpt.py`. Move to :mod:`IPython.utils` and replace with newer options parser.
114
126
115 * :file:`dtutils.py`. Move to :file:`IPython.deathrow`.
127 * :file:`dtutils.py`. Move to :file:`IPython.deathrow`.
116
128
117 * :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`.
129 * :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`.
118 Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`?
130 Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`?
119
131
120 * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`.
132 * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`.
121
133
122 * :file:`generics.py`. Move to :file:`IPython.python`.
134 * :file:`generics.py`. Move to :file:`IPython.python`.
123
135
124 * :file:`genutils.py`. Move to :file:`IPython.utils`.
136 * :file:`genutils.py`. Move to :file:`IPython.utils`.
125
137
126 * :file:`Gnuplot2.py`. Move to :file:`IPython.sandbox`.
138 * :file:`Gnuplot2.py`. Move to :file:`IPython.sandbox`.
127
139
128 * :file:`GnuplotInteractive.py`. Move to :file:`IPython.sandbox`.
140 * :file:`GnuplotInteractive.py`. Move to :file:`IPython.sandbox`.
129
141
130 * :file:`GnuplotRuntime.py`. Move to :file:`IPython.sandbox`.
142 * :file:`GnuplotRuntime.py`. Move to :file:`IPython.sandbox`.
131
143
132 * :file:`numutils.py`. Move to :file:`IPython.sandbox`.
144 * :file:`numutils.py`. Move to :file:`IPython.sandbox`.
133
145
134 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
146 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
135
147
136 * :file:`Extensions`. This needs to be gone through separately. Minimally,
137 the package should be renamed to :file:`extensions`.
138
139 * :file:`history.py`. Move to :file:`IPython.core`.
148 * :file:`history.py`. Move to :file:`IPython.core`.
140
149
141 * :file:`hooks.py`. Move to :file:`IPython.core`.
150 * :file:`hooks.py`. Move to :file:`IPython.core`.
142
151
143 * :file:`ipapi.py`. Move to :file:`IPython.core`.
152 * :file:`ipapi.py`. Move to :file:`IPython.core`.
144
153
145 * :file:`iplib.py`. Move to :file:`IPython.core`.
154 * :file:`iplib.py`. Move to :file:`IPython.core`.
146
155
147 * :file:`ipmaker.py`: Move to :file:`IPython.core`.
156 * :file:`ipmaker.py`: Move to :file:`IPython.core`.
148
157
149 * :file:`ipstruct.py`. Move to :file:`IPython.python`.
158 * :file:`ipstruct.py`. Move to :file:`IPython.python`.
150
159
151 * :file:`irunner.py`. Move to :file:`IPython.scripts`. ???
160 * :file:`irunner.py`. Move to :file:`IPython.scripts`.
152
161
153 * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in
162 * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in
154 :file:`IPython.external`.
163 :file:`IPython.external`.
155
164
156 * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`.
165 * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`.
157
166
158 * :file:`macro.py`. Move to :file:`IPython.core`.
167 * :file:`macro.py`. Move to :file:`IPython.core`.
159
168
160 * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`.
169 * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`.
161
170
162 * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`.
171 * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`.
163
172
164 * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`.
173 * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`.
165
174
166 * :file:`platutils.py`. Move to :file:`IPython.python`.
175 * :file:`platutils.py`. Move to :file:`IPython.python`.
167
176
168 * :file:`platutils_dummy.py`. Move to :file:`IPython.python`.
177 * :file:`platutils_dummy.py`. Move to :file:`IPython.python`.
169
178
170 * :file:`platutils_posix.py`. Move to :file:`IPython.python`.
179 * :file:`platutils_posix.py`. Move to :file:`IPython.python`.
171
180
172 * :file:`platutils_win32.py`. Move to :file:`IPython.python`.
181 * :file:`platutils_win32.py`. Move to :file:`IPython.python`.
173
182
174 * :file:`prefilter.py`: Move to :file:`IPython.core`.
183 * :file:`prefilter.py`: Move to :file:`IPython.core`.
175
184
176 * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or
185 * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or
177 :file:`IPython/frontend/prompts.py`.
186 :file:`IPython/frontend/prompts.py`.
178
187
179 * :file:`PyColorize.py`. Replace with pygments? If not, move to
188 * :file:`PyColorize.py`. Move to :file:`IPython/utils/pycolorize.py`. Explore
180 :file:`IPython/core/pycolorize.py`. Maybe move to :mod:`IPython.lib` or
189 replacing with pygments.
181 :mod:`IPython.python`?
182
190
183 * :file:`Release.py`. Move to ??? or remove?
191 * :file:`Release.py`. Move to ??? or remove?
184
192
185 * :file:`rlineimpl.py`. Move to :file:`IPython.core`.
193 * :file:`rlineimpl.py`. Move to :file:`IPython.core`.
186
194
187 * :file:`shadowns.py`. Move to :file:`IPython.core`.
195 * :file:`shadowns.py`. Move to :file:`IPython.core`.
188
196
189 * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or
197 * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or
190 :file:`IPython/frontend/shell.py`.
198 :file:`IPython/frontend/shell.py`.
191
199
192 * :file:`shellglobals.py`. Move to :file:`IPython.core`.
200 * :file:`shellglobals.py`. Move to :file:`IPython.core`.
193
201
194 * :file:`strdispatch.py`. Move to :file:`IPython.python`.
202 * :file:`strdispatch.py`. Move to :file:`IPython.python`.
195
203
196 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
204 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
197
205
198 * :file:`ultraTB.py`. Move to :file:`IPython/core/ultratb.py`.
206 * :file:`ultraTB.py`. Move to :file:`IPython/core/ultratb.py`.
199
207
200 * :file:`upgrade_dir.py`. Move to :file:`IPython/utils/upgradedir.py`.
208 * :file:`upgrade_dir.py`. Move to :file:`IPython/utils/upgradedir.py`.
201
209
202 * :file:`usage.py`. Move to :file:`IPython.core`.
210 * :file:`usage.py`. Move to :file:`IPython.core`.
203
211
204 * :file:`wildcard.py`. Move to :file:`IPython.utils`.
212 * :file:`wildcard.py`. Move to :file:`IPython.utils`.
205
213
206 * :file:`winconsole.py`. Move to :file:`IPython.utils`.
214 * :file:`winconsole.py`. Move to :file:`IPython.utils`.
207
215
208 Top-level sub-packages:
216 Top-level sub-packages:
209
217
210 * :file:`testing`. Good where it is.
218 * :file:`testing`. Good where it is.
211
219
212 * :file:`tests`. Remove.
220 * :file:`tests`. Remove.
213
221
214 * :file:`tools`. Things in here need to be looked at and moved elsewhere like
222 * :file:`tools`. Things in here need to be looked at and moved elsewhere like
215 :file:`IPython.utils`.
223 :file:`IPython.utils`.
216
224
217 * :file:`UserConfig`. Move to :file:`IPython.config.userconfig`.
225 * :file:`UserConfig`. Move to :file:`IPython.config.userconfig`.
218
226
219 * :file:`config`. Good where it is!
227 * :file:`config`. Good where it is!
220
228
221 * :file:`external`. Good where it is!
229 * :file:`external`. Good where it is!
222
230
223 * :file:`frontend`. Good where it is!
231 * :file:`frontend`. Good where it is!
224
232
225 * :file:`gui`. Eventually this should be moved to a subdir of
233 * :file:`gui`. Eventually this should be moved to a subdir of
226 :file:`IPython.frontend`.
234 :file:`IPython.frontend`.
227
235
228 * :file:`kernel`. Good where it is.
236 * :file:`kernel`. Good where it is.
229
237
230
238
231
239
232
240
233
241
234
242
235
243
236
244
237
245
238
246
239
247
240
248
241
249
242
250
243
251
244
252
245
253
246 Other things
254 Other things
247 ============
255 ============
248
256
249 When these files are moved around, a number of other things will happen at the same time:
257 When these files are moved around, a number of other things will happen at the same time:
250
258
251 1. Test files will be created for each module in IPython. Minimally, all
259 1. Test files will be created for each module in IPython. Minimally, all
252 modules will be imported as a part of the test. This will serve as a
260 modules will be imported as a part of the test. This will serve as a
253 test of the module reorganization. These tests will be put into new
261 test of the module reorganization. These tests will be put into new
254 :file:`tests` subdirectories that each package will have.
262 :file:`tests` subdirectories that each package will have.
255
263
256 2. PyFlakes and other code checkers will be run to look for problems.
264 2. PyFlakes and other code checkers will be run to look for problems.
257
265
258 3. Modules will be renamed to comply with PEP 8 naming conventions: all
266 3. Modules will be renamed to comply with PEP 8 naming conventions: all
259 lowercase and no special characters like ``-`` or ``_``.
267 lowercase and no special characters like ``-`` or ``_``.
260
268
261 4. Existing tests will be moved to the appropriate :file:`tests`
269 4. Existing tests will be moved to the appropriate :file:`tests`
262 subdirectories.
270 subdirectories.
263
271
264
272
265
273
266
274
General Comments 0
You need to be logged in to leave comments. Login now