Sharing code between different projects?

dieter dieter at handshake.de
Thu Sep 28 02:21:34 EDT 2017


> On Monday, August 13, 2012 at 7:53:32 PM UTC+3, andrea crotti wrote:
>> I am in the situation where I am working on different projects that
>> might potentially share a lot of code.
>> 
>> I started to work on project A, then switched completely to project B
>> and in the transiction I copied over a lot of code with the
>> corresponding tests, and I started to modify it.
>> 
>> Now it's time to work again on project A, but I don't want to copy
>> things over again.

I use so called "namespace packages" for this. Those are "virtual" packages
"containing" a set of related "real" packages -  individually manageable
on PyPI.  The "real" packages describe in their dependencies on which
other packages they depend, among them (potentially) "friend" packages.

An example is "dm.zope.rpc" and "dm.zope.rpc.wsdl_suds". In this case,
"dm.zope.rpc" provides general rpc infrastructure for the web
application framework Zope and implementations for some elementary
rpc protocols and "dm.zipe.rpc.wsdl_suds" uses this infrastructure
for the implementation of a WSDL based rpc protocol by means of "suds".




More information about the Python-list mailing list