Search code examples
pythonpython-2.7python-3.xpippypi

how to develop pypi package for python3 and python2


Can anyone point me toward a tutorial explaining how to implement a pypi package with support for both python2 and python3? Google did not provide an answer so this is my next option! Thank you.


Solution

  • The problem with many tutorials out there on Python packing is that they try to cover a lot of ground, with so many possible options. When I was at this stage, I found them very confusing, given the number of variables you might encounter, and the amount of Python historical packaging issues some of them still lead you through.

    My recommended is to instead take a module that you know runs well across Python 2 and Python 3, and that installs to PyPI, and study it. Modify it, replacing parts with your own desired code and module configuration. You can always compare what you know works to what you currently have, giving you a solid base for testing and exploration.

    I unhumbly offer you my intspan module as one such starting point. It runs across a great many Python implementations, including 2 and 3. It has extensive test coverage. And its source is readily available for cloning. If not intspan, take some other module as your starting point, rather than an abstract tutorial.