Python Sprint

For the Flourish 2011 Hack-a-thon, we have teamed up with the Python Software Foundation (PSF) to host an official PSF sponsored Python Sprint!  By participating in the Flourish Python Sprint, you'll have an opportunity to contribute to more than just a project but to the Python language itself (or one of its popular frameworks).  Contributing at the Flourish Python Sprint is also an excellent way to give back to the open source community.

Depending on the participant's skill level, each participant will have the opportunity to contribute to:

  • Python Core work, e.g., bug triage, documentation
  • Porting libraries/applications to Python 3
  • PyPI and packaging related improvements
  • Contribution to Python VMs, e.g., PyPy, IronPython
  • Contribution to other Python projects, e.g., Django, PIL, pywin32 and so on...

The Flourish Python Sprint will be open to participants during all hours of the conference, day and night.  As long as you keep coding, we'll make it easy for you to keep at it.  Contributors can start coding at the opening of the conference at 4:00 PM on Friday and can continue until the close of the conference on Sunday.  

We are still looking for someone to step up and be a sprint coach for Friday and Saturday.  (We already have a sprint coach for Sunday.)  Sprint coaches should be Python Gurus and should feel comfortable delegating sprint tasks to participants.  Please e-mail joel@flourishconf.com if you are interested in being a sprint coach.

If you are planning to attend the Flourish Python Sprint, please e-mail joel@flourishconf.com so we can get a proper head count before the event begins.  If you would like to know more about PSF sponsored Python Sprints, please visit http://www.pythonsprints.com/.

Getting Ready for the Sprint

If you have never contributed to Python before, we will urge you to contribute to Core Python test coverage. The barrier to entry for writing coverage tests is fairly low, the amount of impact is pretty high and you will get a better understanding of a module you might already be familiar with. The cool thing is that your effort will be propagated down into the other Python implementations (PyPy, IronPython and Jython). So writing one test actually helps out four projects!

To help you determine which modules need testing, please review this snapshot of the Python Test Coverage Report. Try to select modules that have 40% coverage or less.

If you really do not want to work on Core Python test coverage and are also new to Python development, we will urge you work on low hanging fruit from the Python Bug Tracker.

Finally, for more experienced Python developers, Benjamin Trofatter will be continuing his port of PIL to Python 3. He is apparently pretty far along with this port and would like your help with finishing it.

All contributors should be familiar with the Python Developer's Guide up to the section on Running & Writing Tests.
 

Creating a Development Environment

If you don't already have a Python development environment setup, please follow the step below:

Core developer Brett Cannon made a really cool tool to build a python development environment from just a Python 3 script. There are some dependencies however. In Ubuntu 10.04, please install the following packages via the following command:
 

sudo apt-get install python3 python-sphinx libsqlite3-dev libssl-dev libdbm-dev libgdbm-dev  \
    libreadline-dev python-tk python-tk-dbg python3-tk python3-tk-dev python3-tk-dbg libbz2-dev \
    mercurial

Download Brett's script from here and unzip it. (The download is in the menu on the left.) Place the archive contents in a directory where there will be no spaces in the full path. (This script is by no means perfect.) Once you have done that, run the following:
 

./make_a_box.py

Unfortunately, Brett's script has a few errors and breaks when it attempts to create the HTML test coverage report. To generate the HTML test coverage report, run the following commands. More details on this step are available here.
 

cd cpython/
hg clone https://bitbucket.org/ned/coveragepy
ln -s coveragepy/coverage/
./python -m coverage run --pylib Lib/test/regrtest.py
./python -m coverage html -i --omit="*/test/*,*/tests/*"

You can view the coverage report by executing the following command:

firefox htmlcov/index.html

If you have problems, don't worry. We'll be able to help you out when you arrive (or you can e-mail joel@flourishconf.com).

Note, the sprint will be held in the Cardinal Room, within the premises of the conference.

Submitting Your Improvements

It seems like we had several people make significant coverage improvements on Saturday, but few of you returned to submit them on Sunday. If you made any coverage improvements at all, please take some time to follow the instruction below to submit your work.

Assuming you obtained your Python source code by checking it out from the Mercurial repository, creating your patch is easy:

  1. Commit your code if you have not already:
    hg commit
  2. Look in your local repository logs for the commit number just before your commits:
    hg log | more
  3. Create a diff based off that commit number and review it.
    hg diff -r69104:tip
  4. Redirect your diff output into a patch file.
    hg diff -r69104:tip > increase_distutils_filelist_test_coverage.patch

If you didn't check out your code via Mercurial, you can still use the command line version of diff to create your patch file. Be sure to use the "-u" flag. For example:

diff -u original_file.py updated_file.py > increase_distutils_filelist_test_coverage.patch

Next you will need to create a bug to upload your patch to. Go to http://bugs.python.org/ and login or create an account. Create a new issue:

  1. Give your issue an appropriate title
  2. The Type should be "behavior"
  3. Components should be "Tests"
  4. Versions should be (at least) "Python 3.3"
  5. Fill in an appropriate comment.
  6. Upload your patch.
  7. Press "Submit Changes" and take note of your issue number.

Next go to http://wiki.python.org/moin/Flourish2011Sprint, login or create an account. Your username should be your be in the format of your real "FirstnameLastname". Edit the Flourish2011Sprint page and add your username and bug number to the table. Save your changes and you are done!

Please note:  Submit only one patch file and create only one Python issue per modified test file.

Please feel free to email Joel at joel@flourishconf.com if you have any questions.