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