Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Python 3 support #41

merged 6 commits into from May 22, 2012


None yet
3 participants

marcelm commented May 18, 2012

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.


jamescasbon commented May 18, 2012

Thanks! I will review and get back to you. There are a few things pulling different ways. There is a cython port now, which may replace the pure python module. Also, there is a GSOC looking to pull it into biopython. So lots of different compatibility issues. However, I hope this can just go straight in as is.

This would be great to get in for Biopython compatibility. Biopython currently supports Python 3 through the same 2to3 approach. @peterjc and @etal have done a lot of work on this so may be able to make suggestions.

@jamescasbon jamescasbon pushed a commit that referenced this pull request May 22, 2012

James Casbon Merge pull request #41 from marcelm/master
Python 3 support

@jamescasbon jamescasbon merged commit 3d6f87c into jamescasbon:master May 22, 2012


jamescasbon commented May 22, 2012

Doesn't seem to work on travis, any idea why?


jamescasbon commented May 22, 2012

Ignore me, that is the pysam build failing on Python 3.2

@gotgenes gotgenes pushed a commit to gotgenes/PyVCF that referenced this pull request May 13, 2014

James Casbon Merge pull request #41 from marcelm/master
Python 3 support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment