Show More
1 | NO CONTENT: file renamed from IPython/tests/obj_del.py to IPython/core/tests/obj_del.py |
|
NO CONTENT: file renamed from IPython/tests/obj_del.py to IPython/core/tests/obj_del.py |
1 | NO CONTENT: file renamed from IPython/tests/refbug.py to IPython/core/tests/refbug.py |
|
NO CONTENT: file renamed from IPython/tests/refbug.py to IPython/core/tests/refbug.py |
1 | NO CONTENT: file renamed from IPython/tests/tclass.py to IPython/core/tests/tclass.py |
|
NO CONTENT: file renamed from IPython/tests/tclass.py to IPython/core/tests/tclass.py |
@@ -1,249 +1,249 b'' | |||||
1 | """Tests for various magic functions. |
|
1 | """Tests for various magic functions. | |
2 |
|
2 | |||
3 | Needs to be run by nose (to make ipython session available). |
|
3 | Needs to be run by nose (to make ipython session available). | |
4 | """ |
|
4 | """ | |
5 |
|
5 | |||
6 | import os |
|
6 | import os | |
7 | import sys |
|
7 | import sys | |
8 | import tempfile |
|
8 | import tempfile | |
9 | import types |
|
9 | import types | |
10 |
|
10 | |||
11 | import nose.tools as nt |
|
11 | import nose.tools as nt | |
12 |
|
12 | |||
13 | from IPython.utils.platutils import find_cmd, get_long_path_name |
|
13 | from IPython.utils.platutils import find_cmd, get_long_path_name | |
14 | from IPython.testing import decorators as dec |
|
14 | from IPython.testing import decorators as dec | |
15 | from IPython.testing import tools as tt |
|
15 | from IPython.testing import tools as tt | |
16 |
|
16 | |||
17 | #----------------------------------------------------------------------------- |
|
17 | #----------------------------------------------------------------------------- | |
18 | # Test functions begin |
|
18 | # Test functions begin | |
19 |
|
19 | |||
20 | def test_rehashx(): |
|
20 | def test_rehashx(): | |
21 | # clear up everything |
|
21 | # clear up everything | |
22 | _ip.IP.alias_table.clear() |
|
22 | _ip.IP.alias_table.clear() | |
23 | del _ip.db['syscmdlist'] |
|
23 | del _ip.db['syscmdlist'] | |
24 |
|
24 | |||
25 | _ip.magic('rehashx') |
|
25 | _ip.magic('rehashx') | |
26 | # Practically ALL ipython development systems will have more than 10 aliases |
|
26 | # Practically ALL ipython development systems will have more than 10 aliases | |
27 |
|
27 | |||
28 | assert len(_ip.IP.alias_table) > 10 |
|
28 | assert len(_ip.IP.alias_table) > 10 | |
29 | for key, val in _ip.IP.alias_table.items(): |
|
29 | for key, val in _ip.IP.alias_table.items(): | |
30 | # we must strip dots from alias names |
|
30 | # we must strip dots from alias names | |
31 | assert '.' not in key |
|
31 | assert '.' not in key | |
32 |
|
32 | |||
33 | # rehashx must fill up syscmdlist |
|
33 | # rehashx must fill up syscmdlist | |
34 | scoms = _ip.db['syscmdlist'] |
|
34 | scoms = _ip.db['syscmdlist'] | |
35 | assert len(scoms) > 10 |
|
35 | assert len(scoms) > 10 | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | def doctest_hist_f(): |
|
38 | def doctest_hist_f(): | |
39 | """Test %hist -f with temporary filename. |
|
39 | """Test %hist -f with temporary filename. | |
40 |
|
40 | |||
41 | In [9]: import tempfile |
|
41 | In [9]: import tempfile | |
42 |
|
42 | |||
43 | In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-') |
|
43 | In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-') | |
44 |
|
44 | |||
45 | In [11]: %history -n -f $tfile 3 |
|
45 | In [11]: %history -n -f $tfile 3 | |
46 | """ |
|
46 | """ | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | def doctest_hist_r(): |
|
49 | def doctest_hist_r(): | |
50 | """Test %hist -r |
|
50 | """Test %hist -r | |
51 |
|
51 | |||
52 | XXX - This test is not recording the output correctly. Not sure why... |
|
52 | XXX - This test is not recording the output correctly. Not sure why... | |
53 |
|
53 | |||
54 | In [6]: x=1 |
|
54 | In [6]: x=1 | |
55 |
|
55 | |||
56 | In [7]: hist -n -r 2 |
|
56 | In [7]: hist -n -r 2 | |
57 | x=1 # random |
|
57 | x=1 # random | |
58 | hist -n -r 2 # random |
|
58 | hist -n -r 2 # random | |
59 | """ |
|
59 | """ | |
60 |
|
60 | |||
61 | # This test is known to fail on win32. |
|
61 | # This test is known to fail on win32. | |
62 | # See ticket https://bugs.launchpad.net/bugs/366334 |
|
62 | # See ticket https://bugs.launchpad.net/bugs/366334 | |
63 | def test_obj_del(): |
|
63 | def test_obj_del(): | |
64 | """Test that object's __del__ methods are called on exit.""" |
|
64 | """Test that object's __del__ methods are called on exit.""" | |
65 | test_dir = os.path.dirname(__file__) |
|
65 | test_dir = os.path.dirname(__file__) | |
66 | del_file = os.path.join(test_dir,'obj_del.py') |
|
66 | del_file = os.path.join(test_dir,'obj_del.py') | |
67 | ipython_cmd = find_cmd('ipython') |
|
67 | ipython_cmd = find_cmd('ipython') | |
68 | out = _ip.IP.getoutput('%s %s' % (ipython_cmd, del_file)) |
|
68 | out = _ip.IP.getoutput('%s %s' % (ipython_cmd, del_file)) | |
69 | nt.assert_equals(out,'obj_del.py: object A deleted') |
|
69 | nt.assert_equals(out,'obj_del.py: object A deleted') | |
70 |
|
70 | |||
71 |
|
71 | |||
72 | def test_shist(): |
|
72 | def test_shist(): | |
73 | # Simple tests of ShadowHist class - test generator. |
|
73 | # Simple tests of ShadowHist class - test generator. | |
74 | import os, shutil, tempfile |
|
74 | import os, shutil, tempfile | |
75 |
|
75 | |||
76 | from IPython.Extensions import pickleshare |
|
76 | from IPython.Extensions import pickleshare | |
77 | from IPython.history import ShadowHist |
|
77 | from IPython.core.history import ShadowHist | |
78 |
|
78 | |||
79 | tfile = tempfile.mktemp('','tmp-ipython-') |
|
79 | tfile = tempfile.mktemp('','tmp-ipython-') | |
80 |
|
80 | |||
81 | db = pickleshare.PickleShareDB(tfile) |
|
81 | db = pickleshare.PickleShareDB(tfile) | |
82 | s = ShadowHist(db) |
|
82 | s = ShadowHist(db) | |
83 | s.add('hello') |
|
83 | s.add('hello') | |
84 | s.add('world') |
|
84 | s.add('world') | |
85 | s.add('hello') |
|
85 | s.add('hello') | |
86 | s.add('hello') |
|
86 | s.add('hello') | |
87 | s.add('karhu') |
|
87 | s.add('karhu') | |
88 |
|
88 | |||
89 | yield nt.assert_equals,s.all(),[(1, 'hello'), (2, 'world'), (3, 'karhu')] |
|
89 | yield nt.assert_equals,s.all(),[(1, 'hello'), (2, 'world'), (3, 'karhu')] | |
90 |
|
90 | |||
91 | yield nt.assert_equal,s.get(2),'world' |
|
91 | yield nt.assert_equal,s.get(2),'world' | |
92 |
|
92 | |||
93 | shutil.rmtree(tfile) |
|
93 | shutil.rmtree(tfile) | |
94 |
|
94 | |||
95 | @dec.skipif_not_numpy |
|
95 | @dec.skipif_not_numpy | |
96 | def test_numpy_clear_array_undec(): |
|
96 | def test_numpy_clear_array_undec(): | |
97 | _ip.ex('import numpy as np') |
|
97 | _ip.ex('import numpy as np') | |
98 | _ip.ex('a = np.empty(2)') |
|
98 | _ip.ex('a = np.empty(2)') | |
99 |
|
99 | |||
100 | yield nt.assert_true,'a' in _ip.user_ns |
|
100 | yield nt.assert_true,'a' in _ip.user_ns | |
101 | _ip.magic('clear array') |
|
101 | _ip.magic('clear array') | |
102 | yield nt.assert_false,'a' in _ip.user_ns |
|
102 | yield nt.assert_false,'a' in _ip.user_ns | |
103 |
|
103 | |||
104 |
|
104 | |||
105 | @dec.skip() |
|
105 | @dec.skip() | |
106 | def test_fail_dec(*a,**k): |
|
106 | def test_fail_dec(*a,**k): | |
107 | yield nt.assert_true, False |
|
107 | yield nt.assert_true, False | |
108 |
|
108 | |||
109 | @dec.skip('This one shouldn not run') |
|
109 | @dec.skip('This one shouldn not run') | |
110 | def test_fail_dec2(*a,**k): |
|
110 | def test_fail_dec2(*a,**k): | |
111 | yield nt.assert_true, False |
|
111 | yield nt.assert_true, False | |
112 |
|
112 | |||
113 | @dec.skipknownfailure |
|
113 | @dec.skipknownfailure | |
114 | def test_fail_dec3(*a,**k): |
|
114 | def test_fail_dec3(*a,**k): | |
115 | yield nt.assert_true, False |
|
115 | yield nt.assert_true, False | |
116 |
|
116 | |||
117 |
|
117 | |||
118 | def doctest_refbug(): |
|
118 | def doctest_refbug(): | |
119 | """Very nasty problem with references held by multiple runs of a script. |
|
119 | """Very nasty problem with references held by multiple runs of a script. | |
120 | See: https://bugs.launchpad.net/ipython/+bug/269966 |
|
120 | See: https://bugs.launchpad.net/ipython/+bug/269966 | |
121 |
|
121 | |||
122 | In [1]: _ip.IP.clear_main_mod_cache() |
|
122 | In [1]: _ip.IP.clear_main_mod_cache() | |
123 |
|
123 | |||
124 | In [2]: run refbug |
|
124 | In [2]: run refbug | |
125 |
|
125 | |||
126 | In [3]: call_f() |
|
126 | In [3]: call_f() | |
127 | lowercased: hello |
|
127 | lowercased: hello | |
128 |
|
128 | |||
129 | In [4]: run refbug |
|
129 | In [4]: run refbug | |
130 |
|
130 | |||
131 | In [5]: call_f() |
|
131 | In [5]: call_f() | |
132 | lowercased: hello |
|
132 | lowercased: hello | |
133 | lowercased: hello |
|
133 | lowercased: hello | |
134 | """ |
|
134 | """ | |
135 |
|
135 | |||
136 | #----------------------------------------------------------------------------- |
|
136 | #----------------------------------------------------------------------------- | |
137 | # Tests for %run |
|
137 | # Tests for %run | |
138 | #----------------------------------------------------------------------------- |
|
138 | #----------------------------------------------------------------------------- | |
139 |
|
139 | |||
140 | # %run is critical enough that it's a good idea to have a solid collection of |
|
140 | # %run is critical enough that it's a good idea to have a solid collection of | |
141 | # tests for it, some as doctests and some as normal tests. |
|
141 | # tests for it, some as doctests and some as normal tests. | |
142 |
|
142 | |||
143 | def doctest_run_ns(): |
|
143 | def doctest_run_ns(): | |
144 | """Classes declared %run scripts must be instantiable afterwards. |
|
144 | """Classes declared %run scripts must be instantiable afterwards. | |
145 |
|
145 | |||
146 | In [11]: run tclass foo |
|
146 | In [11]: run tclass foo | |
147 |
|
147 | |||
148 | In [12]: isinstance(f(),foo) |
|
148 | In [12]: isinstance(f(),foo) | |
149 | Out[12]: True |
|
149 | Out[12]: True | |
150 | """ |
|
150 | """ | |
151 |
|
151 | |||
152 |
|
152 | |||
153 | def doctest_run_ns2(): |
|
153 | def doctest_run_ns2(): | |
154 | """Classes declared %run scripts must be instantiable afterwards. |
|
154 | """Classes declared %run scripts must be instantiable afterwards. | |
155 |
|
155 | |||
156 | In [4]: run tclass C-first_pass |
|
156 | In [4]: run tclass C-first_pass | |
157 |
|
157 | |||
158 | In [5]: run tclass C-second_pass |
|
158 | In [5]: run tclass C-second_pass | |
159 | tclass.py: deleting object: C-first_pass |
|
159 | tclass.py: deleting object: C-first_pass | |
160 | """ |
|
160 | """ | |
161 |
|
161 | |||
162 | @dec.skip_win32 |
|
162 | @dec.skip_win32 | |
163 | def doctest_run_builtins(): |
|
163 | def doctest_run_builtins(): | |
164 | """Check that %run doesn't damage __builtins__ via a doctest. |
|
164 | """Check that %run doesn't damage __builtins__ via a doctest. | |
165 |
|
165 | |||
166 | This is similar to the test_run_builtins, but I want *both* forms of the |
|
166 | This is similar to the test_run_builtins, but I want *both* forms of the | |
167 | test to catch any possible glitches in our testing machinery, since that |
|
167 | test to catch any possible glitches in our testing machinery, since that | |
168 | modifies %run somewhat. So for this, we have both a normal test (below) |
|
168 | modifies %run somewhat. So for this, we have both a normal test (below) | |
169 | and a doctest (this one). |
|
169 | and a doctest (this one). | |
170 |
|
170 | |||
171 | In [1]: import tempfile |
|
171 | In [1]: import tempfile | |
172 |
|
172 | |||
173 | In [2]: bid1 = id(__builtins__) |
|
173 | In [2]: bid1 = id(__builtins__) | |
174 |
|
174 | |||
175 | In [3]: f = tempfile.NamedTemporaryFile() |
|
175 | In [3]: f = tempfile.NamedTemporaryFile() | |
176 |
|
176 | |||
177 | In [4]: f.write('pass\\n') |
|
177 | In [4]: f.write('pass\\n') | |
178 |
|
178 | |||
179 | In [5]: f.flush() |
|
179 | In [5]: f.flush() | |
180 |
|
180 | |||
181 | In [6]: print 'B1:',type(__builtins__) |
|
181 | In [6]: print 'B1:',type(__builtins__) | |
182 | B1: <type 'module'> |
|
182 | B1: <type 'module'> | |
183 |
|
183 | |||
184 | In [7]: %run $f.name |
|
184 | In [7]: %run $f.name | |
185 |
|
185 | |||
186 | In [8]: bid2 = id(__builtins__) |
|
186 | In [8]: bid2 = id(__builtins__) | |
187 |
|
187 | |||
188 | In [9]: print 'B2:',type(__builtins__) |
|
188 | In [9]: print 'B2:',type(__builtins__) | |
189 | B2: <type 'module'> |
|
189 | B2: <type 'module'> | |
190 |
|
190 | |||
191 | In [10]: bid1 == bid2 |
|
191 | In [10]: bid1 == bid2 | |
192 | Out[10]: True |
|
192 | Out[10]: True | |
193 | """ |
|
193 | """ | |
194 |
|
194 | |||
195 | # For some tests, it will be handy to organize them in a class with a common |
|
195 | # For some tests, it will be handy to organize them in a class with a common | |
196 | # setup that makes a temp file |
|
196 | # setup that makes a temp file | |
197 |
|
197 | |||
198 | class TestMagicRun(object): |
|
198 | class TestMagicRun(object): | |
199 |
|
199 | |||
200 | def setup(self): |
|
200 | def setup(self): | |
201 | """Make a valid python temp file.""" |
|
201 | """Make a valid python temp file.""" | |
202 | f = tempfile.NamedTemporaryFile() |
|
202 | f = tempfile.NamedTemporaryFile() | |
203 | f.write('pass\n') |
|
203 | f.write('pass\n') | |
204 | f.flush() |
|
204 | f.flush() | |
205 | self.tmpfile = f |
|
205 | self.tmpfile = f | |
206 |
|
206 | |||
207 | def run_tmpfile(self): |
|
207 | def run_tmpfile(self): | |
208 | # This fails on Windows if self.tmpfile.name has spaces or "~" in it. |
|
208 | # This fails on Windows if self.tmpfile.name has spaces or "~" in it. | |
209 | # See below and ticket https://bugs.launchpad.net/bugs/366353 |
|
209 | # See below and ticket https://bugs.launchpad.net/bugs/366353 | |
210 | _ip.magic('run %s' % self.tmpfile.name) |
|
210 | _ip.magic('run %s' % self.tmpfile.name) | |
211 |
|
211 | |||
212 | # See https://bugs.launchpad.net/bugs/366353 |
|
212 | # See https://bugs.launchpad.net/bugs/366353 | |
213 | @dec.skip_if_not_win32 |
|
213 | @dec.skip_if_not_win32 | |
214 | def test_run_tempfile_path(self): |
|
214 | def test_run_tempfile_path(self): | |
215 | tt.assert_equals(True,False,"%run doesn't work with tempfile paths on win32.") |
|
215 | tt.assert_equals(True,False,"%run doesn't work with tempfile paths on win32.") | |
216 |
|
216 | |||
217 | # See https://bugs.launchpad.net/bugs/366353 |
|
217 | # See https://bugs.launchpad.net/bugs/366353 | |
218 | @dec.skip_win32 |
|
218 | @dec.skip_win32 | |
219 | def test_builtins_id(self): |
|
219 | def test_builtins_id(self): | |
220 | """Check that %run doesn't damage __builtins__ """ |
|
220 | """Check that %run doesn't damage __builtins__ """ | |
221 |
|
221 | |||
222 | # Test that the id of __builtins__ is not modified by %run |
|
222 | # Test that the id of __builtins__ is not modified by %run | |
223 | bid1 = id(_ip.user_ns['__builtins__']) |
|
223 | bid1 = id(_ip.user_ns['__builtins__']) | |
224 | self.run_tmpfile() |
|
224 | self.run_tmpfile() | |
225 | bid2 = id(_ip.user_ns['__builtins__']) |
|
225 | bid2 = id(_ip.user_ns['__builtins__']) | |
226 | tt.assert_equals(bid1, bid2) |
|
226 | tt.assert_equals(bid1, bid2) | |
227 |
|
227 | |||
228 | # See https://bugs.launchpad.net/bugs/366353 |
|
228 | # See https://bugs.launchpad.net/bugs/366353 | |
229 | @dec.skip_win32 |
|
229 | @dec.skip_win32 | |
230 | def test_builtins_type(self): |
|
230 | def test_builtins_type(self): | |
231 | """Check that the type of __builtins__ doesn't change with %run. |
|
231 | """Check that the type of __builtins__ doesn't change with %run. | |
232 |
|
232 | |||
233 | However, the above could pass if __builtins__ was already modified to |
|
233 | However, the above could pass if __builtins__ was already modified to | |
234 | be a dict (it should be a module) by a previous use of %run. So we |
|
234 | be a dict (it should be a module) by a previous use of %run. So we | |
235 | also check explicitly that it really is a module: |
|
235 | also check explicitly that it really is a module: | |
236 | """ |
|
236 | """ | |
237 | self.run_tmpfile() |
|
237 | self.run_tmpfile() | |
238 | tt.assert_equals(type(_ip.user_ns['__builtins__']),type(sys)) |
|
238 | tt.assert_equals(type(_ip.user_ns['__builtins__']),type(sys)) | |
239 |
|
239 | |||
240 | # See https://bugs.launchpad.net/bugs/366353 |
|
240 | # See https://bugs.launchpad.net/bugs/366353 | |
241 | @dec.skip_win32 |
|
241 | @dec.skip_win32 | |
242 | def test_prompts(self): |
|
242 | def test_prompts(self): | |
243 | """Test that prompts correctly generate after %run""" |
|
243 | """Test that prompts correctly generate after %run""" | |
244 | self.run_tmpfile() |
|
244 | self.run_tmpfile() | |
245 | p2 = str(_ip.IP.outputcache.prompt2).strip() |
|
245 | p2 = str(_ip.IP.outputcache.prompt2).strip() | |
246 | nt.assert_equals(p2[:3], '...') |
|
246 | nt.assert_equals(p2[:3], '...') | |
247 |
|
247 | |||
248 | def teardown(self): |
|
248 | def teardown(self): | |
249 | self.tmpfile.close() |
|
249 | self.tmpfile.close() |
@@ -1,270 +1,263 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 purposes. | |
6 | The lack of organization make it very difficult for developers to work on IPython |
|
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 |
|
7 | and understand its design. This document contains notes about how we will reorganize | |
8 | the modules into sub-packages. |
|
8 | 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 | Prodecure | |
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 | Need to modify iptests to properly skip modules that are no longer top | |
83 | level modules. |
|
83 | level modules. | |
84 |
|
84 | |||
85 | Need to update the top level IPython/__init__.py file. |
|
85 | Need to update the top level IPython/__init__.py file. | |
86 |
|
86 | |||
87 | Where things will be moved |
|
87 | Where things will be moved | |
88 | ========================== |
|
88 | ========================== | |
89 |
|
89 | |||
|
90 | Top-level modules: | |||
|
91 | ||||
90 | * :file:`background_jobs.py`. Move to :file:`IPython/lib/backgroundjobs.py`. |
|
92 | * :file:`background_jobs.py`. Move to :file:`IPython/lib/backgroundjobs.py`. | |
91 |
|
93 | |||
92 | * :file:`ColorANSI.py`. Move to :file:`IPython/utils/coloransi.py`. |
|
94 | * :file:`ColorANSI.py`. Move to :file:`IPython/utils/coloransi.py`. | |
93 |
|
95 | |||
94 | * :file:`completer.py`. Move to :file:`IPython/core/completer.py`. |
|
96 | * :file:`completer.py`. Move to :file:`IPython/core/completer.py`. | |
95 |
|
97 | |||
96 | * :file:`ConfigLoader.py`. Move to :file:`IPython/config/configloader.py`. |
|
98 | * :file:`ConfigLoader.py`. Move to :file:`IPython/config/configloader.py`. | |
97 |
|
99 | |||
98 | * :file:`CrashHandler.py`. Move to :file:`IPython/core/crashhandler`. |
|
100 | * :file:`CrashHandler.py`. Move to :file:`IPython/core/crashhandler`. | |
99 |
|
101 | |||
100 | * :file:`Debugger.py`. Move to :file:`IPython/core/debugger.py`. |
|
102 | * :file:`Debugger.py`. Move to :file:`IPython/core/debugger.py`. | |
101 |
|
103 | |||
102 | * :file:`deep_reload.py`. Move to :file:`IPython/lib/deepreload.py`. |
|
104 | * :file:`deep_reload.py`. Move to :file:`IPython/lib/deepreload.py`. | |
103 |
|
105 | |||
104 | * :file:`demo.py`. Move to :file:`IPython/lib/demo.py`. |
|
106 | * :file:`demo.py`. Move to :file:`IPython/lib/demo.py`. | |
105 |
|
107 | |||
106 | * :file:`DPyGetOpt.py`. Move to :mod:`IPython.utils` and replace with newer options parser. |
|
108 | * :file:`DPyGetOpt.py`. Move to :mod:`IPython.utils` and replace with newer options parser. | |
107 |
|
109 | |||
108 | * :file:`dtutils.py`. Move to :file:`IPython.deathrow`. |
|
110 | * :file:`dtutils.py`. Move to :file:`IPython.deathrow`. | |
109 |
|
111 | |||
110 | * :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`. |
|
112 | * :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`. | |
111 | Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`? |
|
113 | Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`? | |
112 |
|
114 | |||
113 | * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`. |
|
115 | * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`. | |
114 |
|
116 | |||
115 | * :file:`generics.py`. Move to :file:`IPython.python`. |
|
117 | * :file:`generics.py`. Move to :file:`IPython.python`. | |
116 |
|
118 | |||
117 | * :file:`genutils.py`. Move to :file:`IPython.utils`. |
|
119 | * :file:`genutils.py`. Move to :file:`IPython.utils`. | |
118 |
|
120 | |||
119 | * :file:`Gnuplot2.py`. Move to :file:`IPython.sandbox`. |
|
121 | * :file:`Gnuplot2.py`. Move to :file:`IPython.sandbox`. | |
120 |
|
122 | |||
121 | * :file:`GnuplotInteractive.py`. Move to :file:`IPython.sandbox`. |
|
123 | * :file:`GnuplotInteractive.py`. Move to :file:`IPython.sandbox`. | |
122 |
|
124 | |||
123 | * :file:`GnuplotRuntime.py`. Move to :file:`IPython.sandbox`. |
|
125 | * :file:`GnuplotRuntime.py`. Move to :file:`IPython.sandbox`. | |
124 |
|
126 | |||
125 | * :file:`numutils.py`. Move to :file:`IPython.sandbox`. |
|
127 | * :file:`numutils.py`. Move to :file:`IPython.sandbox`. | |
126 |
|
128 | |||
127 | * :file:`twshell.py`. Move to :file:`IPython.sandbox`. |
|
129 | * :file:`twshell.py`. Move to :file:`IPython.sandbox`. | |
128 |
|
130 | |||
129 | * :file:`Extensions`. This needs to be gone through separately. Minimally, |
|
131 | * :file:`Extensions`. This needs to be gone through separately. Minimally, | |
130 | the package should be renamed to :file:`extensions`. |
|
132 | the package should be renamed to :file:`extensions`. | |
131 |
|
133 | |||
132 | * :file:`history.py`. Move to :file:`IPython.core`. |
|
134 | * :file:`history.py`. Move to :file:`IPython.core`. | |
133 |
|
135 | |||
134 | * :file:`hooks.py`. Move to :file:`IPython.core`. |
|
136 | * :file:`hooks.py`. Move to :file:`IPython.core`. | |
135 |
|
137 | |||
136 | * :file:`ipapi.py`. Move to :file:`IPython.core`. |
|
138 | * :file:`ipapi.py`. Move to :file:`IPython.core`. | |
137 |
|
139 | |||
138 | * :file:`iplib.py`. Move to :file:`IPython.core`. |
|
140 | * :file:`iplib.py`. Move to :file:`IPython.core`. | |
139 |
|
141 | |||
140 | * :file:`ipmaker.py`: Move to :file:`IPython.core`. |
|
142 | * :file:`ipmaker.py`: Move to :file:`IPython.core`. | |
141 |
|
143 | |||
142 | * :file:`ipstruct.py`. Move to :file:`IPython.python`. |
|
144 | * :file:`ipstruct.py`. Move to :file:`IPython.python`. | |
143 |
|
145 | |||
144 | * :file:`irunner.py`. Move to :file:`IPython.scripts`. ??? |
|
146 | * :file:`irunner.py`. Move to :file:`IPython.scripts`. ??? | |
145 |
|
147 | |||
146 | * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in |
|
148 | * :file:`Itpl.py`. Move to :file:`deathrow/Itpl.py`. Copy already in | |
147 | :file:`IPython.external`. |
|
149 | :file:`IPython.external`. | |
148 |
|
150 | |||
149 | * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`. |
|
151 | * :file:`Logger.py`. Move to :file:`IPython/core/logger.py`. | |
150 |
|
152 | |||
151 | * :file:`macro.py`. Move to :file:`IPython.core`. |
|
153 | * :file:`macro.py`. Move to :file:`IPython.core`. | |
152 |
|
154 | |||
153 | * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`. |
|
155 | * :file:`Magic.py`. Move to :file:`IPython/core/magic.py`. | |
154 |
|
156 | |||
155 | * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`. |
|
157 | * :file:`OInspect.py`. Move to :file:`IPython/core/oinspect.py`. | |
156 |
|
158 | |||
157 | * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`. |
|
159 | * :file:`OutputTrap.py`. Move to :file:`IPython/core/outputtrap.py`. | |
158 |
|
160 | |||
159 | * :file:`platutils.py`. Move to :file:`IPython.python`. |
|
161 | * :file:`platutils.py`. Move to :file:`IPython.python`. | |
160 |
|
162 | |||
161 | * :file:`platutils_dummy.py`. Move to :file:`IPython.python`. |
|
163 | * :file:`platutils_dummy.py`. Move to :file:`IPython.python`. | |
162 |
|
164 | |||
163 | * :file:`platutils_posix.py`. Move to :file:`IPython.python`. |
|
165 | * :file:`platutils_posix.py`. Move to :file:`IPython.python`. | |
164 |
|
166 | |||
165 | * :file:`platutils_win32.py`. Move to :file:`IPython.python`. |
|
167 | * :file:`platutils_win32.py`. Move to :file:`IPython.python`. | |
166 |
|
168 | |||
167 | * :file:`prefilter.py`: Move to :file:`IPython.core`. |
|
169 | * :file:`prefilter.py`: Move to :file:`IPython.core`. | |
168 |
|
170 | |||
169 | * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or |
|
171 | * :file:`Prompts.py`. Move to :file:`IPython/core/prompts.py` or | |
170 | :file:`IPython/frontend/prompts.py`. |
|
172 | :file:`IPython/frontend/prompts.py`. | |
171 |
|
173 | |||
172 | * :file:`PyColorize.py`. Replace with pygments? If not, move to |
|
174 | * :file:`PyColorize.py`. Replace with pygments? If not, move to | |
173 | :file:`IPython/core/pycolorize.py`. Maybe move to :mod:`IPython.lib` or |
|
175 | :file:`IPython/core/pycolorize.py`. Maybe move to :mod:`IPython.lib` or | |
174 | :mod:`IPython.python`? |
|
176 | :mod:`IPython.python`? | |
175 |
|
177 | |||
176 | * :file:`Release.py`. Move to ??? or remove? |
|
178 | * :file:`Release.py`. Move to ??? or remove? | |
177 |
|
179 | |||
178 | * :file:`rlineimpl.py`. Move to :file:`IPython.core`. |
|
180 | * :file:`rlineimpl.py`. Move to :file:`IPython.core`. | |
179 |
|
181 | |||
180 | * :file:`shadowns.py`. Move to :file:`IPython.core`. |
|
182 | * :file:`shadowns.py`. Move to :file:`IPython.core`. | |
181 |
|
183 | |||
182 | * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or |
|
184 | * :file:`Shell.py`. Move to :file:`IPython.core.shell.py` or | |
183 | :file:`IPython/frontend/shell.py`. |
|
185 | :file:`IPython/frontend/shell.py`. | |
184 |
|
186 | |||
185 | * :file:`shellglobals.py`. Move to :file:`IPython.core`. |
|
187 | * :file:`shellglobals.py`. Move to :file:`IPython.core`. | |
186 |
|
188 | |||
187 | * :file:`strdispatch.py`. Move to :file:`IPython.python`. |
|
189 | * :file:`strdispatch.py`. Move to :file:`IPython.python`. | |
188 |
|
190 | |||
|
191 | * :file:`twshell.py`. Move to :file:`IPython.sandbox`. | |||
|
192 | ||||
|
193 | * :file:`ultraTB.py`. Move to :file:`IPython/core/ultratb.py`. | |||
|
194 | ||||
|
195 | * :file:`upgrade_dir.py`. Move to :file:`IPython/utils/upgradedir.py`. | |||
|
196 | ||||
|
197 | * :file:`usage.py`. Move to :file:`IPython.core`. | |||
|
198 | ||||
|
199 | * :file:`wildcard.py`. Move to :file:`IPython.utils`. | |||
|
200 | ||||
|
201 | * :file:`winconsole.py`. Move to :file:`IPython.utils`. | |||
|
202 | ||||
|
203 | Top-level sub-packages: | |||
|
204 | ||||
189 | * :file:`testing`. Good where it is. |
|
205 | * :file:`testing`. Good where it is. | |
190 |
|
206 | |||
191 | * :file:`tests`. Good where it is. |
|
207 | * :file:`tests`. Good where it is. | |
192 |
|
208 | |||
193 | * :file:`tools`. Things in here need to be looked at and moved elsewhere like |
|
209 | * :file:`tools`. Things in here need to be looked at and moved elsewhere like | |
194 |
:file:`IPython. |
|
210 | :file:`IPython.utils`. | |
195 |
|
211 | |||
196 | * :file:`UserConfig`. Move to a subdirectory of :file:`IPython.config`. |
|
212 | * :file:`UserConfig`. Move to a subdirectory of :file:`IPython.config`. | |
197 |
|
213 | |||
198 |
|
||||
199 |
|
||||
200 |
|
||||
201 | * :file:`config`. Good where it is! |
|
214 | * :file:`config`. Good where it is! | |
202 |
|
215 | |||
203 | * :file:`external`. Good where it is! |
|
216 | * :file:`external`. Good where it is! | |
204 |
|
217 | |||
205 | * :file:`frontend`. Good where it is! |
|
218 | * :file:`frontend`. Good where it is! | |
206 |
|
219 | |||
207 |
|
220 | |||
208 |
|
221 | |||
209 | * :file:`gui`. Eventually this should be moved to a subdir of |
|
222 | * :file:`gui`. Eventually this should be moved to a subdir of | |
210 | :file:`IPython.frontend`. |
|
223 | :file:`IPython.frontend`. | |
211 |
|
224 | |||
212 |
|
||||
213 |
|
||||
214 |
|
||||
215 |
|
||||
216 |
|
||||
217 |
|
||||
218 |
|
||||
219 |
|
||||
220 |
|
||||
221 |
|
||||
222 | * :file:`kernel`. Good where it is. |
|
225 | * :file:`kernel`. Good where it is. | |
223 |
|
226 | |||
224 |
|
227 | |||
225 |
|
228 | |||
226 |
|
229 | |||
227 |
|
230 | |||
228 |
|
231 | |||
229 |
|
232 | |||
230 |
|
233 | |||
231 |
|
234 | |||
232 |
|
235 | |||
233 |
|
236 | |||
234 |
|
237 | |||
235 |
|
238 | |||
236 |
|
239 | |||
237 |
|
240 | |||
238 | * :file:`twshell.py`. Move to :file:`IPython.sandbox`. |
|
|||
239 |
|
||||
240 | * :file:`ultraTB.py`. Move to :file:`IPython/core/ultratb.py`. |
|
|||
241 |
|
||||
242 | * :file:`upgrade_dir.py`. Move to :file:`IPython/utils/upgradedir.py`. |
|
|||
243 |
|
||||
244 | * :file:`usage.py`. Move to :file:`IPython.core`. |
|
|||
245 |
|
||||
246 | * :file:`wildcard.py`. Move to :file:`IPython.utils`. |
|
|||
247 |
|
241 | |||
248 | * :file:`winconsole.py`. Move to :file:`IPython.lib`. |
|
|||
249 |
|
242 | |||
250 | Other things |
|
243 | Other things | |
251 | ============ |
|
244 | ============ | |
252 |
|
245 | |||
253 | When these files are moved around, a number of other things will happen at the same time: |
|
246 | When these files are moved around, a number of other things will happen at the same time: | |
254 |
|
247 | |||
255 | 1. Test files will be created for each module in IPython. Minimally, all |
|
248 | 1. Test files will be created for each module in IPython. Minimally, all | |
256 | modules will be imported as a part of the test. This will serve as a |
|
249 | modules will be imported as a part of the test. This will serve as a | |
257 | test of the module reorganization. These tests will be put into new |
|
250 | test of the module reorganization. These tests will be put into new | |
258 | :file:`tests` subdirectories that each package will have. |
|
251 | :file:`tests` subdirectories that each package will have. | |
259 |
|
252 | |||
260 | 2. PyFlakes and other code checkers will be run to look for problems. |
|
253 | 2. PyFlakes and other code checkers will be run to look for problems. | |
261 |
|
254 | |||
262 | 3. Modules will be renamed to comply with PEP 8 naming conventions: all |
|
255 | 3. Modules will be renamed to comply with PEP 8 naming conventions: all | |
263 | lowercase and no special characters like ``-`` or ``_``. |
|
256 | lowercase and no special characters like ``-`` or ``_``. | |
264 |
|
257 | |||
265 | 4. Existing tests will be moved to the appropriate :file:`tests` |
|
258 | 4. Existing tests will be moved to the appropriate :file:`tests` | |
266 | subdirectories. |
|
259 | subdirectories. | |
267 |
|
260 | |||
268 |
|
261 | |||
269 |
|
262 | |||
270 |
|
263 |
General Comments 0
You need to be logged in to leave comments.
Login now