5

In Tcl, there is a concept of stubs, where you can have a C extension that works with any compatible version of Tcl. Is there a comparable concept for Python?

I'd like to distribute a binary module that would run on Ubuntu 8.04 (python 2.5), Ubuntu 10.04 (python 2.6), and Centos 5 (python 2.4). I'd like to only have to distribute a 32 bit and a 64 bit version for Linux that would be compatible with all 3. I'd redistribute libstdc++ and compile for glib 2.7 which is forward compatible with glib 2.11.

5
  • You might want to explain why you don't want to distribute as source (and so avoid this problem). Commented Dec 23, 2010 at 23:32
  • Possibly he's aiming to have his module independant on a compiler being installed. Commented Dec 24, 2010 at 3:55
  • I'd like to be able to distribute an application which uses the default python versions on the system. I don't want to have to worry that the application will break if the python version if updated. On Windows I can ask customers to download a specific version from python.org. On Mac OS X, python is already installed. On Linux I am at the mercy of each distribution having a different python version. Commented Dec 24, 2010 at 5:58
  • I removed the stubs tag, as it's previously been used just for stubs for unit testing. Alas. Commented Dec 24, 2010 at 6:43
  • 1
    You people answering this don't have a clue. Just answer his question rather than question his approach. Version independent extension libs for Python - is it so difficult to understand why this is desirable? Commented Jan 8, 2011 at 17:21

1 Answer 1

4

If you distribute your module as source, it can be compiled as necessary.

This problem occurs a lot with Windows, for which modules are normally distributed as binaries. PEP 384 proposes a solution (a limited interface which is guaranteed to exist for all Python 3 versions) and is implemented in Python 3.2. Until then, you're stuck.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. Reading their description sounds a lot like the Tcl stubs approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.