How to organize Python modules for PyPI to support 2.x and 3.x

Posted by Craig McQueen on Stack Overflow See other posts from Stack Overflow or by Craig McQueen
Published on 2010-03-08T00:25:57Z Indexed on 2010/04/28 11:43 UTC
Read the original article Hit count: 995

I have a Python module that I would like to upload to PyPI. So far, it is working for Python 2.x. It shouldn't be too hard to write a version for 3.x now.

But, after following guidelines for making modules in these places:

it's not clear to me how to support multiple source distributions for different versions of Python, and it's not clear if/how PyPI could support it. I envisage I would have separate code for:

  • 2.x
  • 2.6 (maybe, as a special case to use the new buffer API)
  • 3.x

How is it possible to set up a Python module in PyPI so that someone can do:

easy_install modulename

and it will install the right thing whether the user is using 2.x or 3.x?

© Stack Overflow or respective owner

Related posts about python

Related posts about python-2.x