overview.txt
329 lines
| 12.8 KiB
| text/plain
|
TextLexer
Fernando Perez
|
r1754 | .. This file has a lot of bash but little python, set default role | ||
.. highlight:: bash | ||||
Brian E Granger
|
r1256 | .. _development: | ||
Fernando Perez
|
r1725 | ============================== | ||
Fernando Perez
|
r1754 | IPython development overview | ||
Fernando Perez
|
r1725 | ============================== | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | Currently, IPython's development tree contains all of the code that used to be | ||
part of IPython since the project's inception in 2001, plus all of the effort | ||||
Fernando Perez
|
r1754 | that was known for a while (roughly 2004-2008) as ``IPython1``. The IPyhton1 | ||
Fernando Perez
|
r1753 | development was meant to be an effort to: | ||
Brian E Granger
|
r1256 | |||
1. Clean up the existing codebase and write lots of tests. | ||||
Fernando Perez
|
r1753 | |||
2. Separate the core functionality of IPython from the terminal to enable | ||||
IPython to be used from within a variety of GUI applications. | ||||
Brian E Granger
|
r1256 | 3. Implement a system for interactive parallel computing. | ||
Fernando Perez
|
r1697 | While the third goal may seem a bit unrelated to the main focus of IPython, it | ||
turns out that the technologies required for this goal are nearly identical | ||||
with those required for goal two. This is the main reason the interactive | ||||
Fernando Perez
|
r1754 | parallel computing capabilities are being put into IPython proper. | ||
In the summer of 2008, the IPython1 code was merged back into the mainline, and | ||||
now there is a unified codebase. While the above goals aren't completely | ||||
implemented for the older code, we do have a proper :ref:`testing system | ||||
<devel-testing>` in place (though this is still evolving), unified | ||||
documentation and partial implementations of the more separated components. | ||||
Brian E Granger
|
r1256 | |||
This document describes IPython from the perspective of developers. | ||||
Project organization | ||||
==================== | ||||
Subpackages | ||||
----------- | ||||
Fernando Perez
|
r1697 | IPython is organized into semi self-contained subpackages. Each of the | ||
subpackages will have its own: | ||||
Brian E Granger
|
r1256 | |||
- **Dependencies**. One of the most important things to keep in mind in | ||||
partitioning code amongst subpackages, is that they should be used to cleanly | ||||
Fernando Perez
|
r1697 | encapsulate dependencies. | ||
Brian E Granger
|
r1256 | - **Tests**. Each subpackage shoud have its own ``tests`` subdirectory that | ||
Fernando Perez
|
r1697 | contains all of the tests for that package. For information about writing | ||
Fernando Perez
|
r1754 | tests for IPython, see the :ref:`Testing System <devel-testing>` section of | ||
this document. | ||||
Fernando Perez
|
r1697 | |||
- **Configuration**. Each subpackage should have its own ``config`` | ||||
subdirectory that contains the configuration information for the components | ||||
of the subpackage. For information about how the IPython configuration | ||||
Fernando Perez
|
r1754 | system works, see the :ref:`Configuration System <devel-config>` section of | ||
this document. | ||||
Fernando Perez
|
r1697 | |||
- **Scripts**. Each subpackage should have its own ``scripts`` subdirectory | ||||
that contains all of the command line scripts associated with the subpackage. | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | |||
Brian E Granger
|
r1256 | Installation and dependencies | ||
----------------------------- | ||||
Fernando Perez
|
r1697 | IPython will not use `setuptools`_ for installation. Instead, we will use | ||
standard ``setup.py`` scripts that use `distutils`_. While there are a number a | ||||
extremely nice features that `setuptools`_ has (like namespace packages), the | ||||
current implementation of `setuptools`_ has performance problems, particularly | ||||
on shared file systems. In particular, when Python packages are installed on | ||||
NSF file systems, import times become much too long (up towards 10 seconds). | ||||
Brian E Granger
|
r1256 | |||
Because IPython is being used extensively in the context of high performance | ||||
Fernando Perez
|
r1697 | computing, where performance is critical but shared file systems are common, we | ||
feel these performance hits are not acceptable. Thus, until the performance | ||||
problems associated with `setuptools`_ are addressed, we will stick with plain | ||||
`distutils`_. We are hopeful that these problems will be addressed and that we | ||||
will eventually begin using `setuptools`_. Because of this, we are trying to | ||||
organize IPython in a way that will make the eventual transition to | ||||
`setuptools`_ as painless as possible. | ||||
Because we will be using `distutils`_, there will be no method for | ||||
automatically installing dependencies. Instead, we are following the approach | ||||
of `Matplotlib`_ which can be summarized as follows: | ||||
Brian E Granger
|
r1256 | |||
- Distinguish between required and optional dependencies. However, the required | ||||
dependencies for IPython should be only the Python standard library. | ||||
Fernando Perez
|
r1697 | |||
- Upon installation check to see which optional dependencies are present and | ||||
tell the user which parts of IPython need which optional dependencies. | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1697 | It is absolutely critical that each subpackage of IPython has a clearly | ||
specified set of dependencies and that dependencies are not carelessly | ||||
inherited from other IPython subpackages. Furthermore, tests that have certain | ||||
dependencies should not fail if those dependencies are not present. Instead | ||||
they should be skipped and print a message. | ||||
Brian E Granger
|
r1256 | |||
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools | ||||
.. _distutils: http://docs.python.org/lib/module-distutils.html | ||||
.. _Matplotlib: http://matplotlib.sourceforge.net/ | ||||
Specific subpackages | ||||
-------------------- | ||||
``core`` | ||||
Brian Granger
|
r1555 | This is the core functionality of IPython that is independent of the | ||
terminal, network and GUIs. Most of the code that is in the current | ||||
IPython trunk will be refactored, cleaned up and moved here. | ||||
Brian E Granger
|
r1256 | |||
``kernel`` | ||||
Brian Granger
|
r1555 | The enables the IPython core to be expose to a the network. This is | ||
also where all of the parallel computing capabilities are to be found. | ||||
Brian E Granger
|
r1256 | ``config`` | ||
Brian Granger
|
r1555 | The configuration package used by IPython. | ||
Brian E Granger
|
r1256 | |||
``frontends`` | ||||
Brian Granger
|
r1555 | The various frontends for IPython. A frontend is the end-user application | ||
Fernando Perez
|
r1697 | that exposes the capabilities of IPython to the user. The most basic | ||
frontend will simply be a terminal based application that looks just like | ||||
today 's IPython. Other frontends will likely be more powerful and based | ||||
on GUI toolkits. | ||||
Brian E Granger
|
r1256 | |||
``tools`` | ||||
Brian Granger
|
r1555 | This is where general utilities go. | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1754 | Version control workflow | ||
======================== | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | All IPython development today is done using the `Bazaar`__ system for | ||
distributed version control and the `Launchpad`__ site for code hosting and bug | ||||
tracking. This makes it very easy for anyone to contribute code to IPython. | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | .. __: http://bazaar-vcs.org | ||
.. __: http://launchpad.net/ipython | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | If you are interested in contributing to IPython, you should familiarize a bit | ||
with how to use bazaar, but this document gives you a concise set of steps to | ||||
get started. If you are going to become heavily involved with creating code | ||||
for IPython you'll eventually want to have a Launchpad account (free) so you | ||||
can publish your own code on the site for review and merging, but small | ||||
contributions can be simply sent via email to the IPython list as patches. | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1754 | Start by creating what Bazaar calls a `shared repository`_:: | ||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | # You can choose any name you want instead of "ipython-repo" | ||
bzr init-repo ipython-repo | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | .. _shared repository: http://bazaar-vcs.org/SharedRepositoryTutorial | ||
Fernando Perez
|
r1270 | |||
Fernando Perez
|
r1753 | This creates an empty repository where a lot of related branches can be kept, | ||
and they all reuse common storage. This way, many operations are very fast and | ||||
take up less space. Now, go to the newly created repository and make a local | ||||
Fernando Perez
|
r1754 | branch of the public trunk:: | ||
Fernando Perez
|
r1270 | |||
Fernando Perez
|
r1753 | cd ipython-repo | ||
# This makes a local copy of the public trunk called "trunk-lp" | ||||
bzr branch lp:ipython trunk-lp | ||||
The ``trunk-lp`` branch is meant to always be a pristine copy of the public | ||||
trunk. From here, make a personal development copy of the public trunk, where | ||||
Fernando Perez
|
r1754 | you'll make your changes:: | ||
Fernando Perez
|
r1270 | |||
Fernando Perez
|
r1753 | bzr branch trunk-lp trunk-dev | ||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | Now, your working area looks like this:: | ||
Brian Granger
|
r1555 | |||
Fernando Perez
|
r1753 | maqroll[ipython-repo]> ls -a | ||
./ ../ .bzr/ trunk-dev/ trunk-lp/ | ||||
The ``.bzr`` directory is the Bazaar storage area, and you now have both the | ||||
reference copy of the public trunk and one working copy for your own | ||||
development. You can later make further branches as needed (a common workflow | ||||
is to make branches to contain specific feature implementations until they are | ||||
ready to be merged). | ||||
The typical work cycle will be to make changes in ``trunk-dev`` and then commit | ||||
Fernando Perez
|
r1754 | those changes as often as needed:: | ||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | cd trunk-dev | ||
# ... implement cool new feature... | ||||
bzr commit -m "Commit message goes here." | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | Please note that since we now don't use an old-style linear ChangeLog (that | ||
tends to cause problems with distributed version control systems), you should | ||||
ensure that your log messages are reasonably detailed. For non-trivial | ||||
changes, use a docstring-like approach in the commit messages (including the | ||||
second line being left *blank*). Type ``bzr commit`` *without* the ``-m`` | ||||
switch, and Bazaar will open an editor where you can type a more detailed | ||||
message:: | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | Single line summary of changes being committed. | ||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | - more details when warranted ... | ||
- including crediting outside contributors if they sent the | ||||
code/bug/idea! | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | If we couple this with a policy of making single commits for each reasonably | ||
atomic change, the bzr log should give an excellent view of the project, and | ||||
the ``--short`` log option becomes a nice summary. | ||||
Brian E Granger
|
r1269 | |||
Fernando Perez
|
r1753 | As you work on the branch, it's a good idea to frequently keep your copy of the | ||
Fernando Perez
|
r1754 | trunk updated with respect to Launchpad. This is done via:: | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | cd trunk-lp | ||
bzr pull | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | Bazaar can then merge any changes that were done to the public trunk into your | ||
Fernando Perez
|
r1754 | local branch via:: | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | cd trunk-dev | ||
bzr merge ../trunk-lp | ||||
bzr commit -m"Merged upstream changes" | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | This workflow ensures that a local copy stays in sync with the public trunk, | ||
while allowing for local development to be pushed back for public review. | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | Once your changes are ready for review, you can push them to Launchpad where | ||
Fernando Perez
|
r1754 | the IPython team can review them and give you feedback. The first time, use:: | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1754 | bzr push --remember \ | ||
bzr+ssh://<you>@bazaar.launchpad.net/~<you>/ipython/trunk-dev | ||||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | where ``<you>`` is your Launchpad user name. This will make this branch | ||
Fernando Perez
|
r1754 | publicly visible to all. In subsequent uses you can simply run in the branch:: | ||
Brian E Granger
|
r1256 | |||
Fernando Perez
|
r1753 | bzr push | ||
.. note:: | ||||
Before you can push your code to Launchpad, you need to configure your SSH | ||||
keys. You can do this by clicking on ``Change details`` for your profile | ||||
and then clicking on the ``SSH Keys`` tab. This should take you to a URL | ||||
of the form ``https://launchpad.net/~<you>/+editsshkeys`` with instructions | ||||
on how to upload your keys. | ||||
Once the branch is publicly visible, using the launchpad interface it can be | ||||
Fernando Perez
|
r1754 | marked for merging with the link marked *"Propose for merging into another | ||
branch"*, leaving the default choice of trunk as its target. This way, | ||||
Launchpad tracks what changes of this branch are new with respect to the trunk, | ||||
others in the team can review it, and merge the changes into the trunk. | ||||
Fernando Perez
|
r1753 | |||
The IPython team has a policy of reviewing all code (both from core members of | ||||
the team and from external contributors) before merging it. Code should be | ||||
clearly documented (as explained further in this guide), clear and well tested. | ||||
We will be happy to provide you with feedback for your code to be a great | ||||
contribution to the project, and we've found that peer review of code is an | ||||
excellent way to improve the quality of everyone's work. | ||||
Brian E Granger
|
r1256 | |||
Brian Granger
|
r1551 | Installation and testing scenarios | ||
================================== | ||||
Fernando Perez
|
r1697 | This section outlines the various scenarios that we need to test before we | ||
release an IPython version. These scenarios represent different ways of | ||||
installing IPython and its dependencies. | ||||
Brian Granger
|
r1551 | |||
Fernando Perez
|
r1754 | |||
Brian Granger
|
r1561 | Installation scenarios under Linux and OS X | ||
------------------------------------------- | ||||
Brian Granger
|
r1551 | |||
Fernando Perez
|
r1754 | 1. Install from tarball using ``python setup.py install``. | ||
* With only readline+nose dependencies installed. | ||||
* With all dependencies installed (readline, zope.interface, Twisted, | ||||
foolscap, Sphinx, nose, pyOpenSSL). | ||||
2. Install using easy_install. | ||||
* With only readline+nose dependencies installed. | ||||
* Default dependencies: ``easy_install ipython-0.9.beta3-py2.5.egg`` | ||||
Fernando Perez
|
r1695 | |||
Fernando Perez
|
r1754 | * Optional dependency sets: | ||
``easy_install -f ipython-0.9.beta3-py2.5.egg IPython[kernel,doc,test,security]`` | ||||
Fernando Perez
|
r1695 | |||
Fernando Perez
|
r1754 | * With all dependencies already installed. | ||
Fernando Perez
|
r1695 | |||
Brian Granger
|
r1551 | |||
Brian Granger
|
r1561 | Installation scenarios under Win32 | ||
---------------------------------- | ||||
Fernando Perez
|
r1754 | #. Install everything from .exe installers | ||
#. easy_install? | ||||
Brian Granger
|
r1561 | |||
Brian Granger
|
r1551 | |||
Tests to run for these scenarios | ||||
-------------------------------- | ||||
Fernando Perez
|
r1754 | #. Run the full test suite. | ||
#. Start a controller and engines and try a few things by hand. | ||||
* Using ipcluster. | ||||
* Using ipcontroller/ipengine by hand. | ||||
#. Run a few of the parallel examples. | ||||
#. Try the kernel with and without security with and without PyOpenSSL | ||||
installed. | ||||
#. Beat on the IPython terminal a bunch. | ||||
Fernando Perez
|
r1695 | |||
Fernando Perez
|
r1754 | #. Make sure that furl files are being put in proper locations. | ||
Fernando Perez
|
r1725 | |||
Release checklist | ||||
================= | ||||
Most of the release process is automated by the :file:`release` script in the | ||||
:file:`tools` directory. This is just a handy reminder for the release manager. | ||||
#. Run the release script, which makes the tar.gz, eggs and Win32 .exe | ||||
installer. It posts them to the site and registers the release with PyPI. | ||||
#. Updating the website with announcements and links to the updated changes.txt | ||||
in html form. Remember to put a short note both on the news page of the site | ||||
and on launcphad. | ||||
#. Drafting a short release announcement with i) highlights and ii) a link to | ||||
the html changes.txt. | ||||
#. Make sure that the released version of the docs is live on the site. | ||||
#. Celebrate! | ||||