Show More
@@ -1,446 +1,549 b'' | |||||
1 | .. _development: |
|
1 | .. _development: | |
2 |
|
2 | |||
3 | ============================== |
|
3 | ============================== | |
4 | IPython development guidelines |
|
4 | IPython development guidelines | |
5 | ============================== |
|
5 | ============================== | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | Overview |
|
8 | Overview | |
9 | ======== |
|
9 | ======== | |
10 |
|
10 | |||
11 | IPython is the next generation of IPython. It is named such for two reasons: |
|
11 | Currently, IPython's development tree contains all of the code that used to be | |
12 |
|
12 | part of IPython since the project's inception in 2001, plus all of the effort | ||
13 | - Eventually, IPython will become IPython version 1.0. |
|
13 | that was known for a while (roughly 2004-2008) as `IPython1'. The IPyhton1 | |
14 | - This new code base needs to be able to co-exist with the existing IPython until |
|
14 | development was meant to be an effort to: | |
15 | it is a full replacement for it. Thus we needed a different name. We couldn't |
|
|||
16 | use ``ipython`` (lowercase) as some files systems are case insensitive. |
|
|||
17 |
|
||||
18 | There are two, no three, main goals of the IPython effort: |
|
|||
19 |
|
15 | |||
20 | 1. Clean up the existing codebase and write lots of tests. |
|
16 | 1. Clean up the existing codebase and write lots of tests. | |
21 | 2. Separate the core functionality of IPython from the terminal to enable IPython |
|
17 | ||
22 | to be used from within a variety of GUI applications. |
|
18 | 2. Separate the core functionality of IPython from the terminal to enable | |
|
19 | IPython to be used from within a variety of GUI applications. | |||
|
20 | ||||
23 | 3. Implement a system for interactive parallel computing. |
|
21 | 3. Implement a system for interactive parallel computing. | |
24 |
|
22 | |||
25 | While the third goal may seem a bit unrelated to the main focus of IPython, it |
|
23 | While the third goal may seem a bit unrelated to the main focus of IPython, it | |
26 | turns out that the technologies required for this goal are nearly identical |
|
24 | turns out that the technologies required for this goal are nearly identical | |
27 | with those required for goal two. This is the main reason the interactive |
|
25 | with those required for goal two. This is the main reason the interactive | |
28 | parallel computing capabilities are being put into IPython proper. Currently |
|
26 | parallel computing capabilities are being put into IPython proper. Currently | |
29 | the third of these goals is furthest along. |
|
27 | the third of these goals is furthest along. | |
30 |
|
28 | |||
31 | This document describes IPython from the perspective of developers. |
|
29 | This document describes IPython from the perspective of developers. | |
32 |
|
30 | |||
33 |
|
31 | |||
34 | Project organization |
|
32 | Project organization | |
35 | ==================== |
|
33 | ==================== | |
36 |
|
34 | |||
37 | Subpackages |
|
35 | Subpackages | |
38 | ----------- |
|
36 | ----------- | |
39 |
|
37 | |||
40 | IPython is organized into semi self-contained subpackages. Each of the |
|
38 | IPython is organized into semi self-contained subpackages. Each of the | |
41 | subpackages will have its own: |
|
39 | subpackages will have its own: | |
42 |
|
40 | |||
43 | - **Dependencies**. One of the most important things to keep in mind in |
|
41 | - **Dependencies**. One of the most important things to keep in mind in | |
44 | partitioning code amongst subpackages, is that they should be used to cleanly |
|
42 | partitioning code amongst subpackages, is that they should be used to cleanly | |
45 | encapsulate dependencies. |
|
43 | encapsulate dependencies. | |
46 |
|
44 | |||
47 | - **Tests**. Each subpackage shoud have its own ``tests`` subdirectory that |
|
45 | - **Tests**. Each subpackage shoud have its own ``tests`` subdirectory that | |
48 | contains all of the tests for that package. For information about writing |
|
46 | contains all of the tests for that package. For information about writing | |
49 | tests for IPython, see the `Testing System`_ section of this document. |
|
47 | tests for IPython, see the `Testing System`_ section of this document. | |
50 |
|
48 | |||
51 | - **Configuration**. Each subpackage should have its own ``config`` |
|
49 | - **Configuration**. Each subpackage should have its own ``config`` | |
52 | subdirectory that contains the configuration information for the components |
|
50 | subdirectory that contains the configuration information for the components | |
53 | of the subpackage. For information about how the IPython configuration |
|
51 | of the subpackage. For information about how the IPython configuration | |
54 | system works, see the `Configuration System`_ section of this document. |
|
52 | system works, see the `Configuration System`_ section of this document. | |
55 |
|
53 | |||
56 | - **Scripts**. Each subpackage should have its own ``scripts`` subdirectory |
|
54 | - **Scripts**. Each subpackage should have its own ``scripts`` subdirectory | |
57 | that contains all of the command line scripts associated with the subpackage. |
|
55 | that contains all of the command line scripts associated with the subpackage. | |
58 |
|
56 | |||
|
57 | ||||
59 | Installation and dependencies |
|
58 | Installation and dependencies | |
60 | ----------------------------- |
|
59 | ----------------------------- | |
61 |
|
60 | |||
62 | IPython will not use `setuptools`_ for installation. Instead, we will use |
|
61 | IPython will not use `setuptools`_ for installation. Instead, we will use | |
63 | standard ``setup.py`` scripts that use `distutils`_. While there are a number a |
|
62 | standard ``setup.py`` scripts that use `distutils`_. While there are a number a | |
64 | extremely nice features that `setuptools`_ has (like namespace packages), the |
|
63 | extremely nice features that `setuptools`_ has (like namespace packages), the | |
65 | current implementation of `setuptools`_ has performance problems, particularly |
|
64 | current implementation of `setuptools`_ has performance problems, particularly | |
66 | on shared file systems. In particular, when Python packages are installed on |
|
65 | on shared file systems. In particular, when Python packages are installed on | |
67 | NSF file systems, import times become much too long (up towards 10 seconds). |
|
66 | NSF file systems, import times become much too long (up towards 10 seconds). | |
68 |
|
67 | |||
69 | Because IPython is being used extensively in the context of high performance |
|
68 | Because IPython is being used extensively in the context of high performance | |
70 | computing, where performance is critical but shared file systems are common, we |
|
69 | computing, where performance is critical but shared file systems are common, we | |
71 | feel these performance hits are not acceptable. Thus, until the performance |
|
70 | feel these performance hits are not acceptable. Thus, until the performance | |
72 | problems associated with `setuptools`_ are addressed, we will stick with plain |
|
71 | problems associated with `setuptools`_ are addressed, we will stick with plain | |
73 | `distutils`_. We are hopeful that these problems will be addressed and that we |
|
72 | `distutils`_. We are hopeful that these problems will be addressed and that we | |
74 | will eventually begin using `setuptools`_. Because of this, we are trying to |
|
73 | will eventually begin using `setuptools`_. Because of this, we are trying to | |
75 | organize IPython in a way that will make the eventual transition to |
|
74 | organize IPython in a way that will make the eventual transition to | |
76 | `setuptools`_ as painless as possible. |
|
75 | `setuptools`_ as painless as possible. | |
77 |
|
76 | |||
78 | Because we will be using `distutils`_, there will be no method for |
|
77 | Because we will be using `distutils`_, there will be no method for | |
79 | automatically installing dependencies. Instead, we are following the approach |
|
78 | automatically installing dependencies. Instead, we are following the approach | |
80 | of `Matplotlib`_ which can be summarized as follows: |
|
79 | of `Matplotlib`_ which can be summarized as follows: | |
81 |
|
80 | |||
82 | - Distinguish between required and optional dependencies. However, the required |
|
81 | - Distinguish between required and optional dependencies. However, the required | |
83 | dependencies for IPython should be only the Python standard library. |
|
82 | dependencies for IPython should be only the Python standard library. | |
84 |
|
83 | |||
85 | - Upon installation check to see which optional dependencies are present and |
|
84 | - Upon installation check to see which optional dependencies are present and | |
86 | tell the user which parts of IPython need which optional dependencies. |
|
85 | tell the user which parts of IPython need which optional dependencies. | |
87 |
|
86 | |||
88 | It is absolutely critical that each subpackage of IPython has a clearly |
|
87 | It is absolutely critical that each subpackage of IPython has a clearly | |
89 | specified set of dependencies and that dependencies are not carelessly |
|
88 | specified set of dependencies and that dependencies are not carelessly | |
90 | inherited from other IPython subpackages. Furthermore, tests that have certain |
|
89 | inherited from other IPython subpackages. Furthermore, tests that have certain | |
91 | dependencies should not fail if those dependencies are not present. Instead |
|
90 | dependencies should not fail if those dependencies are not present. Instead | |
92 | they should be skipped and print a message. |
|
91 | they should be skipped and print a message. | |
93 |
|
92 | |||
94 | .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools |
|
93 | .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools | |
95 | .. _distutils: http://docs.python.org/lib/module-distutils.html |
|
94 | .. _distutils: http://docs.python.org/lib/module-distutils.html | |
96 | .. _Matplotlib: http://matplotlib.sourceforge.net/ |
|
95 | .. _Matplotlib: http://matplotlib.sourceforge.net/ | |
97 |
|
96 | |||
98 | Specific subpackages |
|
97 | Specific subpackages | |
99 | -------------------- |
|
98 | -------------------- | |
100 |
|
99 | |||
101 | ``core`` |
|
100 | ``core`` | |
102 | This is the core functionality of IPython that is independent of the |
|
101 | This is the core functionality of IPython that is independent of the | |
103 | terminal, network and GUIs. Most of the code that is in the current |
|
102 | terminal, network and GUIs. Most of the code that is in the current | |
104 | IPython trunk will be refactored, cleaned up and moved here. |
|
103 | IPython trunk will be refactored, cleaned up and moved here. | |
105 |
|
104 | |||
106 | ``kernel`` |
|
105 | ``kernel`` | |
107 | The enables the IPython core to be expose to a the network. This is |
|
106 | The enables the IPython core to be expose to a the network. This is | |
108 | also where all of the parallel computing capabilities are to be found. |
|
107 | also where all of the parallel computing capabilities are to be found. | |
109 |
|
108 | |||
110 | ``config`` |
|
109 | ``config`` | |
111 | The configuration package used by IPython. |
|
110 | The configuration package used by IPython. | |
112 |
|
111 | |||
113 | ``frontends`` |
|
112 | ``frontends`` | |
114 | The various frontends for IPython. A frontend is the end-user application |
|
113 | The various frontends for IPython. A frontend is the end-user application | |
115 | that exposes the capabilities of IPython to the user. The most basic |
|
114 | that exposes the capabilities of IPython to the user. The most basic | |
116 | frontend will simply be a terminal based application that looks just like |
|
115 | frontend will simply be a terminal based application that looks just like | |
117 | today 's IPython. Other frontends will likely be more powerful and based |
|
116 | today 's IPython. Other frontends will likely be more powerful and based | |
118 | on GUI toolkits. |
|
117 | on GUI toolkits. | |
119 |
|
118 | |||
120 | ``notebook`` |
|
119 | ``notebook`` | |
121 | An application that allows users to work with IPython notebooks. |
|
120 | An application that allows users to work with IPython notebooks. | |
122 |
|
121 | |||
123 | ``tools`` |
|
122 | ``tools`` | |
124 | This is where general utilities go. |
|
123 | This is where general utilities go. | |
125 |
|
124 | |||
126 |
|
125 | |||
127 | Version control |
|
126 | Version control | |
128 | =============== |
|
127 | =============== | |
129 |
|
128 | |||
130 | In the past, IPython development has been done using `Subversion`__. Recently, |
|
129 | All IPython development today is done using the `Bazaar`__ system for | |
131 | we made the transition to using `Bazaar`__ and `Launchpad`__. This makes it |
|
130 | distributed version control and the `Launchpad`__ site for code hosting and bug | |
132 | much easier for people to contribute code to IPython. Here is a sketch of how |
|
131 | tracking. This makes it very easy for anyone to contribute code to IPython. | |
133 | to use Bazaar for IPython development. First, you should install Bazaar. |
|
|||
134 | After you have done that, make sure that it is working by getting the latest |
|
|||
135 | main branch of IPython:: |
|
|||
136 |
|
132 | |||
137 | $ bzr branch lp:ipython |
|
133 | .. __: http://bazaar-vcs.org | |
|
134 | .. __: http://launchpad.net/ipython | |||
138 |
|
135 | |||
139 | Now you can create a new branch for you to do your work in:: |
|
136 | If you are interested in contributing to IPython, you should familiarize a bit | |
|
137 | with how to use bazaar, but this document gives you a concise set of steps to | |||
|
138 | get started. If you are going to become heavily involved with creating code | |||
|
139 | for IPython you'll eventually want to have a Launchpad account (free) so you | |||
|
140 | can publish your own code on the site for review and merging, but small | |||
|
141 | contributions can be simply sent via email to the IPython list as patches. | |||
140 |
|
142 | |||
141 | $ bzr branch ipython ipython-mybranch |
|
143 | Start by creating what Bazaar calls a `shared repository`_: | |
142 |
|
144 | |||
143 | The typical work cycle in this branch will be to make changes in |
|
145 | .. sourcecode:: bash | |
144 | ``ipython-mybranch`` and then commit those changes using the commit command:: |
|
|||
145 |
|
146 | |||
146 | $ ...do work in ipython-mybranch... |
|
147 | # You can choose any name you want instead of "ipython-repo" | |
147 | $ bzr ci -m "the commit message goes here" |
|
148 | bzr init-repo ipython-repo | |
148 |
|
149 | |||
149 | Please note that since we now don't use an old-style linear ChangeLog (that |
|
150 | .. _shared repository: http://bazaar-vcs.org/SharedRepositoryTutorial | |
150 | tends to cause problems with distributed version control systems), you should |
|
|||
151 | ensure that your log messages are reasonably detailed. Use a docstring-like |
|
|||
152 | approach in the commit messages (including the second line being left |
|
|||
153 | *blank*):: |
|
|||
154 |
|
151 | |||
155 | Single line summary of changes being committed. |
|
152 | This creates an empty repository where a lot of related branches can be kept, | |
|
153 | and they all reuse common storage. This way, many operations are very fast and | |||
|
154 | take up less space. Now, go to the newly created repository and make a local | |||
|
155 | branch of the public trunk: | |||
156 |
|
156 | |||
157 | - more details when warranted ... |
|
157 | .. sourcecode:: bash | |
158 | - including crediting outside contributors if they sent the |
|
|||
159 | code/bug/idea! |
|
|||
160 |
|
158 | |||
161 | If we couple this with a policy of making single commits for each reasonably |
|
159 | cd ipython-repo | |
162 | atomic change, the bzr log should give an excellent view of the project, and |
|
160 | # This makes a local copy of the public trunk called "trunk-lp" | |
163 | the `--short` log option becomes a nice summary. |
|
161 | bzr branch lp:ipython trunk-lp | |
|
162 | ||||
|
163 | The ``trunk-lp`` branch is meant to always be a pristine copy of the public | |||
|
164 | trunk. From here, make a personal development copy of the public trunk, where | |||
|
165 | you'll make your changes: | |||
|
166 | ||||
|
167 | .. sourcecode:: bash | |||
164 |
|
168 | |||
165 | While working with this branch, it is a good idea to merge in changes that have |
|
169 | bzr branch trunk-lp trunk-dev | |
166 | been made upstream in the parent branch. This can be done by doing:: |
|
|||
167 |
|
170 | |||
168 | $ bzr pull |
|
171 | Now, your working area looks like this:: | |
169 |
|
172 | |||
170 | If this command shows that the branches have diverged, then you should do a |
|
173 | maqroll[ipython-repo]> ls -a | |
171 | merge instead:: |
|
174 | ./ ../ .bzr/ trunk-dev/ trunk-lp/ | |
|
175 | ||||
|
176 | The ``.bzr`` directory is the Bazaar storage area, and you now have both the | |||
|
177 | reference copy of the public trunk and one working copy for your own | |||
|
178 | development. You can later make further branches as needed (a common workflow | |||
|
179 | is to make branches to contain specific feature implementations until they are | |||
|
180 | ready to be merged). | |||
|
181 | ||||
|
182 | The typical work cycle will be to make changes in ``trunk-dev`` and then commit | |||
|
183 | those changes as often as needed: | |||
172 |
|
184 | |||
173 | $ bzr merge lp:ipython |
|
185 | .. sourcecode:: bash | |
174 |
|
186 | |||
175 | If you want others to be able to see your branch, you can create an account |
|
187 | cd trunk-dev | |
176 | with launchpad and push the branch to your own workspace:: |
|
188 | # ... implement cool new feature... | |
|
189 | bzr commit -m "Commit message goes here." | |||
177 |
|
190 | |||
178 | $ bzr push bzr+ssh://<me>@bazaar.launchpad.net/~<me>/+junk/ipython-mybranch |
|
191 | Please note that since we now don't use an old-style linear ChangeLog (that | |
|
192 | tends to cause problems with distributed version control systems), you should | |||
|
193 | ensure that your log messages are reasonably detailed. For non-trivial | |||
|
194 | changes, use a docstring-like approach in the commit messages (including the | |||
|
195 | second line being left *blank*). Type ``bzr commit`` *without* the ``-m`` | |||
|
196 | switch, and Bazaar will open an editor where you can type a more detailed | |||
|
197 | message:: | |||
179 |
|
198 | |||
180 | Finally, once the work in your branch is done, you can merge your changes back |
|
199 | Single line summary of changes being committed. | |
181 | into the `ipython` branch by using merge:: |
|
|||
182 |
|
200 | |||
183 | $ cd ipython |
|
201 | - more details when warranted ... | |
184 | $ merge ../ipython-mybranch |
|
202 | - including crediting outside contributors if they sent the | |
185 | [resolve any conflicts] |
|
203 | code/bug/idea! | |
186 | $ bzr ci -m "Fixing that bug" |
|
|||
187 | $ bzr push |
|
|||
188 |
|
204 | |||
189 | But this will require you to have write permissions to the `ipython` branch. |
|
205 | If we couple this with a policy of making single commits for each reasonably | |
190 | It you don't you can tell one of the IPython devs about your branch and they |
|
206 | atomic change, the bzr log should give an excellent view of the project, and | |
191 | can do the merge for you. |
|
207 | the ``--short`` log option becomes a nice summary. | |
192 |
|
208 | |||
193 | More information about Bazaar workflows can be found `here`__. |
|
209 | As you work on the branch, it's a good idea to frequently keep your copy of the | |
|
210 | trunk updated with respect to Launchpad. This is done via: | |||
194 |
|
211 | |||
195 | .. __: http://subversion.tigris.org/ |
|
212 | .. sourcecode:: bash | |
196 | .. __: http://bazaar-vcs.org/ |
|
|||
197 | .. __: http://www.launchpad.net/ipython |
|
|||
198 | .. __: http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html |
|
|||
199 |
|
213 | |||
200 | Documentation |
|
214 | cd trunk-lp | |
201 | ============= |
|
215 | bzr pull | |
202 |
|
216 | |||
203 | Standalone documentation |
|
217 | Bazaar can then merge any changes that were done to the public trunk into your | |
204 | ------------------------ |
|
218 | local branch via: | |
205 |
|
219 | |||
206 | All standalone documentation should be written in plain text (``.txt``) files |
|
220 | .. sourcecode:: bash | |
207 | using `reStructuredText`_ for markup and formatting. All such documentation |
|
|||
208 | should be placed in the top level directory ``docs`` of the IPython source |
|
|||
209 | tree. Or, when appropriate, a suitably named subdirectory should be used. The |
|
|||
210 | documentation in this location will serve as the main source for IPython |
|
|||
211 | documentation and all existing documentation should be converted to this |
|
|||
212 | format. |
|
|||
213 |
|
221 | |||
214 | In the future, the text files in the ``docs`` directory will be used to |
|
222 | cd trunk-dev | |
215 | generate all forms of documentation for IPython. This include documentation on |
|
223 | bzr merge ../trunk-lp | |
216 | the IPython website as well as *pdf* documentation. |
|
224 | bzr commit -m"Merged upstream changes" | |
217 |
|
225 | |||
218 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html |
|
226 | This workflow ensures that a local copy stays in sync with the public trunk, | |
|
227 | while allowing for local development to be pushed back for public review. | |||
219 |
|
228 | |||
220 | Docstring format |
|
229 | Once your changes are ready for review, you can push them to Launchpad where | |
221 | ---------------- |
|
230 | the IPython team can review them and give you feedback. The first time, use: | |
222 |
|
231 | |||
223 | Good docstrings are very important. All new code will use `Epydoc`_ for |
|
232 | .. sourcecode:: bash | |
224 | generating API docs, so we will follow the `Epydoc`_ conventions. More |
|
|||
225 | specifically, we will use `reStructuredText`_ for markup and formatting, since |
|
|||
226 | it is understood by a wide variety of tools. This means that if in the future |
|
|||
227 | we have any reason to change from `Epydoc`_ to something else, we'll have fewer |
|
|||
228 | transition pains. |
|
|||
229 |
|
233 | |||
230 | Details about using `reStructuredText`_ for docstrings can be found `here |
|
234 | bzr push --remember bzr+ssh://<you>@bazaar.launchpad.net/~<you>/ipython/trunk-dev | |
231 | <http://epydoc.sourceforge.net/manual-othermarkup.html>`_. |
|
|||
232 |
|
235 | |||
233 | .. _Epydoc: http://epydoc.sourceforge.net/ |
|
236 | where ``<you>`` is your Launchpad user name. This will make this branch | |
|
237 | publicly visible to all. In subsequent uses you can simply run in the branch: | |||
234 |
|
238 | |||
235 | Additional PEPs of interest regarding documentation of code: |
|
239 | .. sourcecode:: bash | |
236 |
|
240 | |||
237 | - `Docstring Conventions <http://www.python.org/peps/pep-0257.html>`_ |
|
241 | bzr push | |
238 | - `Docstring Processing System Framework <http://www.python.org/peps/pep-0256.html>`_ |
|
242 | ||
239 | - `Docutils Design Specification <http://www.python.org/peps/pep-0258.html>`_ |
|
243 | .. note:: | |
|
244 | ||||
|
245 | Before you can push your code to Launchpad, you need to configure your SSH | |||
|
246 | keys. You can do this by clicking on ``Change details`` for your profile | |||
|
247 | and then clicking on the ``SSH Keys`` tab. This should take you to a URL | |||
|
248 | of the form ``https://launchpad.net/~<you>/+editsshkeys`` with instructions | |||
|
249 | on how to upload your keys. | |||
|
250 | ||||
|
251 | Once the branch is publicly visible, using the launchpad interface it can be | |||
|
252 | marked for merging with the link ``Propose for merging into another branch``, | |||
|
253 | leaving the default choice of trunk as its target. This way, Launchpad tracks | |||
|
254 | what changes of this branch are new with respect to the trunk, others in the | |||
|
255 | team can review it, and merge the changes into the trunk. | |||
|
256 | ||||
|
257 | The IPython team has a policy of reviewing all code (both from core members of | |||
|
258 | the team and from external contributors) before merging it. Code should be | |||
|
259 | clearly documented (as explained further in this guide), clear and well tested. | |||
|
260 | We will be happy to provide you with feedback for your code to be a great | |||
|
261 | contribution to the project, and we've found that peer review of code is an | |||
|
262 | excellent way to improve the quality of everyone's work. | |||
240 |
|
263 | |||
241 |
|
264 | |||
242 | Coding conventions |
|
265 | Coding conventions | |
243 | ================== |
|
266 | ================== | |
244 |
|
267 | |||
245 | General |
|
268 | General | |
246 | ------- |
|
269 | ------- | |
247 |
|
270 | |||
248 | In general, we'll try to follow the standard Python style conventions as |
|
271 | In general, we'll try to follow the standard Python style conventions as | |
249 | described here: |
|
272 | described here: | |
250 |
|
273 | |||
251 | - `Style Guide for Python Code <http://www.python.org/peps/pep-0008.html>`_ |
|
274 | - `Style Guide for Python Code <http://www.python.org/peps/pep-0008.html>`_ | |
252 |
|
275 | |||
253 |
|
276 | |||
254 | Other comments: |
|
277 | Other comments: | |
255 |
|
278 | |||
256 | - In a large file, top level classes and functions should be |
|
279 | - In a large file, top level classes and functions should be | |
257 | separated by 2-3 lines to make it easier to separate them visually. |
|
280 | separated by 2-3 lines to make it easier to separate them visually. | |
258 | - Use 4 spaces for indentation. |
|
281 | - Use 4 spaces for indentation. | |
259 | - Keep the ordering of methods the same in classes that have the same |
|
282 | - Keep the ordering of methods the same in classes that have the same | |
260 | methods. This is particularly true for classes that implement |
|
283 | methods. This is particularly true for classes that implement | |
261 | similar interfaces and for interfaces that are similar. |
|
284 | similar interfaces and for interfaces that are similar. | |
262 |
|
285 | |||
263 | Naming conventions |
|
286 | Naming conventions | |
264 | ------------------ |
|
287 | ------------------ | |
265 |
|
288 | |||
266 | In terms of naming conventions, we'll follow the guidelines from the `Style |
|
289 | In terms of naming conventions, we'll follow the guidelines from the `Style | |
267 | Guide for Python Code`_. |
|
290 | Guide for Python Code`_. | |
268 |
|
291 | |||
269 | For all new IPython code (and much existing code is being refactored), we'll use: |
|
292 | For all new IPython code (and much existing code is being refactored), we'll use: | |
270 |
|
293 | |||
271 | - All ``lowercase`` module names. |
|
294 | - All ``lowercase`` module names. | |
272 |
|
295 | |||
273 | - ``CamelCase`` for class names. |
|
296 | - ``CamelCase`` for class names. | |
274 |
|
297 | |||
275 | - ``lowercase_with_underscores`` for methods, functions, variables and |
|
298 | - ``lowercase_with_underscores`` for methods, functions, variables and | |
276 | attributes. |
|
299 | attributes. | |
277 |
|
300 | |||
278 | This may be confusing as most of the existing IPython codebase uses a different |
|
301 | This may be confusing as most of the existing IPython codebase uses a different | |
279 | convention (``lowerCamelCase`` for methods and attributes). Slowly, we will |
|
302 | convention (``lowerCamelCase`` for methods and attributes). Slowly, we will | |
280 | move IPython over to the new convention, providing shadow names for backward |
|
303 | move IPython over to the new convention, providing shadow names for backward | |
281 | compatibility in public interfaces. |
|
304 | compatibility in public interfaces. | |
282 |
|
305 | |||
283 | There are, however, some important exceptions to these rules. In some cases, |
|
306 | There are, however, some important exceptions to these rules. In some cases, | |
284 | IPython code will interface with packages (Twisted, Wx, Qt) that use other |
|
307 | IPython code will interface with packages (Twisted, Wx, Qt) that use other | |
285 | conventions. At some level this makes it impossible to adhere to our own |
|
308 | conventions. At some level this makes it impossible to adhere to our own | |
286 | standards at all times. In particular, when subclassing classes that use other |
|
309 | standards at all times. In particular, when subclassing classes that use other | |
287 | naming conventions, you must follow their naming conventions. To deal with |
|
310 | naming conventions, you must follow their naming conventions. To deal with | |
288 | cases like this, we propose the following policy: |
|
311 | cases like this, we propose the following policy: | |
289 |
|
312 | |||
290 | - If you are subclassing a class that uses different conventions, use its |
|
313 | - If you are subclassing a class that uses different conventions, use its | |
291 | naming conventions throughout your subclass. Thus, if you are creating a |
|
314 | naming conventions throughout your subclass. Thus, if you are creating a | |
292 | Twisted Protocol class, used Twisted's |
|
315 | Twisted Protocol class, used Twisted's | |
293 | ``namingSchemeForMethodsAndAttributes.`` |
|
316 | ``namingSchemeForMethodsAndAttributes.`` | |
294 |
|
317 | |||
295 | - All IPython's official interfaces should use our conventions. In some cases |
|
318 | - All IPython's official interfaces should use our conventions. In some cases | |
296 | this will mean that you need to provide shadow names (first implement |
|
319 | this will mean that you need to provide shadow names (first implement | |
297 | ``fooBar`` and then ``foo_bar = fooBar``). We want to avoid this at all |
|
320 | ``fooBar`` and then ``foo_bar = fooBar``). We want to avoid this at all | |
298 | costs, but it will probably be necessary at times. But, please use this |
|
321 | costs, but it will probably be necessary at times. But, please use this | |
299 | sparingly! |
|
322 | sparingly! | |
300 |
|
323 | |||
301 | Implementation-specific *private* methods will use |
|
324 | Implementation-specific *private* methods will use | |
302 | ``_single_underscore_prefix``. Names with a leading double underscore will |
|
325 | ``_single_underscore_prefix``. Names with a leading double underscore will | |
303 | *only* be used in special cases, as they makes subclassing difficult (such |
|
326 | *only* be used in special cases, as they makes subclassing difficult (such | |
304 | names are not easily seen by child classes). |
|
327 | names are not easily seen by child classes). | |
305 |
|
328 | |||
306 | Occasionally some run-in lowercase names are used, but mostly for very short |
|
329 | Occasionally some run-in lowercase names are used, but mostly for very short | |
307 | names or where we are implementing methods very similar to existing ones in a |
|
330 | names or where we are implementing methods very similar to existing ones in a | |
308 | base class (like ``runlines()`` where ``runsource()`` and ``runcode()`` had |
|
331 | base class (like ``runlines()`` where ``runsource()`` and ``runcode()`` had | |
309 | established precedent). |
|
332 | established precedent). | |
310 |
|
333 | |||
311 | The old IPython codebase has a big mix of classes and modules prefixed with an |
|
334 | The old IPython codebase has a big mix of classes and modules prefixed with an | |
312 | explicit ``IP``. In Python this is mostly unnecessary, redundant and frowned |
|
335 | explicit ``IP``. In Python this is mostly unnecessary, redundant and frowned | |
313 | upon, as namespaces offer cleaner prefixing. The only case where this approach |
|
336 | upon, as namespaces offer cleaner prefixing. The only case where this approach | |
314 | is justified is for classes which are expected to be imported into external |
|
337 | is justified is for classes which are expected to be imported into external | |
315 | namespaces and a very generic name (like Shell) is too likely to clash with |
|
338 | namespaces and a very generic name (like Shell) is too likely to clash with | |
316 | something else. We'll need to revisit this issue as we clean up and refactor |
|
339 | something else. We'll need to revisit this issue as we clean up and refactor | |
317 | the code, but in general we should remove as many unnecessary ``IP``/``ip`` |
|
340 | the code, but in general we should remove as many unnecessary ``IP``/``ip`` | |
318 | prefixes as possible. However, if a prefix seems absolutely necessary the more |
|
341 | prefixes as possible. However, if a prefix seems absolutely necessary the more | |
319 | specific ``IPY`` or ``ipy`` are preferred. |
|
342 | specific ``IPY`` or ``ipy`` are preferred. | |
320 |
|
343 | |||
|
344 | ||||
|
345 | Documentation | |||
|
346 | ============= | |||
|
347 | ||||
|
348 | Standalone documentation | |||
|
349 | ------------------------ | |||
|
350 | ||||
|
351 | All standalone documentation should be written in plain text (``.txt``) files | |||
|
352 | using `reStructuredText`_ for markup and formatting. All such documentation | |||
|
353 | should be placed in the top level directory ``docs`` of the IPython source | |||
|
354 | tree. Or, when appropriate, a suitably named subdirectory should be used. The | |||
|
355 | documentation in this location will serve as the main source for IPython | |||
|
356 | documentation and all existing documentation should be converted to this | |||
|
357 | format. | |||
|
358 | ||||
|
359 | In the future, the text files in the ``docs`` directory will be used to | |||
|
360 | generate all forms of documentation for IPython. This include documentation on | |||
|
361 | the IPython website as well as *pdf* documentation. | |||
|
362 | ||||
|
363 | .. _reStructuredText: http://docutils.sourceforge.net/rst.html | |||
|
364 | ||||
|
365 | A bit of shell code: | |||
|
366 | ||||
|
367 | .. sourcecode:: bash | |||
|
368 | ||||
|
369 | cd /tmp | |||
|
370 | echo "My home directory is: $HOME" | |||
|
371 | ls | |||
|
372 | ||||
|
373 | A bit of Python code: | |||
|
374 | ||||
|
375 | .. sourcecode:: python | |||
|
376 | ||||
|
377 | for i in range(10): | |||
|
378 | print i, | |||
|
379 | print "A big number:",2**34 | |||
|
380 | ||||
|
381 | An interactive Python session: | |||
|
382 | ||||
|
383 | .. sourcecode:: python | |||
|
384 | ||||
|
385 | >>> from IPython import genutils | |||
|
386 | >>> genutils.get_ipython_dir() | |||
|
387 | '/home/fperez/.ipython' | |||
|
388 | ||||
|
389 | ||||
|
390 | An IPython session: | |||
|
391 | ||||
|
392 | .. sourcecode:: ipython | |||
|
393 | ||||
|
394 | In [8]: import IPython | |||
|
395 | ||||
|
396 | In [9]: print "This IPython is version:",IPython.__version__ | |||
|
397 | This IPython is version: 0.9.1 | |||
|
398 | ||||
|
399 | ||||
|
400 | ||||
|
401 | Docstring format | |||
|
402 | ---------------- | |||
|
403 | ||||
|
404 | Good docstrings are very important. All new code will use `Epydoc`_ for | |||
|
405 | generating API docs, so we will follow the `Epydoc`_ conventions. More | |||
|
406 | specifically, we will use `reStructuredText`_ for markup and formatting, since | |||
|
407 | it is understood by a wide variety of tools. This means that if in the future | |||
|
408 | we have any reason to change from `Epydoc`_ to something else, we'll have fewer | |||
|
409 | transition pains. | |||
|
410 | ||||
|
411 | Details about using `reStructuredText`_ for docstrings can be found `here | |||
|
412 | <http://epydoc.sourceforge.net/manual-othermarkup.html>`_. | |||
|
413 | ||||
|
414 | .. _Epydoc: http://epydoc.sourceforge.net/ | |||
|
415 | ||||
|
416 | Additional PEPs of interest regarding documentation of code: | |||
|
417 | ||||
|
418 | - `Docstring Conventions <http://www.python.org/peps/pep-0257.html>`_ | |||
|
419 | - `Docstring Processing System Framework <http://www.python.org/peps/pep-0256.html>`_ | |||
|
420 | - `Docutils Design Specification <http://www.python.org/peps/pep-0258.html>`_ | |||
|
421 | ||||
|
422 | ||||
|
423 | ||||
321 | .. _devel_testing: |
|
424 | .. _devel_testing: | |
322 |
|
425 | |||
323 | Testing system |
|
426 | Testing system | |
324 | ============== |
|
427 | ============== | |
325 |
|
428 | |||
326 | It is extremely important that all code contributed to IPython has tests. Tests |
|
429 | It is extremely important that all code contributed to IPython has tests. Tests | |
327 | should be written as unittests, doctests or as entities that the `Nose`_ |
|
430 | should be written as unittests, doctests or as entities that the `Nose`_ | |
328 | testing package will find. Regardless of how the tests are written, we will use |
|
431 | testing package will find. Regardless of how the tests are written, we will use | |
329 | `Nose`_ for discovering and running the tests. `Nose`_ will be required to run |
|
432 | `Nose`_ for discovering and running the tests. `Nose`_ will be required to run | |
330 | the IPython test suite, but will not be required to simply use IPython. |
|
433 | the IPython test suite, but will not be required to simply use IPython. | |
331 |
|
434 | |||
332 | .. _Nose: http://code.google.com/p/python-nose/ |
|
435 | .. _Nose: http://code.google.com/p/python-nose/ | |
333 |
|
436 | |||
334 | Tests of `Twisted`__ using code should be written by subclassing the |
|
437 | Tests of `Twisted`__ using code should be written by subclassing the | |
335 | ``TestCase`` class that comes with ``twisted.trial.unittest``. When this is |
|
438 | ``TestCase`` class that comes with ``twisted.trial.unittest``. When this is | |
336 | done, `Nose`_ will be able to run the tests and the twisted reactor will be |
|
439 | done, `Nose`_ will be able to run the tests and the twisted reactor will be | |
337 | handled correctly. |
|
440 | handled correctly. | |
338 |
|
441 | |||
339 | .. __: http://www.twistedmatrix.com |
|
442 | .. __: http://www.twistedmatrix.com | |
340 |
|
443 | |||
341 | Each subpackage in IPython should have its own ``tests`` directory that |
|
444 | Each subpackage in IPython should have its own ``tests`` directory that | |
342 | contains all of the tests for that subpackage. This allows each subpackage to |
|
445 | contains all of the tests for that subpackage. This allows each subpackage to | |
343 | be self-contained. If a subpackage has any dependencies beyond the Python |
|
446 | be self-contained. If a subpackage has any dependencies beyond the Python | |
344 | standard library, the tests for that subpackage should be skipped if the |
|
447 | standard library, the tests for that subpackage should be skipped if the | |
345 | dependencies are not found. This is very important so users don't get tests |
|
448 | dependencies are not found. This is very important so users don't get tests | |
346 | failing simply because they don't have dependencies. |
|
449 | failing simply because they don't have dependencies. | |
347 |
|
450 | |||
348 | We also need to look into use Noses ability to tag tests to allow a more |
|
451 | We also need to look into use Noses ability to tag tests to allow a more | |
349 | modular approach of running tests. |
|
452 | modular approach of running tests. | |
350 |
|
453 | |||
351 | .. _devel_config: |
|
454 | .. _devel_config: | |
352 |
|
455 | |||
353 | Configuration system |
|
456 | Configuration system | |
354 | ==================== |
|
457 | ==================== | |
355 |
|
458 | |||
356 | IPython uses `.ini`_ files for configuration purposes. This represents a huge |
|
459 | IPython uses `.ini`_ files for configuration purposes. This represents a huge | |
357 | improvement over the configuration system used in IPython. IPython works with |
|
460 | improvement over the configuration system used in IPython. IPython works with | |
358 | these files using the `ConfigObj`_ package, which IPython includes as |
|
461 | these files using the `ConfigObj`_ package, which IPython includes as | |
359 | ``ipython1/external/configobj.py``. |
|
462 | ``ipython1/external/configobj.py``. | |
360 |
|
463 | |||
361 | Currently, we are using raw `ConfigObj`_ objects themselves. Each subpackage of |
|
464 | Currently, we are using raw `ConfigObj`_ objects themselves. Each subpackage of | |
362 | IPython should contain a ``config`` subdirectory that contains all of the |
|
465 | IPython should contain a ``config`` subdirectory that contains all of the | |
363 | configuration information for the subpackage. To see how configuration |
|
466 | configuration information for the subpackage. To see how configuration | |
364 | information is defined (along with defaults) see at the examples in |
|
467 | information is defined (along with defaults) see at the examples in | |
365 | ``ipython1/kernel/config`` and ``ipython1/core/config``. Likewise, to see how |
|
468 | ``ipython1/kernel/config`` and ``ipython1/core/config``. Likewise, to see how | |
366 | the configuration information is used, see examples in |
|
469 | the configuration information is used, see examples in | |
367 | ``ipython1/kernel/scripts/ipengine.py``. |
|
470 | ``ipython1/kernel/scripts/ipengine.py``. | |
368 |
|
471 | |||
369 | Eventually, we will add a new layer on top of the raw `ConfigObj`_ objects. We |
|
472 | Eventually, we will add a new layer on top of the raw `ConfigObj`_ objects. We | |
370 | are calling this new layer, ``tconfig``, as it will use a `Traits`_-like |
|
473 | are calling this new layer, ``tconfig``, as it will use a `Traits`_-like | |
371 | validation model. We won't actually use `Traits`_, but will implement |
|
474 | validation model. We won't actually use `Traits`_, but will implement | |
372 | something similar in pure Python. But, even in this new system, we will still |
|
475 | something similar in pure Python. But, even in this new system, we will still | |
373 | use `ConfigObj`_ and `.ini`_ files underneath the hood. Talk to Fernando if you |
|
476 | use `ConfigObj`_ and `.ini`_ files underneath the hood. Talk to Fernando if you | |
374 | are interested in working on this part of IPython. The current prototype of |
|
477 | are interested in working on this part of IPython. The current prototype of | |
375 | ``tconfig`` is located in the IPython sandbox. |
|
478 | ``tconfig`` is located in the IPython sandbox. | |
376 |
|
479 | |||
377 | .. _.ini: http://docs.python.org/lib/module-ConfigParser.html |
|
480 | .. _.ini: http://docs.python.org/lib/module-ConfigParser.html | |
378 | .. _ConfigObj: http://www.voidspace.org.uk/python/configobj.html |
|
481 | .. _ConfigObj: http://www.voidspace.org.uk/python/configobj.html | |
379 | .. _Traits: http://code.enthought.com/traits/ |
|
482 | .. _Traits: http://code.enthought.com/traits/ | |
380 |
|
483 | |||
381 |
|
484 | |||
382 | Installation and testing scenarios |
|
485 | Installation and testing scenarios | |
383 | ================================== |
|
486 | ================================== | |
384 |
|
487 | |||
385 | This section outlines the various scenarios that we need to test before we |
|
488 | This section outlines the various scenarios that we need to test before we | |
386 | release an IPython version. These scenarios represent different ways of |
|
489 | release an IPython version. These scenarios represent different ways of | |
387 | installing IPython and its dependencies. |
|
490 | installing IPython and its dependencies. | |
388 |
|
491 | |||
389 | Installation scenarios under Linux and OS X |
|
492 | Installation scenarios under Linux and OS X | |
390 | ------------------------------------------- |
|
493 | ------------------------------------------- | |
391 |
|
494 | |||
392 | 1. Install from tarball using ``python setup.py install``. |
|
495 | 1. Install from tarball using ``python setup.py install``. | |
393 | a. With only readline+nose dependencies installed. |
|
496 | a. With only readline+nose dependencies installed. | |
394 | b. With all dependencies installed (readline, zope.interface, Twisted, |
|
497 | b. With all dependencies installed (readline, zope.interface, Twisted, | |
395 | foolscap, Sphinx, nose, pyOpenSSL). |
|
498 | foolscap, Sphinx, nose, pyOpenSSL). | |
396 |
|
499 | |||
397 | 2. Install using easy_install. |
|
500 | 2. Install using easy_install. | |
398 |
|
501 | |||
399 | a. With only readline+nose dependencies installed. |
|
502 | a. With only readline+nose dependencies installed. | |
400 | i. Default dependencies: ``easy_install ipython-0.9.beta3-py2.5.egg`` |
|
503 | i. Default dependencies: ``easy_install ipython-0.9.beta3-py2.5.egg`` | |
401 | ii. Optional dependency sets: ``easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]`` |
|
504 | ii. Optional dependency sets: ``easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]`` | |
402 |
|
505 | |||
403 | b. With all dependencies already installed. |
|
506 | b. With all dependencies already installed. | |
404 |
|
507 | |||
405 |
|
508 | |||
406 | Installation scenarios under Win32 |
|
509 | Installation scenarios under Win32 | |
407 | ---------------------------------- |
|
510 | ---------------------------------- | |
408 |
|
511 | |||
409 | 1. Install everything from .exe installers |
|
512 | 1. Install everything from .exe installers | |
410 | 2. easy_install? |
|
513 | 2. easy_install? | |
411 |
|
514 | |||
412 |
|
515 | |||
413 | Tests to run for these scenarios |
|
516 | Tests to run for these scenarios | |
414 | -------------------------------- |
|
517 | -------------------------------- | |
415 |
|
518 | |||
416 | 1. Run the full test suite. |
|
519 | 1. Run the full test suite. | |
417 | 2. Start a controller and engines and try a few things by hand. |
|
520 | 2. Start a controller and engines and try a few things by hand. | |
418 | a. Using ipcluster. |
|
521 | a. Using ipcluster. | |
419 | b. Using ipcontroller/ipengine by hand. |
|
522 | b. Using ipcontroller/ipengine by hand. | |
420 |
|
523 | |||
421 | 3. Run a few of the parallel examples. |
|
524 | 3. Run a few of the parallel examples. | |
422 | 4. Try the kernel with and without security with and without PyOpenSSL |
|
525 | 4. Try the kernel with and without security with and without PyOpenSSL | |
423 | installed. |
|
526 | installed. | |
424 | 5. Beat on the IPython terminal a bunch. |
|
527 | 5. Beat on the IPython terminal a bunch. | |
425 | 6. Make sure that furl files are being put in proper locations. |
|
528 | 6. Make sure that furl files are being put in proper locations. | |
426 |
|
529 | |||
427 |
|
530 | |||
428 | Release checklist |
|
531 | Release checklist | |
429 | ================= |
|
532 | ================= | |
430 |
|
533 | |||
431 | Most of the release process is automated by the :file:`release` script in the |
|
534 | Most of the release process is automated by the :file:`release` script in the | |
432 | :file:`tools` directory. This is just a handy reminder for the release manager. |
|
535 | :file:`tools` directory. This is just a handy reminder for the release manager. | |
433 |
|
536 | |||
434 | #. Run the release script, which makes the tar.gz, eggs and Win32 .exe |
|
537 | #. Run the release script, which makes the tar.gz, eggs and Win32 .exe | |
435 | installer. It posts them to the site and registers the release with PyPI. |
|
538 | installer. It posts them to the site and registers the release with PyPI. | |
436 |
|
539 | |||
437 | #. Updating the website with announcements and links to the updated changes.txt |
|
540 | #. Updating the website with announcements and links to the updated changes.txt | |
438 | in html form. Remember to put a short note both on the news page of the site |
|
541 | in html form. Remember to put a short note both on the news page of the site | |
439 | and on launcphad. |
|
542 | and on launcphad. | |
440 |
|
543 | |||
441 | #. Drafting a short release announcement with i) highlights and ii) a link to |
|
544 | #. Drafting a short release announcement with i) highlights and ii) a link to | |
442 | the html changes.txt. |
|
545 | the html changes.txt. | |
443 |
|
546 | |||
444 | #. Make sure that the released version of the docs is live on the site. |
|
547 | #. Make sure that the released version of the docs is live on the site. | |
445 |
|
548 | |||
446 | #. Celebrate! |
|
549 | #. Celebrate! |
@@ -1,10 +1,10 b'' | |||||
1 | .. _install_index: |
|
1 | .. _install_index: | |
2 |
|
2 | |||
3 |
============ |
|
3 | ============ | |
4 | Installation |
|
4 | Installation | |
5 |
============ |
|
5 | ============ | |
6 |
|
6 | |||
7 | .. toctree:: |
|
7 | .. toctree:: | |
8 | :maxdepth: 2 |
|
8 | :maxdepth: 2 | |
9 |
|
9 | |||
10 | install.txt |
|
10 | install.txt |
@@ -1,191 +1,300 b'' | |||||
1 | Overview |
|
1 | Overview | |
2 | ======== |
|
2 | ======== | |
3 |
|
3 | |||
4 | This document describes the steps required to install IPython. IPython is organized into a number of subpackages, each of which has its own dependencies. All of the subpackages come with IPython, so you don't need to download and install them separately. However, to use a given subpackage, you will need to install all of its dependencies. |
|
4 | This document describes the steps required to install IPython. IPython is | |
|
5 | organized into a number of subpackages, each of which has its own dependencies. | |||
|
6 | All of the subpackages come with IPython, so you don't need to download and | |||
|
7 | install them separately. However, to use a given subpackage, you will need to | |||
|
8 | install all of its dependencies. | |||
5 |
|
9 | |||
6 |
|
10 | |||
7 | Please let us know if you have problems installing IPython or any of its |
|
11 | Please let us know if you have problems installing IPython or any of its | |
8 |
dependencies. IPython requires Python version 2.4 or greater. We have not |
|
12 | dependencies. IPython requires Python version 2.4 or greater. We have not | |
9 |
IPython with the upcoming 2.6 or 3.0 versions |
|
13 | tested IPython with the upcoming 2.6 or 3.0 versions, though preliminary | |
|
14 | reports of 2.6 usage are encouraging. 3.0 porting will take longer, however. | |||
10 |
|
15 | |||
11 | .. warning:: |
|
16 | .. warning:: | |
12 |
|
17 | |||
13 |
|
|
18 | IPython will not work with Python 2.3 or below. | |
14 |
|
19 | |||
15 | Some of the installation approaches use the :mod:`setuptools` package and its :command:`easy_install` command line program. In many scenarios, this provides the most simple method of installing IPython and its dependencies. It is not required though. More information about :mod:`setuptools` can be found on its website. |
|
20 | Some of the installation approaches use the :mod:`setuptools` package and its | |
|
21 | :command:`easy_install` command line program. In many scenarios, this provides | |||
|
22 | the most simple method of installing IPython and its dependencies. It is not | |||
|
23 | required though. More information about :mod:`setuptools` can be found on its | |||
|
24 | website. | |||
|
25 | ||||
|
26 | More general information about installing Python packages can be found in | |||
|
27 | Python's documentation at http://www.python.org/doc/. | |||
16 |
|
28 | |||
17 | More general information about installing Python packages can be found in Python's documentation at http://www.python.org/doc/. |
|
|||
18 |
|
29 | |||
19 | Installing IPython itself |
|
30 | Installing IPython itself | |
20 | ========================= |
|
31 | ========================= | |
21 |
|
32 | |||
22 | Given a properly built Python, the basic interactive IPython shell will work with no external dependencies. However, some Python distributions (particularly on Windows and OS X), don't come with a working :mod:`readline` module. The IPython shell will work without :mod:`readline`, but will lack many features that users depend on, such as tab completion and command line editing. See below for details of how to make sure you have a working :mod:`readline`. |
|
33 | Given a properly built Python, the basic interactive IPython shell will work | |
|
34 | with no external dependencies. However, some Python distributions | |||
|
35 | (particularly on Windows and OS X), don't come with a working :mod:`readline` | |||
|
36 | module. The IPython shell will work without :mod:`readline`, but will lack | |||
|
37 | many features that users depend on, such as tab completion and command line | |||
|
38 | editing. See below for details of how to make sure you have a working | |||
|
39 | :mod:`readline`. | |||
23 |
|
40 | |||
24 | Installation using easy_install |
|
41 | Installation using easy_install | |
25 | ------------------------------- |
|
42 | ------------------------------- | |
26 |
|
43 | |||
27 |
If you have :mod:`setuptools` installed, the easiest way of getting IPython is |
|
44 | If you have :mod:`setuptools` installed, the easiest way of getting IPython is | |
|
45 | to use :command:`easy_install`: | |||
|
46 | ||||
|
47 | .. sourcecode:: bash | |||
|
48 | ||||
|
49 | easy_install IPython | |||
|
50 | ||||
|
51 | Unless you've written a custom distutils script as explained here_, that will | |||
|
52 | try to install either in a default system-wide location, which may require | |||
|
53 | administrator access. If that is the case, you can either run the command with | |||
|
54 | root privileges: | |||
|
55 | ||||
|
56 | .. sourcecode:: bash | |||
|
57 | ||||
|
58 | sudo easy_install IPython | |||
|
59 | ||||
|
60 | or you can specify an alternate location, for example: | |||
28 |
|
61 | |||
29 | $ easy_install IPython |
|
62 | .. sourcecode:: bash | |
|
63 | ||||
|
64 | easy_install --prefix=~/usr/local IPython | |||
|
65 | ||||
|
66 | where this assumes that ``~/usr/local`` is a valid prefix for you to install | |||
|
67 | packages to in your user account. | |||
|
68 | ||||
|
69 | .. _here: http://docs.python.org/install/index.html#inst-config-files | |||
30 |
|
70 | |||
31 | That's it. |
|
|||
32 |
|
71 | |||
33 | Installation from source |
|
72 | Installation from source | |
34 | ------------------------ |
|
73 | ------------------------ | |
35 |
|
74 | |||
36 | If you don't want to use :command:`easy_install`, or don't have it installed, just grab the latest stable build of IPython from `here <http://ipython.scipy.org/dist/>`_. Then do the following:: |
|
75 | If you don't want to use :command:`easy_install`, or don't have it installed, | |
|
76 | just grab the latest stable build of IPython from `here | |||
|
77 | <http://ipython.scipy.org/dist/>`_. Then do the following (using the | |||
|
78 | appropriate version number): | |||
37 |
|
79 | |||
38 | $ tar -xzf ipython.tar.gz |
|
80 | .. sourcecode:: bash | |
39 | $ cd ipython |
|
|||
40 | $ python setup.py install |
|
|||
41 |
|
81 | |||
42 | If you are installing to a location (like ``/usr/local``) that requires higher permissions, you may need to run the last command with :command:`sudo`. |
|
82 | tar -xzf ipython.tar.gz | |
|
83 | cd ipython | |||
|
84 | python setup.py install | |||
|
85 | ||||
|
86 | If you are installing to a location (like ``/usr/local``) that requires higher | |||
|
87 | permissions, you may need to run the last command with :command:`sudo`. | |||
43 |
|
88 | |||
44 | Windows |
|
89 | Windows | |
45 | ------- |
|
90 | ------- | |
46 |
|
91 | |||
47 | There are a few caveats for Windows users. The main issue is that a basic ``python setup.py install`` approach won't create ``.bat`` file or Start Menu shortcuts, which most users want. To get an installation with these, there are two choices: |
|
92 | There are a few caveats for Windows users. The main issue is that a basic ``python setup.py install`` approach won't create ``.bat`` file or Start Menu shortcuts, which most users want. To get an installation with these, there are two choices: | |
48 |
|
93 | |||
49 | 1. Install using :command:`easy_install`. |
|
94 | 1. Install using :command:`easy_install`. | |
50 |
|
95 | |||
51 | 2. Install using our binary ``.exe`` Windows installer, which can be found at `here <http://ipython.scipy.org/dist/>`_ |
|
96 | 2. Install using our binary ``.exe`` Windows installer, which can be found at `here <http://ipython.scipy.org/dist/>`_ | |
52 |
|
97 | |||
53 | 3. Install from source, but using :mod:`setuptools` (``python setupegg.py install``). |
|
98 | 3. Install from source, but using :mod:`setuptools` (``python setupegg.py install``). | |
54 |
|
99 | |||
55 | Installing the development version |
|
100 | Installing the development version | |
56 | ---------------------------------- |
|
101 | ---------------------------------- | |
57 |
|
102 | |||
58 |
It is also possible to install the development version of IPython from our |
|
103 | It is also possible to install the development version of IPython from our | |
59 | repository. To do this you will need to have Bazaar installed on your system. Then just do:: |
|
104 | `Bazaar <http://bazaar-vcs.org/>`_ source code repository. To do this you will | |
|
105 | need to have Bazaar installed on your system. Then just do:: | |||
|
106 | ||||
|
107 | .. sourcecode:: bash | |||
60 |
|
108 | |||
61 |
|
|
109 | bzr branch lp:ipython | |
62 |
|
|
110 | cd ipython | |
63 |
|
|
111 | python setup.py install | |
64 |
|
112 | |||
65 | Again, this last step on Windows won't create ``.bat`` files or Start Menu shortcuts, so you will have to use one of the other approaches listed above. |
|
113 | Again, this last step on Windows won't create ``.bat`` files or Start Menu shortcuts, so you will have to use one of the other approaches listed above. | |
66 |
|
114 | |||
67 |
Some users want to be able to follow the development branch as it changes. If |
|
115 | Some users want to be able to follow the development branch as it changes. If | |
|
116 | you have :mod:`setuptools` installed, this is easy. Simply replace the last | |||
|
117 | step by: | |||
|
118 | ||||
|
119 | .. sourcecode:: bash | |||
68 |
|
120 | |||
69 |
|
|
121 | python setupegg.py develop | |
70 |
|
122 | |||
71 |
This creates links in the right places and installs the command line script to the appropriate places. Then, if you want to update your IPython at any time, just do: |
|
123 | This creates links in the right places and installs the command line script to the appropriate places. Then, if you want to update your IPython at any time, just do: | |
72 |
|
124 | |||
73 | $ bzr pull |
|
125 | .. sourcecode:: bash | |
|
126 | ||||
|
127 | bzr pull | |||
74 |
|
128 | |||
75 | Basic optional dependencies |
|
129 | Basic optional dependencies | |
76 | =========================== |
|
130 | =========================== | |
77 |
|
131 | |||
78 | There are a number of basic optional dependencies that most users will want to get. These are: |
|
132 | There are a number of basic optional dependencies that most users will want to get. These are: | |
79 |
|
133 | |||
80 | * readline (for command line editing, tab completion, etc.) |
|
134 | * readline (for command line editing, tab completion, etc.) | |
81 | * nose (to run the IPython test suite) |
|
135 | * nose (to run the IPython test suite) | |
82 | * pexpect (to use things like irunner) |
|
136 | * pexpect (to use things like irunner) | |
83 |
|
137 | |||
84 | If you are comfortable installing these things yourself, have at it, otherwise read on for more details. |
|
138 | If you are comfortable installing these things yourself, have at it, otherwise read on for more details. | |
85 |
|
139 | |||
86 | readline |
|
140 | readline | |
87 | -------- |
|
141 | -------- | |
88 |
|
142 | |||
89 | In principle, all Python distributions should come with a working :mod:`readline` module. But, reality is not quite that simple. There are two common situations where you won't have a working :mod:`readline` module: |
|
143 | In principle, all Python distributions should come with a working :mod:`readline` module. But, reality is not quite that simple. There are two common situations where you won't have a working :mod:`readline` module: | |
90 |
|
144 | |||
91 | * If you are using the built-in Python on Mac OS X. |
|
145 | * If you are using the built-in Python on Mac OS X. | |
92 |
|
146 | |||
93 | * If you are running Windows, which doesn't have a :mod:`readline` module. |
|
147 | * If you are running Windows, which doesn't have a :mod:`readline` module. | |
94 |
|
148 | |||
95 | On OS X, the built-in Python doesn't not have :mod:`readline` because of license issues. Starting with OS X 10.5 (Leopard), Apple's built-in Python has a BSD-licensed not-quite-compatible readline replacement. As of IPython 0.9, many of the issues related to the differences between readline and libedit have been resolved. For many users, libedit may be sufficient. |
|
149 | On OS X, the built-in Python doesn't not have :mod:`readline` because of | |
|
150 | license issues. Starting with OS X 10.5 (Leopard), Apple's built-in Python has | |||
|
151 | a BSD-licensed not-quite-compatible readline replacement. As of IPython 0.9, | |||
|
152 | many of the issues related to the differences between readline and libedit have | |||
|
153 | been resolved. For many users, libedit may be sufficient. | |||
|
154 | ||||
|
155 | Most users on OS X will want to get the full :mod:`readline` module. To get a | |||
|
156 | working :mod:`readline` module, just do (with :mod:`setuptools` installed): | |||
96 |
|
157 | |||
97 | Most users on OS X will want to get the full :mod:`readline` module. To get a working :mod:`readline` module, just do (with :mod:`setuptools` installed):: |
|
158 | .. sourcecode:: bash | |
98 |
|
159 | |||
99 |
|
|
160 | easy_install readline | |
100 |
|
161 | |||
101 | .. note: |
|
162 | .. note: | |
102 |
|
163 | |||
103 | Other Python distributions on OS X (such as fink, MacPorts and the |
|
164 | Other Python distributions on OS X (such as fink, MacPorts and the | |
104 | official python.org binaries) already have readline installed so |
|
165 | official python.org binaries) already have readline installed so | |
105 | you don't have to do this step. |
|
166 | you don't have to do this step. | |
106 |
|
167 | |||
107 |
If needed, the readline egg can be build and installed from source (see the |
|
168 | If needed, the readline egg can be build and installed from source (see the | |
|
169 | wiki page at http://ipython.scipy.org/moin/InstallationOSXLeopard). | |||
108 |
|
170 | |||
109 | On Windows, you will need the PyReadline module. PyReadline is a separate, Windows only implementation of readline that uses native Windows calls through :mod:`ctypes`. The easiest way of installing PyReadline is you use the binary installer available `here <http://ipython.scipy.org/dist/>`_. The :mod:`ctypes` module, which comes with Python 2.5 and greater, is required by PyReadline. It is available for Python 2.4 at http://python.net/crew/theller/ctypes. |
|
171 | On Windows, you will need the PyReadline module. PyReadline is a separate, | |
|
172 | Windows only implementation of readline that uses native Windows calls through | |||
|
173 | :mod:`ctypes`. The easiest way of installing PyReadline is you use the binary | |||
|
174 | installer available `here <http://ipython.scipy.org/dist/>`_. The | |||
|
175 | :mod:`ctypes` module, which comes with Python 2.5 and greater, is required by | |||
|
176 | PyReadline. It is available for Python 2.4 at | |||
|
177 | http://python.net/crew/theller/ctypes. | |||
110 |
|
178 | |||
111 | nose |
|
179 | nose | |
112 | ---- |
|
180 | ---- | |
113 |
|
181 | |||
114 | To run the IPython test suite you will need the :mod:`nose` package. Nose provides a great way of sniffing out and running all of the IPython tests. The simplest way of getting nose, is to use :command:`easy_install`:: |
|
182 | To run the IPython test suite you will need the :mod:`nose` package. Nose | |
|
183 | provides a great way of sniffing out and running all of the IPython tests. The | |||
|
184 | simplest way of getting nose, is to use :command:`easy_install`: | |||
|
185 | ||||
|
186 | .. sourcecode:: bash | |||
115 |
|
187 | |||
116 |
|
|
188 | easy_install nose | |
117 |
|
189 | |||
118 |
Another way of getting this is to do: |
|
190 | Another way of getting this is to do: | |
119 |
|
191 | |||
120 | $ easy_install IPython[test] |
|
192 | .. sourcecode:: bash | |
121 |
|
193 | |||
122 | For more installation options, see the `nose website <http://somethingaboutorange.com/mrl/projects/nose/>`_. Once you have nose installed, you can run IPython's test suite using the iptest command:: |
|
194 | easy_install IPython[test] | |
123 |
|
195 | |||
124 | $ iptest |
|
196 | For more installation options, see the `nose website | |
|
197 | <http://somethingaboutorange.com/mrl/projects/nose/>`_. Once you have nose | |||
|
198 | installed, you can run IPython's test suite using the iptest command: | |||
|
199 | ||||
|
200 | .. sourcecode:: bash | |||
|
201 | ||||
|
202 | iptest | |||
125 |
|
203 | |||
126 |
|
204 | |||
127 | pexpect |
|
205 | pexpect | |
128 | ------- |
|
206 | ------- | |
129 |
|
207 | |||
130 |
The `pexpect <http://www.noah.org/wiki/Pexpect>`_ package is used in IPython's |
|
208 | The `pexpect <http://www.noah.org/wiki/Pexpect>`_ package is used in IPython's | |
|
209 | :command:`irunner` script. On Unix platforms (including OS X), just do: | |||
|
210 | ||||
|
211 | .. sourcecode:: bash | |||
131 |
|
212 | |||
132 |
|
|
213 | easy_install pexpect | |
133 |
|
214 | |||
134 | Windows users are out of luck as pexpect does not run there. |
|
215 | Windows users are out of luck as pexpect does not run there. | |
135 |
|
216 | |||
136 | Dependencies for IPython.kernel (parallel computing) |
|
217 | Dependencies for IPython.kernel (parallel computing) | |
137 | ==================================================== |
|
218 | ==================================================== | |
138 |
|
219 | |||
139 | The IPython kernel provides a nice architecture for parallel computing. The main focus of this architecture is on interactive parallel computing. These features require a number of additional packages: |
|
220 | The IPython kernel provides a nice architecture for parallel computing. The | |
|
221 | main focus of this architecture is on interactive parallel computing. These | |||
|
222 | features require a number of additional packages: | |||
140 |
|
223 | |||
141 | * zope.interface (yep, we use interfaces) |
|
224 | * zope.interface (yep, we use interfaces) | |
142 | * Twisted (asynchronous networking framework) |
|
225 | * Twisted (asynchronous networking framework) | |
143 | * Foolscap (a nice, secure network protocol) |
|
226 | * Foolscap (a nice, secure network protocol) | |
144 | * pyOpenSSL (security for network connections) |
|
227 | * pyOpenSSL (security for network connections) | |
145 |
|
228 | |||
146 |
On a Unix style platform (including OS X), if you want to use |
|
229 | On a Unix style platform (including OS X), if you want to use | |
|
230 | :mod:`setuptools`, you can just do: | |||
147 |
|
231 | |||
148 | $ easy_install IPython[kernel] # the first three |
|
232 | .. sourcecode:: bash | |
149 | $ easy_install IPython[security] # pyOpenSSL |
|
233 | ||
|
234 | easy_install IPython[kernel] # the first three | |||
|
235 | easy_install IPython[security] # pyOpenSSL | |||
150 |
|
236 | |||
151 | zope.interface and Twisted |
|
237 | zope.interface and Twisted | |
152 | -------------------------- |
|
238 | -------------------------- | |
153 |
|
239 | |||
154 |
On Unix style platforms (including OS X), the simplest way of getting the these |
|
240 | On Unix style platforms (including OS X), the simplest way of getting the these | |
|
241 | is to use :command:`easy_install`: | |||
|
242 | ||||
|
243 | .. sourcecode:: bash | |||
155 |
|
244 | |||
156 |
|
|
245 | easy_install zope.interface | |
157 |
|
|
246 | easy_install Twisted | |
158 |
|
247 | |||
159 | Of course, you can also download the source tarballs from the `Twisted website <twistedmatrix.org>`_ and the `zope.interface page at PyPI <http://pypi.python.org/pypi/zope.interface>`_ and do the usual ``python setup.py install`` if you prefer. |
|
248 | Of course, you can also download the source tarballs from the `Twisted website | |
|
249 | <twistedmatrix.org>`_ and the `zope.interface page at PyPI | |||
|
250 | <http://pypi.python.org/pypi/zope.interface>`_ and do the usual ``python | |||
|
251 | setup.py install`` if you prefer. | |||
160 |
|
252 | |||
161 | Windows is a bit different. For zope.interface and Twisted, simply get the latest binary ``.exe`` installer from the Twisted website. This installer includes both zope.interface and Twisted and should just work. |
|
253 | Windows is a bit different. For zope.interface and Twisted, simply get the | |
|
254 | latest binary ``.exe`` installer from the Twisted website. This installer | |||
|
255 | includes both zope.interface and Twisted and should just work. | |||
162 |
|
256 | |||
163 | Foolscap |
|
257 | Foolscap | |
164 | -------- |
|
258 | -------- | |
165 |
|
259 | |||
166 |
Foolscap uses Twisted to provide a very nice secure RPC protocol that we use to |
|
260 | Foolscap uses Twisted to provide a very nice secure RPC protocol that we use to | |
|
261 | implement our parallel computing features. | |||
|
262 | ||||
|
263 | On all platforms a simple: | |||
167 |
|
264 | |||
168 | On all platforms a simple:: |
|
265 | .. sourcecode:: bash | |
169 |
|
266 | |||
170 |
|
|
267 | easy_install foolscap | |
171 |
|
268 | |||
172 |
should work. You can also download the source tarballs from the `Foolscap |
|
269 | should work. You can also download the source tarballs from the `Foolscap | |
|
270 | website <http://foolscap.lothar.com/trac>`_ and do ``python setup.py install`` | |||
|
271 | if you prefer. | |||
173 |
|
272 | |||
174 | pyOpenSSL |
|
273 | pyOpenSSL | |
175 | --------- |
|
274 | --------- | |
176 |
|
275 | |||
177 |
IPython requires an older version of pyOpenSSL (0.6 rather than the current |
|
276 | IPython requires an older version of pyOpenSSL (0.6 rather than the current | |
|
277 | 0.7). There are a couple of options for getting this: | |||
|
278 | ||||
|
279 | 1. Most Linux distributions have packages for pyOpenSSL. | |||
|
280 | ||||
|
281 | 2. The built-in Python 2.5 on OS X 10.5 already has it installed. | |||
|
282 | ||||
|
283 | 3. There are source tarballs on the pyOpenSSL website. On Unix-like | |||
|
284 | platforms, these can be built using ``python seutp.py install``. | |||
178 |
|
285 | |||
179 | 1. Most Linux distributions have packages for pyOpenSSL. |
|
286 | 4. There is also a binary ``.exe`` Windows installer on the `pyOpenSSL website | |
180 | 2. The built-in Python 2.5 on OS X 10.5 already has it installed. |
|
287 | <http://pyopenssl.sourceforge.net/>`_. | |
181 | 3. There are source tarballs on the pyOpenSSL website. On Unix-like |
|
|||
182 | platforms, these can be built using ``python seutp.py install``. |
|
|||
183 | 4. There is also a binary ``.exe`` Windows installer on the `pyOpenSSL website <http://pyopenssl.sourceforge.net/>`_. |
|
|||
184 |
|
288 | |||
185 | Dependencies for IPython.frontend (the IPython GUI) |
|
289 | Dependencies for IPython.frontend (the IPython GUI) | |
186 | =================================================== |
|
290 | =================================================== | |
187 |
|
291 | |||
188 | wxPython |
|
292 | wxPython | |
189 | -------- |
|
293 | -------- | |
190 |
|
294 | |||
191 | Starting with IPython 0.9, IPython has a new IPython.frontend package that has a nice wxPython based IPython GUI. As you would expect, this GUI requires wxPython. Most Linux distributions have wxPython packages available and the built-in Python on OS X comes with wxPython preinstalled. For Windows, a binary installer is available on the `wxPython website <http://www.wxpython.org/>`_. No newline at end of file |
|
295 | Starting with IPython 0.9, IPython has a new IPython.frontend package that has | |
|
296 | a nice wxPython based IPython GUI. As you would expect, this GUI requires | |||
|
297 | wxPython. Most Linux distributions have wxPython packages available and the | |||
|
298 | built-in Python on OS X comes with wxPython preinstalled. For Windows, a | |||
|
299 | binary installer is available on the `wxPython website | |||
|
300 | <http://www.wxpython.org/>`_. No newline at end of file |
@@ -1,233 +1,232 b'' | |||||
1 | .. _overview: |
|
1 | .. _overview: | |
2 |
|
2 | |||
3 | ============ |
|
3 | ============ | |
4 | Introduction |
|
4 | Introduction | |
5 | ============ |
|
5 | ============ | |
6 |
|
6 | |||
7 | Overview |
|
7 | Overview | |
8 | ======== |
|
8 | ======== | |
9 |
|
9 | |||
10 | One of Python's most useful features is its interactive interpreter. |
|
10 | One of Python's most useful features is its interactive interpreter. | |
11 | This system allows very fast testing of ideas without the overhead of |
|
11 | This system allows very fast testing of ideas without the overhead of | |
12 | creating test files as is typical in most programming languages. |
|
12 | creating test files as is typical in most programming languages. | |
13 | However, the interpreter supplied with the standard Python distribution |
|
13 | However, the interpreter supplied with the standard Python distribution | |
14 | is somewhat limited for extended interactive use. |
|
14 | is somewhat limited for extended interactive use. | |
15 |
|
15 | |||
16 | The goal of IPython is to create a comprehensive environment for |
|
16 | The goal of IPython is to create a comprehensive environment for | |
17 | interactive and exploratory computing. To support this goal, IPython |
|
17 | interactive and exploratory computing. To support this goal, IPython | |
18 | has two main components: |
|
18 | has two main components: | |
19 |
|
19 | |||
20 | * An enhanced interactive Python shell. |
|
20 | * An enhanced interactive Python shell. | |
21 | * An architecture for interactive parallel computing. |
|
21 | * An architecture for interactive parallel computing. | |
22 |
|
22 | |||
23 | All of IPython is open source (released under the revised BSD license). |
|
23 | All of IPython is open source (released under the revised BSD license). | |
24 |
|
24 | |||
25 | Enhanced interactive Python shell |
|
25 | Enhanced interactive Python shell | |
26 | ================================= |
|
26 | ================================= | |
27 |
|
27 | |||
28 | IPython's interactive shell (:command:`ipython`), has the following goals, |
|
28 | IPython's interactive shell (:command:`ipython`), has the following goals, | |
29 | amongst others: |
|
29 | amongst others: | |
30 |
|
30 | |||
31 | 1. Provide an interactive shell superior to Python's default. IPython |
|
31 | 1. Provide an interactive shell superior to Python's default. IPython | |
32 | has many features for object introspection, system shell access, |
|
32 | has many features for object introspection, system shell access, | |
33 | and its own special command system for adding functionality when |
|
33 | and its own special command system for adding functionality when | |
34 | working interactively. It tries to be a very efficient environment |
|
34 | working interactively. It tries to be a very efficient environment | |
35 | both for Python code development and for exploration of problems |
|
35 | both for Python code development and for exploration of problems | |
36 | using Python objects (in situations like data analysis). |
|
36 | using Python objects (in situations like data analysis). | |
37 |
|
37 | |||
38 | 2. Serve as an embeddable, ready to use interpreter for your own |
|
38 | 2. Serve as an embeddable, ready to use interpreter for your own | |
39 | programs. IPython can be started with a single call from inside |
|
39 | programs. IPython can be started with a single call from inside | |
40 | another program, providing access to the current namespace. This |
|
40 | another program, providing access to the current namespace. This | |
41 | can be very useful both for debugging purposes and for situations |
|
41 | can be very useful both for debugging purposes and for situations | |
42 | where a blend of batch-processing and interactive exploration are |
|
42 | where a blend of batch-processing and interactive exploration are | |
43 | needed. New in the 0.9 version of IPython is a reusable wxPython |
|
43 | needed. New in the 0.9 version of IPython is a reusable wxPython | |
44 | based IPython widget. |
|
44 | based IPython widget. | |
45 |
|
45 | |||
46 | 3. Offer a flexible framework which can be used as the base |
|
46 | 3. Offer a flexible framework which can be used as the base | |
47 | environment for other systems with Python as the underlying |
|
47 | environment for other systems with Python as the underlying | |
48 | language. Specifically scientific environments like Mathematica, |
|
48 | language. Specifically scientific environments like Mathematica, | |
49 | IDL and Matlab inspired its design, but similar ideas can be |
|
49 | IDL and Matlab inspired its design, but similar ideas can be | |
50 | useful in many fields. |
|
50 | useful in many fields. | |
51 |
|
51 | |||
52 | 4. Allow interactive testing of threaded graphical toolkits. IPython |
|
52 | 4. Allow interactive testing of threaded graphical toolkits. IPython | |
53 | has support for interactive, non-blocking control of GTK, Qt and |
|
53 | has support for interactive, non-blocking control of GTK, Qt and | |
54 | WX applications via special threading flags. The normal Python |
|
54 | WX applications via special threading flags. The normal Python | |
55 | shell can only do this for Tkinter applications. |
|
55 | shell can only do this for Tkinter applications. | |
56 |
|
56 | |||
57 | Main features of the interactive shell |
|
57 | Main features of the interactive shell | |
58 | -------------------------------------- |
|
58 | -------------------------------------- | |
59 |
|
59 | |||
60 | * Dynamic object introspection. One can access docstrings, function |
|
60 | * Dynamic object introspection. One can access docstrings, function | |
61 | definition prototypes, source code, source files and other details |
|
61 | definition prototypes, source code, source files and other details | |
62 | of any object accessible to the interpreter with a single |
|
62 | of any object accessible to the interpreter with a single | |
63 | keystroke (:samp:`?`, and using :samp:`??` provides additional detail). |
|
63 | keystroke (:samp:`?`, and using :samp:`??` provides additional detail). | |
64 |
|
64 | |||
65 | * Searching through modules and namespaces with :samp:`*` wildcards, both |
|
65 | * Searching through modules and namespaces with :samp:`*` wildcards, both | |
66 | when using the :samp:`?` system and via the :samp:`%psearch` command. |
|
66 | when using the :samp:`?` system and via the :samp:`%psearch` command. | |
67 |
|
67 | |||
68 | * Completion in the local namespace, by typing :kbd:`TAB` at the prompt. |
|
68 | * Completion in the local namespace, by typing :kbd:`TAB` at the prompt. | |
69 | This works for keywords, modules, methods, variables and files in the |
|
69 | This works for keywords, modules, methods, variables and files in the | |
70 | current directory. This is supported via the readline library, and |
|
70 | current directory. This is supported via the readline library, and | |
71 | full access to configuring readline's behavior is provided. |
|
71 | full access to configuring readline's behavior is provided. | |
72 | Custom completers can be implemented easily for different purposes |
|
72 | Custom completers can be implemented easily for different purposes | |
73 | (system commands, magic arguments etc.) |
|
73 | (system commands, magic arguments etc.) | |
74 |
|
74 | |||
75 | * Numbered input/output prompts with command history (persistent |
|
75 | * Numbered input/output prompts with command history (persistent | |
76 | across sessions and tied to each profile), full searching in this |
|
76 | across sessions and tied to each profile), full searching in this | |
77 | history and caching of all input and output. |
|
77 | history and caching of all input and output. | |
78 |
|
78 | |||
79 | * User-extensible 'magic' commands. A set of commands prefixed with |
|
79 | * User-extensible 'magic' commands. A set of commands prefixed with | |
80 | :samp:`%` is available for controlling IPython itself and provides |
|
80 | :samp:`%` is available for controlling IPython itself and provides | |
81 | directory control, namespace information and many aliases to |
|
81 | directory control, namespace information and many aliases to | |
82 | common system shell commands. |
|
82 | common system shell commands. | |
83 |
|
83 | |||
84 | * Alias facility for defining your own system aliases. |
|
84 | * Alias facility for defining your own system aliases. | |
85 |
|
85 | |||
86 | * Complete system shell access. Lines starting with :samp:`!` are passed |
|
86 | * Complete system shell access. Lines starting with :samp:`!` are passed | |
87 | directly to the system shell, and using :samp:`!!` or :samp:`var = !cmd` |
|
87 | directly to the system shell, and using :samp:`!!` or :samp:`var = !cmd` | |
88 | captures shell output into python variables for further use. |
|
88 | captures shell output into python variables for further use. | |
89 |
|
89 | |||
90 | * Background execution of Python commands in a separate thread. |
|
90 | * Background execution of Python commands in a separate thread. | |
91 | IPython has an internal job manager called jobs, and a |
|
91 | IPython has an internal job manager called jobs, and a | |
92 | convenience backgrounding magic function called :samp:`%bg`. |
|
92 | convenience backgrounding magic function called :samp:`%bg`. | |
93 |
|
93 | |||
94 | * The ability to expand python variables when calling the system |
|
94 | * The ability to expand python variables when calling the system shell. In a | |
95 |
shell |
|
95 | shell command, any python variable prefixed with :samp:`$` is expanded. A | |
96 |
|
|
96 | double :samp:`$$` allows passing a literal :samp:`$` to the shell (for access | |
97 |
|
|
97 | to shell and environment variables like :envvar:`PATH`). | |
98 |
|
98 | |||
99 | * Filesystem navigation, via a magic :samp:`%cd` command, along with a |
|
99 | * Filesystem navigation, via a magic :samp:`%cd` command, along with a | |
100 | persistent bookmark system (using :samp:`%bookmark`) for fast access to |
|
100 | persistent bookmark system (using :samp:`%bookmark`) for fast access to | |
101 | frequently visited directories. |
|
101 | frequently visited directories. | |
102 |
|
102 | |||
103 | * A lightweight persistence framework via the :samp:`%store` command, which |
|
103 | * A lightweight persistence framework via the :samp:`%store` command, which | |
104 | allows you to save arbitrary Python variables. These get restored |
|
104 | allows you to save arbitrary Python variables. These get restored | |
105 | automatically when your session restarts. |
|
105 | automatically when your session restarts. | |
106 |
|
106 | |||
107 | * Automatic indentation (optional) of code as you type (through the |
|
107 | * Automatic indentation (optional) of code as you type (through the | |
108 | readline library). |
|
108 | readline library). | |
109 |
|
109 | |||
110 | * Macro system for quickly re-executing multiple lines of previous |
|
110 | * Macro system for quickly re-executing multiple lines of previous | |
111 | input with a single name. Macros can be stored persistently via |
|
111 | input with a single name. Macros can be stored persistently via | |
112 | :samp:`%store` and edited via :samp:`%edit`. |
|
112 | :samp:`%store` and edited via :samp:`%edit`. | |
113 |
|
113 | |||
114 | * Session logging (you can then later use these logs as code in your |
|
114 | * Session logging (you can then later use these logs as code in your | |
115 | programs). Logs can optionally timestamp all input, and also store |
|
115 | programs). Logs can optionally timestamp all input, and also store | |
116 | session output (marked as comments, so the log remains valid |
|
116 | session output (marked as comments, so the log remains valid | |
117 | Python source code). |
|
117 | Python source code). | |
118 |
|
118 | |||
119 | * Session restoring: logs can be replayed to restore a previous |
|
119 | * Session restoring: logs can be replayed to restore a previous | |
120 | session to the state where you left it. |
|
120 | session to the state where you left it. | |
121 |
|
121 | |||
122 | * Verbose and colored exception traceback printouts. Easier to parse |
|
122 | * Verbose and colored exception traceback printouts. Easier to parse | |
123 | visually, and in verbose mode they produce a lot of useful |
|
123 | visually, and in verbose mode they produce a lot of useful | |
124 | debugging information (basically a terminal version of the cgitb |
|
124 | debugging information (basically a terminal version of the cgitb | |
125 | module). |
|
125 | module). | |
126 |
|
126 | |||
127 | * Auto-parentheses: callable objects can be executed without |
|
127 | * Auto-parentheses: callable objects can be executed without | |
128 | parentheses: :samp:`sin 3` is automatically converted to :samp:`sin(3)`. |
|
128 | parentheses: :samp:`sin 3` is automatically converted to :samp:`sin(3)`. | |
129 |
|
129 | |||
130 | * Auto-quoting: using :samp:`,`, or :samp:`;` as the first character forces |
|
130 | * Auto-quoting: using :samp:`,`, or :samp:`;` as the first character forces | |
131 | auto-quoting of the rest of the line: :samp:`,my_function a b` becomes |
|
131 | auto-quoting of the rest of the line: :samp:`,my_function a b` becomes | |
132 | automatically :samp:`my_function("a","b")`, while :samp:`;my_function a b` |
|
132 | automatically :samp:`my_function("a","b")`, while :samp:`;my_function a b` | |
133 | becomes :samp:`my_function("a b")`. |
|
133 | becomes :samp:`my_function("a b")`. | |
134 |
|
134 | |||
135 | * Extensible input syntax. You can define filters that pre-process |
|
135 | * Extensible input syntax. You can define filters that pre-process | |
136 | user input to simplify input in special situations. This allows |
|
136 | user input to simplify input in special situations. This allows | |
137 | for example pasting multi-line code fragments which start with |
|
137 | for example pasting multi-line code fragments which start with | |
138 | :samp:`>>>` or :samp:`...` such as those from other python sessions or the |
|
138 | :samp:`>>>` or :samp:`...` such as those from other python sessions or the | |
139 | standard Python documentation. |
|
139 | standard Python documentation. | |
140 |
|
140 | |||
141 | * Flexible configuration system. It uses a configuration file which |
|
141 | * Flexible configuration system. It uses a configuration file which | |
142 | allows permanent setting of all command-line options, module |
|
142 | allows permanent setting of all command-line options, module | |
143 | loading, code and file execution. The system allows recursive file |
|
143 | loading, code and file execution. The system allows recursive file | |
144 | inclusion, so you can have a base file with defaults and layers |
|
144 | inclusion, so you can have a base file with defaults and layers | |
145 | which load other customizations for particular projects. |
|
145 | which load other customizations for particular projects. | |
146 |
|
146 | |||
147 | * Embeddable. You can call IPython as a python shell inside your own |
|
147 | * Embeddable. You can call IPython as a python shell inside your own | |
148 | python programs. This can be used both for debugging code or for |
|
148 | python programs. This can be used both for debugging code or for | |
149 | providing interactive abilities to your programs with knowledge |
|
149 | providing interactive abilities to your programs with knowledge | |
150 | about the local namespaces (very useful in debugging and data |
|
150 | about the local namespaces (very useful in debugging and data | |
151 | analysis situations). |
|
151 | analysis situations). | |
152 |
|
152 | |||
153 | * Easy debugger access. You can set IPython to call up an enhanced |
|
153 | * Easy debugger access. You can set IPython to call up an enhanced version of | |
154 |
|
|
154 | the Python debugger (pdb) every time there is an uncaught exception. This | |
155 |
|
|
155 | drops you inside the code which triggered the exception with all the data | |
156 | the exception with all the data live and it is possible to |
|
156 | live and it is possible to navigate the stack to rapidly isolate the source | |
157 | navigate the stack to rapidly isolate the source of a bug. The |
|
157 | of a bug. The :samp:`%run` magic command (with the :samp:`-d` option) can run | |
158 | :samp:`%run` magic command (with the :samp:`-d` option) can run any script under |
|
158 | any script under pdb's control, automatically setting initial breakpoints for | |
159 | pdb's control, automatically setting initial breakpoints for you. |
|
159 | you. This version of pdb has IPython-specific improvements, including | |
160 | This version of pdb has IPython-specific improvements, including |
|
160 | tab-completion and traceback coloring support. For even easier debugger | |
161 | tab-completion and traceback coloring support. For even easier |
|
161 | access, try :samp:`%debug` after seeing an exception. winpdb is also | |
162 | debugger access, try :samp:`%debug` after seeing an exception. winpdb is |
|
162 | supported, see ipy_winpdb extension. | |
163 | also supported, see ipy_winpdb extension. |
|
|||
164 |
|
163 | |||
165 | * Profiler support. You can run single statements (similar to |
|
164 | * Profiler support. You can run single statements (similar to | |
166 | :samp:`profile.run()`) or complete programs under the profiler's control. |
|
165 | :samp:`profile.run()`) or complete programs under the profiler's control. | |
167 | While this is possible with standard cProfile or profile modules, |
|
166 | While this is possible with standard cProfile or profile modules, | |
168 | IPython wraps this functionality with magic commands (see :samp:`%prun` |
|
167 | IPython wraps this functionality with magic commands (see :samp:`%prun` | |
169 | and :samp:`%run -p`) convenient for rapid interactive work. |
|
168 | and :samp:`%run -p`) convenient for rapid interactive work. | |
170 |
|
169 | |||
171 | * Doctest support. The special :samp:`%doctest_mode` command toggles a mode |
|
170 | * Doctest support. The special :samp:`%doctest_mode` command toggles a mode | |
172 | that allows you to paste existing doctests (with leading :samp:`>>>` |
|
171 | that allows you to paste existing doctests (with leading :samp:`>>>` | |
173 | prompts and whitespace) and uses doctest-compatible prompts and |
|
172 | prompts and whitespace) and uses doctest-compatible prompts and | |
174 | output, so you can use IPython sessions as doctest code. |
|
173 | output, so you can use IPython sessions as doctest code. | |
175 |
|
174 | |||
176 | Interactive parallel computing |
|
175 | Interactive parallel computing | |
177 | ============================== |
|
176 | ============================== | |
178 |
|
177 | |||
179 |
Increasingly, parallel computer hardware, such as multicore CPUs, clusters and |
|
178 | Increasingly, parallel computer hardware, such as multicore CPUs, clusters and | |
180 | architecture within IPython that allows such hardware to be used quickly and easily |
|
179 | supercomputers, is becoming ubiquitous. Over the last 3 years, we have | |
181 | from Python. Moreover, this architecture is designed to support interactive and |
|
180 | developed an architecture within IPython that allows such hardware to be used | |
182 | collaborative parallel computing. |
|
181 | quickly and easily from Python. Moreover, this architecture is designed to | |
|
182 | support interactive and collaborative parallel computing. | |||
183 |
|
183 | |||
184 | The main features of this system are: |
|
184 | The main features of this system are: | |
185 |
|
185 | |||
186 | * Quickly parallelize Python code from an interactive Python/IPython session. |
|
186 | * Quickly parallelize Python code from an interactive Python/IPython session. | |
187 |
|
187 | |||
188 | * A flexible and dynamic process model that be deployed on anything from |
|
188 | * A flexible and dynamic process model that be deployed on anything from | |
189 | multicore workstations to supercomputers. |
|
189 | multicore workstations to supercomputers. | |
190 |
|
190 | |||
191 | * An architecture that supports many different styles of parallelism, from |
|
191 | * An architecture that supports many different styles of parallelism, from | |
192 | message passing to task farming. And all of these styles can be handled |
|
192 | message passing to task farming. And all of these styles can be handled | |
193 | interactively. |
|
193 | interactively. | |
194 |
|
194 | |||
195 | * Both blocking and fully asynchronous interfaces. |
|
195 | * Both blocking and fully asynchronous interfaces. | |
196 |
|
196 | |||
197 | * High level APIs that enable many things to be parallelized in a few lines |
|
197 | * High level APIs that enable many things to be parallelized in a few lines | |
198 | of code. |
|
198 | of code. | |
199 |
|
199 | |||
200 | * Write parallel code that will run unchanged on everything from multicore |
|
200 | * Write parallel code that will run unchanged on everything from multicore | |
201 | workstations to supercomputers. |
|
201 | workstations to supercomputers. | |
202 |
|
202 | |||
203 | * Full integration with Message Passing libraries (MPI). |
|
203 | * Full integration with Message Passing libraries (MPI). | |
204 |
|
204 | |||
205 | * Capabilities based security model with full encryption of network connections. |
|
205 | * Capabilities based security model with full encryption of network connections. | |
206 |
|
206 | |||
207 |
* Share live parallel jobs with other users securely. We call this |
|
207 | * Share live parallel jobs with other users securely. We call this | |
208 | parallel computing. |
|
208 | collaborative parallel computing. | |
209 |
|
209 | |||
210 | * Dynamically load balanced task farming system. |
|
210 | * Dynamically load balanced task farming system. | |
211 |
|
211 | |||
212 | * Robust error handling. Python exceptions raised in parallel execution are |
|
212 | * Robust error handling. Python exceptions raised in parallel execution are | |
213 | gathered and presented to the top-level code. |
|
213 | gathered and presented to the top-level code. | |
214 |
|
214 | |||
215 |
For more information, see our :ref:`overview <parallel_index>` of using IPython |
|
215 | For more information, see our :ref:`overview <parallel_index>` of using IPython | |
216 | parallel computing. |
|
216 | for parallel computing. | |
217 |
|
217 | |||
218 | Portability and Python requirements |
|
218 | Portability and Python requirements | |
219 | ----------------------------------- |
|
219 | ----------------------------------- | |
220 |
|
220 | |||
221 | As of the 0.9 release, IPython requires Python 2.4 or greater. We have |
|
221 | As of the 0.9 release, IPython requires Python 2.4 or greater. We have | |
222 | not begun to test IPython on Python 2.6 or 3.0, but we expect it will |
|
222 | not begun to test IPython on Python 2.6 or 3.0, but we expect it will | |
223 | work with some minor changes. |
|
223 | work with some minor changes. | |
224 |
|
224 | |||
225 | IPython is known to work on the following operating systems: |
|
225 | IPython is known to work on the following operating systems: | |
226 |
|
226 | |||
227 | * Linux |
|
227 | * Linux | |
228 | * AIX |
|
228 | * Most other Unix-like OSs (AIX, Solaris, BSD, etc.) | |
229 | * Most other Unix-like OSs (Solaris, BSD, etc.) |
|
|||
230 | * Mac OS X |
|
229 | * Mac OS X | |
231 | * Windows (CygWin, XP, Vista, etc.) |
|
230 | * Windows (CygWin, XP, Vista, etc.) | |
232 |
|
231 | |||
233 | See :ref:`here <install_index>` for instructions on how to install IPython. No newline at end of file |
|
232 | See :ref:`here <install_index>` for instructions on how to install IPython. |
@@ -1,14 +1,14 b'' | |||||
1 | .. _parallel_index: |
|
1 | .. _parallel_index: | |
2 |
|
2 | |||
3 | ==================================== |
|
3 | ==================================== | |
4 | Using IPython for parallel computing |
|
4 | Using IPython for parallel computing | |
5 | ==================================== |
|
5 | ==================================== | |
6 |
|
6 | |||
7 | .. toctree:: |
|
7 | .. toctree:: | |
8 | :maxdepth: 2 |
|
8 | :maxdepth: 2 | |
9 |
|
9 | |||
10 | parallel_intro.txt |
|
10 | parallel_intro.txt | |
11 | parallel_multiengine.txt |
|
11 | parallel_multiengine.txt | |
12 | parallel_task.txt |
|
12 | parallel_task.txt | |
13 | parallel_mpi.txt |
|
13 | parallel_mpi.txt | |
14 |
|
14 | visionhpc.txt |
1 | NO CONTENT: modified file chmod 100644 => 100755 |
|
NO CONTENT: modified file chmod 100644 => 100755 |
General Comments 0
You need to be logged in to leave comments.
Login now