Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to provide pre-compiled cython modules for 32 and 64 bits neatly?

Tags:

python

cython

I have a python script using a cython module I wrote. I want to publish it, and in order to save users the trouble of compiling the cython stuff (especially complex on Windows), I want to provide pre-compiled extensions.

However, I will need one version for 32 bits and another for 64. I thought about including the two files as mymodule32.pyd and mymodule64.pyd, and then, mymodule.py doing the following:

if bits == 32:
    from mymodule32 import *
elif bits == 64:
    from mymodule64 import *

But this feels a litle clumsy. What if the user decides to compile the module himself producing mymodule.pyd?

like image 817
erickrf Avatar asked Nov 13 '22 10:11

erickrf


1 Answers

My impression is that this is part of how you package your module and publishing it on pypi, not about how you import it.

The import is supposed not to care about your architecture, is the module installation and package that needs to know about this.

like image 84
sorin Avatar answered Nov 15 '22 05:11

sorin