##// END OF EJS Templates
Minor fixes to setupexe.py and reorg.txt.
Brian Granger -
Show More
@@ -1,274 +1,94 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
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
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
7 work on IPython and understand its design. This document contains notes about
8 how we will reorganize 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.
56 :mod:`IPython.lib`?
57
56
58 * :mod:`IPython.utils`. This sub-package will contain anything that might
57 * :mod:`IPython.utils`. This sub-package will contain anything that might
59 eventually be found in the Python standard library, like things in
58 eventually be found in the Python standard library, like things in
60 :mod:`genutils`. Each sub-module in this sub-package should contain
59 :mod:`genutils`. Each sub-module in this sub-package should contain
61 functions and classes that serve a single purpose.
60 functions and classes that serve a single purpose.
62
61
63 * :mod:`IPython.deathrow`. This is for code that is untested and/or rotting
62 * :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
63 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
64 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
65 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
66 a separate top-level (not IPython) package that we keep around. No new code
68 will be allowed here.
67 will be allowed here.
69
68
70 * :mod:`IPython.quarantine`. This is for code that doesn't meet IPython's
69 * :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
70 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.
71 a module needs to have a maintainer, tests and documentation.
73
72
74 Prodedure
73 Procedure
75 =========
74 =========
76
75
77 1. Move the file to its new location with its new name.
76 1. Move the file to its new location with its new name.
78 2. Rename all import statements to reflect the change.
77 2. Rename all import statements to reflect the change.
79 3. Run PyFlakes on each changes module.
78 3. Run PyFlakes on each changes module.
80 3. Add tests/test_imports.py to test it.
79 3. Add tests/test_imports.py to test it.
81
80
82 Status
81 Status
83 ======
82 ======
84
83
85 The new subpackages have been created and the top-level modules have been
84 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
85 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
86 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
87 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::
88 added for iplib, ipapi and Shell. The follow things still need to be done::
90
89
91 * I need to modify iptests to properly skip modules that are no longer top
90 * I need to modify iptests to properly skip modules that are no longer top
92 level modules.
91 level modules.
93
92
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.
96
97 * When running python setup.py sdist, the Sphinx API docs fail to build
93 * When running python setup.py sdist, the Sphinx API docs fail to build
98 because of something going on with IPython.core.fakemodule
94 because of something going on with IPython.core.fakemodule
99
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.
103
104 Where things have been moved
105 ============================
106
107 Top-level modules:
108
109 * :file:`background_jobs.py`. Move to :file:`IPython/lib/backgroundjobs.py`.
110
111 * :file:`ColorANSI.py`. Move to :file:`IPython/utils/coloransi.py`.
112
113 * :file:`completer.py`. Move to :file:`IPython/core/completer.py`.
114
115 * :file:`ConfigLoader.py`. Move to :file:`IPython/config/configloader.py`.
116
117 * :file:`CrashHandler.py`. Move to :file:`IPython/core/crashhandler`.
118
119 * :file:`Debugger.py`. Move to :file:`IPython/core/debugger.py`.
120
121 * :file:`deep_reload.py`. Move to :file:`IPython/lib/deepreload.py`.
122
123 * :file:`demo.py`. Move to :file:`IPython/lib/demo.py`.
124
125 * :file:`DPyGetOpt.py`. Move to :mod:`IPython.utils` and replace with newer options parser.
126
127 * :file:`dtutils.py`. Move to :file:`IPython.deathrow`.
128
129 * :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`.
130 Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`?
131
132 * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`.
133
134 * :file:`generics.py`. Move to :file:`IPython.python`.
135
136 * :file:`genutils.py`. Move to :file:`IPython.utils`.
137
138 * :file:`Gnuplot2.py`. Move to :file:`IPython.sandbox`.
139
140 * :file:`GnuplotInteractive.py`. Move to :file:`IPython.sandbox`.
141
142 * :file:`GnuplotRuntime.py`. Move to :file:`IPython.sandbox`.
143
144 * :file:`numutils.py`. Move to :file:`IPython.sandbox`.
145
146 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
147
148 * :file:`history.py`. Move to :file:`IPython.core`.
149
150 * :file:`hooks.py`. Move to :file:`IPython.core`.
151
152 * :file:`ipapi.py`. Move to :file:`IPython.core`.
153
154 * :file:`iplib.py`. Move to :file:`IPython.core`.
155
156 * :file:`ipmaker.py`: Move to :file:`IPython.core`.
157
158 * :file:`ipstruct.py`. Move to :file:`IPython.python`.
159
160 * :file:`irunner.py`. Move to :file:`IPython.scripts`.
161
162 * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in
163 :file:`IPython.external`.
164
165 * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`.
166
167 * :file:`macro.py`. Move to :file:`IPython.core`.
168
169 * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`.
170
171 * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`.
172
173 * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`.
174
175 * :file:`platutils.py`. Move to :file:`IPython.python`.
176
177 * :file:`platutils_dummy.py`. Move to :file:`IPython.python`.
178
179 * :file:`platutils_posix.py`. Move to :file:`IPython.python`.
180
181 * :file:`platutils_win32.py`. Move to :file:`IPython.python`.
182
183 * :file:`prefilter.py`: Move to :file:`IPython.core`.
184
185 * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or
186 :file:`IPython/frontend/prompts.py`.
187
188 * :file:`PyColorize.py`. Move to :file:`IPython/utils/pycolorize.py`. Explore
189 replacing with pygments.
190
191 * :file:`Release.py`. Move to ??? or remove?
192
193 * :file:`rlineimpl.py`. Move to :file:`IPython.core`.
194
195 * :file:`shadowns.py`. Move to :file:`IPython.core`.
196
197 * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or
198 :file:`IPython/frontend/shell.py`.
199
200 * :file:`shellglobals.py`. Move to :file:`IPython.core`.
201
202 * :file:`strdispatch.py`. Move to :file:`IPython.python`.
203
204 * :file:`twshell.py`. Move to :file:`IPython.sandbox`.
205
206 * :file:`ultraTB.py`. Move to :file:`IPython/core/ultratb.py`.
207
208 * :file:`upgrade_dir.py`. Move to :file:`IPython/utils/upgradedir.py`.
209
210 * :file:`usage.py`. Move to :file:`IPython.core`.
211
212 * :file:`wildcard.py`. Move to :file:`IPython.utils`.
213
214 * :file:`winconsole.py`. Move to :file:`IPython.utils`.
215
216 Top-level sub-packages:
217
218 * :file:`testing`. Good where it is.
219
220 * :file:`tests`. Remove.
221
222 * :file:`tools`. Things in here need to be looked at and moved elsewhere like
223 :file:`IPython.utils`.
224
225 * :file:`UserConfig`. Move to :file:`IPython.config.userconfig`.
226
227 * :file:`config`. Good where it is!
228
229 * :file:`external`. Good where it is!
230
231 * :file:`frontend`. Good where it is!
232
233 * :file:`gui`. Eventually this should be moved to a subdir of
234 :file:`IPython.frontend`.
235
236 * :file:`kernel`. Good where it is.
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254 Other things
255 ============
256
257 When these files are moved around, a number of other things will happen at the same time:
258
259 1. Test files will be created for each module in IPython. Minimally, all
260 modules will be imported as a part of the test. This will serve as a
261 test of the module reorganization. These tests will be put into new
262 :file:`tests` subdirectories that each package will have.
263
264 2. PyFlakes and other code checkers will be run to look for problems.
265
266 3. Modules will be renamed to comply with PEP 8 naming conventions: all
267 lowercase and no special characters like ``-`` or ``_``.
268
269 4. Existing tests will be moved to the appropriate :file:`tests`
270 subdirectories.
271
272
273
274
@@ -1,106 +1,107 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 r"""Setup script for exe distribution of IPython (does not require python).
3 r"""Setup script for exe distribution of IPython (does not require python).
4
4
5 - Requires py2exe
5 - Requires py2exe
6
6
7 - install pyreadline *package dir* in ipython root directory by running:
7 - install pyreadline *package dir* in ipython root directory by running:
8
8
9 svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/
9 svn co http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/pyreadline/
10 wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py
10 wget http://ipython.scipy.org/svn/ipython/pyreadline/branches/maintenance_1.3/readline.py
11
11
12 OR (if you want the latest trunk):
12 OR (if you want the latest trunk):
13
13
14 svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline
14 svn co http://ipython.scipy.org/svn/ipython/pyreadline/trunk/pyreadline
15
15
16 - Create the distribution in 'dist' by running "python exesetup.py py2exe"
16 - Create the distribution in 'dist' by running "python exesetup.py py2exe"
17
17
18 - Run ipython.exe to go.
18 - Run ipython.exe to go.
19
19
20 """
20 """
21
21
22 #*****************************************************************************
22 #*****************************************************************************
23 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
23 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
24 #
24 #
25 # Distributed under the terms of the BSD License. The full license is in
25 # Distributed under the terms of the BSD License. The full license is in
26 # the file COPYING, distributed as part of this software.
26 # the file COPYING, distributed as part of this software.
27 #*****************************************************************************
27 #*****************************************************************************
28
28
29 # Stdlib imports
29 # Stdlib imports
30 import os
30 import os
31 import sys
31 import sys
32
32
33 from glob import glob
33 from glob import glob
34
34
35
35
36 # A few handy globals
36 # A few handy globals
37 isfile = os.path.isfile
37 isfile = os.path.isfile
38 pjoin = os.path.join
38 pjoin = os.path.join
39
39
40 from distutils.core import setup
40 from distutils.core import setup
41 from distutils import dir_util
41 from distutils import dir_util
42 import py2exe
42 import py2exe
43
43
44 # update the manuals when building a source dist
44 # update the manuals when building a source dist
45 # Release.py contains version, authors, license, url, keywords, etc.
45 # Release.py contains version, authors, license, url, keywords, etc.
46 execfile(pjoin('IPython','Release.py'))
46 execfile(pjoin('IPython','core','release.py'))
47
47
48 # A little utility we'll need below, since glob() does NOT allow you to do
48 # A little utility we'll need below, since glob() does NOT allow you to do
49 # exclusion on multiple endings!
49 # exclusion on multiple endings!
50 def file_doesnt_endwith(test,endings):
50 def file_doesnt_endwith(test,endings):
51 """Return true if test is a file and its name does NOT end with any
51 """Return true if test is a file and its name does NOT end with any
52 of the strings listed in endings."""
52 of the strings listed in endings."""
53 if not isfile(test):
53 if not isfile(test):
54 return False
54 return False
55 for e in endings:
55 for e in endings:
56 if test.endswith(e):
56 if test.endswith(e):
57 return False
57 return False
58 return True
58 return True
59
59
60
60
61 egg_extra_kwds = {}
61 egg_extra_kwds = {}
62
62
63 # Call the setup() routine which does most of the work
63 # Call the setup() routine which does most of the work
64 setup(name = name,
64 setup(name = name,
65 options = {
65 options = {
66 'py2exe': {
66 'py2exe': {
67 'packages' : ['IPython', 'IPython.extensions', 'IPython.external',
67 'packages' : ['IPython', 'IPython.extensions', 'IPython.external',
68 'pyreadline'],
68 'pyreadline','config','core','deathrow','lib',
69 'scripts','testing','utils'],
69 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx',
70 'excludes' : ["Tkconstants","Tkinter","tcl",'IPython.igrid','wx',
70 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2',
71 'wxPython','igrid', 'PyQt4', 'zope', 'Zope', 'Zope2',
71 '_curses','enthought.traits','gtk','qt', 'pydb','idlelib',
72 '_curses','enthought.traits','gtk','qt', 'pydb','idlelib',
72 ]
73 ]
73
74
74 }
75 }
75 },
76 },
76 version = version,
77 version = version,
77 description = description,
78 description = description,
78 long_description = long_description,
79 long_description = long_description,
79 author = authors['Fernando'][0],
80 author = authors['Fernando'][0],
80 author_email = authors['Fernando'][1],
81 author_email = authors['Fernando'][1],
81 url = url,
82 url = url,
82 download_url = download_url,
83 download_url = download_url,
83 license = license,
84 license = license,
84 platforms = platforms,
85 platforms = platforms,
85 keywords = keywords,
86 keywords = keywords,
86 console = ['ipykit.py'],
87 console = ['ipykit.py'],
87
88
88 # extra params needed for eggs
89 # extra params needed for eggs
89 **egg_extra_kwds
90 **egg_extra_kwds
90 )
91 )
91
92
92 minimal_conf = """
93 minimal_conf = """
93 import IPython.ipapi
94 import IPython.ipapi
94 ip = IPython.ipapi.get()
95 ip = IPython.ipapi.get()
95
96
96 ip.load('ipy_kitcfg')
97 ip.load('ipy_kitcfg')
97 import ipy_profile_sh
98 import ipy_profile_sh
98 """
99 """
99
100
100 if not os.path.isdir("dist/_ipython"):
101 if not os.path.isdir("dist/_ipython"):
101 print "Creating simple _ipython dir"
102 print "Creating simple _ipython dir"
102 os.mkdir("dist/_ipython")
103 os.mkdir("dist/_ipython")
103 open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n")
104 open("dist/_ipython/ipythonrc.ini","w").write("# intentionally blank\n")
104 open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf)
105 open("dist/_ipython/ipy_user_conf.py","w").write(minimal_conf)
105 if os.path.isdir('bin'):
106 if os.path.isdir('bin'):
106 dir_util.copy_tree('bin','dist/bin')
107 dir_util.copy_tree('bin','dist/bin')
General Comments 0
You need to be logged in to leave comments. Login now