Distributing 2 python modules with incompatible API

M

mathieu

hi there,

As far as I understand python is not using the usual UNIX system of
soname when two libraries provide incompatible API. So let say I have
a _foo.so version 1.2 and 2.0, all I can (should do) is move them
underneath a subdirectory in site-package:

pythonX.Y/site-package/foo1.2/_foo.so
pythonX.Y/site-package/foo1.2/foo.py
and
pythonX.Y/site-package/foo2.0/_foo.so
pythonX.Y/site-package/foo2.0/foo.py

Then a central foo.pth would (sytem-wide) define which one is the
default version:

pythonX.Y/site-package/foo.pth

If this is correct ? Is there any documentation that I missed ?

Thanks
-Mathieu
 
D

Diez B. Roggisch

mathieu said:
hi there,

As far as I understand python is not using the usual UNIX system of
soname when two libraries provide incompatible API. So let say I have
a _foo.so version 1.2 and 2.0, all I can (should do) is move them
underneath a subdirectory in site-package:

pythonX.Y/site-package/foo1.2/_foo.so
pythonX.Y/site-package/foo1.2/foo.py
and
pythonX.Y/site-package/foo2.0/_foo.so
pythonX.Y/site-package/foo2.0/foo.py

Then a central foo.pth would (sytem-wide) define which one is the
default version:

pythonX.Y/site-package/foo.pth

If this is correct ? Is there any documentation that I missed ?

You can use setuptools + pkg_resources to install versions in parallel -
then you need to do an explicit

pkg_resources.require("foo == 1.2")

before importing foo the first time.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top