[Distutils] Installing subpackages under common superpackage

Rob Healey robhealey1 at gmail.com
Tue Apr 3 17:53:11 CEST 2012


Dear Otto:

The only way that I could tell you about a project that kind of does what
you are looking for is already done somewhat in Distutils2-1.0a4 tarball...

You may get the tarball from here, and look at its setup.py and setup.cfg
files...

http://pypi.python.org/pypi/Distutils2

Sincerely yours,
Rob G. Healey




On Tue, Apr 3, 2012 at 8:35 AM, Otto Maddox <ottomaddox at fastmail.fm> wrote:

> Hi,
>
> I have a Python project which follows a client-server architecture. It
> is natural to develop it as two different projects and in two different
> source distributions, myproject-server.tar.gz and
> myproject-client.tar.gz.
>
> Neither package depends on the other, but because they are part of a
> larger, overarching project, I want install each of them so that they
> appear as subpackages (myproject.server and myproject.client) under a
> common superpackage (myproject). I am looking for the cleanest and most
> correct way to do this using distutils and setup.py, so that I can end
> up with a structure like this:
>
> site-packages/myproject
> site-packages/myproject/__init__.py
>
> site-packages/myproject/server/__init__.py
> site-packages/myproject/server/file1.py
> site-packages/myproject/server/file2.py
>
> site-packages/myproject/client/__init__.py
> site-packages/myproject/client/file3.py
> site-packages/myproject/client/file4.py
>
> and so that any of the following commands (and their standard
> variations) work:
>
> import myproject
> import myproject.server
> import myproject.client
>
> Is there a way to write distutils/setup.py to do this?
>
> I have tried something like packages = ["myproject", "myproject.client"]
> in the client's setup.py and packages = ["myproject",
> "myproject.server"] in the server's setup.py. This kind of works, but it
> feels wrong because the second package which gets installed will
> overwrite files from the first -- for example, there is no clean way to
> install myproject/__init__.py.
>
> I can't imagine that I'm the first person to want to address this use
> case. What would be the best way of doing this?
>
> Finally, does anybody have any examples of other projects which do a
> similar thing? Thanks.
>
> --
> http://www.fastmail.fm - Email service worth paying for. Try it for free
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> http://mail.python.org/mailman/listinfo/distutils-sig
>



-- 
Sincerely yours,
Rob G. Healey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20120403/8a082220/attachment.html>


More information about the Distutils-SIG mailing list