Is it possible to deliver different source distributions for different Python versions?

Dave Hein jenesuispasdave at gmail.com
Mon Apr 6 20:48:31 EDT 2015


On Sunday, April 5, 2015 at 10:28:55 PM UTC-5, Mark Lawrence wrote:
> On 05/04/2015 21:38, Dave Hein wrote:
> > I would like to distribute a python package with different code for
> > Python 2.* than for Python 3.*. (Mostly this is because of different
> > unicode string handling).
> >
> > There is nothing in to setuptools or PyPi that directly supports
> > this scenario.
> >
> > But perhaps there could be some script run at install time that moves
> > the correct source code to the right location? In other works, if I
> > included both source code versions in the distribution (in a src2 and
> > a src3 subdirectory) then a function invoked at install time could
> > detect the python version and copy the appropriate source code to the
> > right location.
> >
> > Is that at all possible? Is there some install time hook that lets me
> > supply custom installation code?
> >
> > --
> > Dave Hein
> >
> 
> I can't help directly but have you looked here 
> https://packaging.python.org/en/latest/ ?

Yep. I looked there first and from that thought that I could 
distribute "wheels" -- a 2.7 wheel, a 3.3 wheel, and a 3.4 wheel.
But the latest setup.py (version 15.0) doesn't build wheels anymore.
It does build binary distributions, but they are tied more to a
particular version of a particular OS rather than to a particular
version of Python.

So, anyway, I think parts of that documentation site are out of
date. And I didn't see anything that let me do what I wanted.

> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

--
Dave Hein



More information about the Python-list mailing list