473,473 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Distributing compiled (swig) python modules

Hi there,

I have prepared binaries of a python module that I wrote. Basically
the lib is written in C++ and wrapped in python using SWIG. Of course
it links to the python dynamic libraries. I found out that this is
version dependant. For instance if I prepare the binaries on my
machine with a python 2.4 installation this module will not load
properly on a python 2.5 / 2.6 installation.

Is there some documentation (that I missed in my previous google
search) that describe how to prepare python module that can be
redistributed with some kind of backward compatibility (= so that when
prepared on python 2.4, it works on 2.5/2.6 at least) ?

Thanks
Oct 15 '08 #1
2 1242
mathieu wrote:
Hi there,

I have prepared binaries of a python module that I wrote. Basically
the lib is written in C++ and wrapped in python using SWIG. Of course
it links to the python dynamic libraries. I found out that this is
version dependant. For instance if I prepare the binaries on my
machine with a python 2.4 installation this module will not load
properly on a python 2.5 / 2.6 installation.

Is there some documentation (that I missed in my previous google
search) that describe how to prepare python module that can be
redistributed with some kind of backward compatibility (= so that when
prepared on python 2.4, it works on 2.5/2.6 at least) ?
There is no such way, and can't be because of C-API-changes in python.dlls.
You will have to offer your library separately for each python version you
support.

I don't know too much about SWIG, but if you can make your whole
build-process based on distutils or setuptools, you should be able to
produce eggs to install that your users then can install very easy.

Diez
Oct 15 '08 #2
mathieu wrote:
>...Is there some documentation (that I missed in my previous google
search) that describe how to prepare python module that can be
redistributed with some kind of backward compatibility (= so that when
prepared on python 2.4, it works on 2.5/2.6 at least) ?
Nope, you didn't miss it. Each major version change (2.3.X -2.4.X,
2.4.X -2.5.X, ...) changes the Python VM and internals. There is no
way below Python source (.pyc, .pyo, or .pyd) to stay compatible. That
is why Python projects offer code in Python version-specific packages.

--Scott David Daniels
Sc***********@Acm.Org
Oct 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jon Moldover | last post by:
Hi, I'm using Python in my win32 app by linking to the python23.dll. I'm trying to expose some c++ code in my app to Python so I can make application calls from Python scripts (according to the...
14
by: Phillip Mills | last post by:
I've learned enough of the Python language to be mildly dangerous and have used it in a few personal projects. All my development of commercial (or production) products over the past dozen years...
5
by: Jiri Barton | last post by:
Hi, I'd like to be able to distribute some python modules of my system (plugins) without the source. So far, I have done this by including only the *.pyc files. However, I have recently found...
6
by: Jason | last post by:
A non-python programming friend of mine has said that any programs made with Python must be distributed with, or an alternative link, to the source of the program. Is this true?
2
by: RickMuller | last post by:
I really appreciate the ease that the distutils make distributing Python modules. However, I have a question about using them to distribute non-Python (i.e. text) data files that support Python...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
0
by: stumblecrab | last post by:
Hello, I've looked at the swig example in the back of "programming python" (Lutz). Using gcc to compile a swig wrapper I'm getting lots of errors. Instead of using the cygwin python, I'm...
10
by: Bart Ogryczak | last post by:
Hi, I´m looking for some benchmarks comparing SWIG generated modules with modules made directly with C/Python API. Just how much overhead does SWIG give? Doing profile of my code I see, that it...
11
by: Tina I | last post by:
Hi list, Is there a preferred way to distribute programs that depends on third party modules like PyQt, Beautifulsoup etc? I have used setuptools and just having the setup script check for the...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.