[Distutils] Having a Python package install itself under a different name

P.J. Eby pje at telecommunity.com
Thu May 27 23:28:27 CEST 2010

At 11:16 PM 5/27/2010 +0200, cool-RR wrote:
>On Thu, May 27, 2010 at 11:03 PM, P.J. Eby 
><<mailto:pje at telecommunity.com>pje at telecommunity.com> wrote:
>At 10:40 PM 5/27/2010 +0200, cool-RR wrote:
>Is there a way that `garlicsim_py3` will install itself under the 
>alias `garlicsim`? What I want is for a Python 3 user to be able to 
>`import garlicsim` and refer to the module all the time as 
>`garlicsim`, but that it will really be `garlicsim_py3`.
>Why not just develop them both with the same package name?  Your 
>project name (in setup(name='...')) can still be different.
>Oh, I didn't even know that was possible. That sounds great, and I 
>wish I would have known about this option 6 months ago.
>If this works well, I'll start converting my entire codebase to this 
>method. Before I jump in, is there anything important I should keep 
>in mind, any possible problems?
>Also, this is plain setuptools, right? I mean, not requiring Distribute.

It works with plain distutils, too.  Just use 
setup(name='garlicsym_py3', packages=['garlicsym']) in your Python 3 
branch of setup.py, and setup(name='garlicsym', 
packages=['garlicsym']) in your Python 2 branch.

More information about the Distutils-SIG mailing list