jamescasbon/PyVCF — pull request #41 by marcelm (2012-05-18 10:35:29+00:00)
Title: Python 3 support

Hello James,

I have made a few small changes to PyVCF so that it works with Python 2 and 3. I have seen your 'python3' branch, but it seems to be a bit out of date. My approach is to change the Python 2 code such that the 2to3 output runs without manual fixes. The advantage is that there would be no separate Python 3 branch, just one source package that works both in Python 2 and in Python 3 (by calling 2to3 during install) .

Since setuptools doesn't support Python 3, I changed setup.py to use distribute instead of setuptools.

One problem is that the tests aren't automatically converted when 'python3 setup.py test' is called. To run the tests manually, I use this line:

cp -a test test3 ; 2to3 -w test3/*.py ; python3 setup.py test -s test3.test_vcf.suite

It isn't straightforward to fix this. With pure distutils, there's a solution here: http://mail.python.org/pipermail/distutils-sig/2010-August/016780.html

Also, in Python 3, there are now two additional failures within tests that use pysam.Tabixfile, which I guess is ok considering that the pysam port to Python 3 isn't complete.