How to organize modules for PyPI to support 2.x and 3.x
- by Craig McQueen
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:
Distributing Python Modules
The Hitchhiker’s Guide to Packaging
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?