I have a package that works on Python 2.4-2.7. 3.2-3.7. Note this is not for all of Python 2 or Python 3 but specific versions.
It also happens that this package supports Python 2.4 and 2.5 with different source code.
I had been distributing eggs for each version because that is very specific and I setup.py bdist_wheel
was creating something too broad that would match Python versions I don't want to match on.
When I had created a wheel I would the extension py2.py3-non-any.whl
which is wrong for Python 2.4 and 2.5. (And so is the tarball).
PyPi will allow only one tarball so right now I use the non 2.4, 2.5 source. It would be nice to be able to include the 2.4 2.5 source as well. Hmm, maybe I can do that as a zip? (Probably not).
How do I inform setup.py that I want just a py35-non-any.whl
? Or py2 specified for 2.6 or 2.7? And py3 for just 3.2 and greater.
Or more generally what is an easy way to set things up so that pip will pick the right pypi file no matter what python version one is running?
When you run setup.py bdist_wheel
and it creates something too general, here is something simple minded one can do: just rename the file.
I tried this on a distribution in Pypi and it works: the wheel is preferred over the tarball and it pulls down the wheel for that version. Running the program subsequently works.
In my specific case, setup.py bdist_wheel
created foo-1.2.3-py2.py3-none-any.whl
but that was wrong because don't want all versions of Python 2 and Python 3 but some very specific versions.
But, for example, if I want this to adjust to only work on Python 2.7 and Python 3.6, I rename/copy to:
foo-1.2.3-py27-none-any.whl
foo-1.2.3-py36-none-any.whl
There may be other thoughts and ideas on how to accomplish, so I leave this open. If this indeed is the simplest thing to do, it might be nice if there were an option inside setup.py or whatever it is that handles bdist_wheel
so that it would do the rename for you.
Are ranges allowed in the naming convention so that one can specify say 3.5-3.7 ? Or can one somehow give a list like py25.py26.py27
?