Distributing python package with cython module

1,704 views
Skip to first unread message

Michael Hogg

unread,
Feb 24, 2013, 6:02:06 AM2/24/13
to cython...@googlegroups.com
Hi,

Just trying to understand the ins/outs of distributing a python package with cython modules and the process that the end user has to follow.

Is there a method where the user can download the package (i.e. the source from pypi or using easy_install) and the cython modules with automatically compile, or compile when the module is imported for the first time?

Are there any simple examples or good sources of documentation?

Cheers,
Mike

Jason Rudy

unread,
Feb 24, 2013, 3:02:38 PM2/24/13
to cython...@googlegroups.com
Perhaps this will help:


The key thing to realize is that Cython produces C and C++ code as an output.  If you distribute the C/C++ code, your users don't have to have Cython installed in order to install your package.

Michael Hogg

unread,
Apr 15, 2013, 3:54:28 AM4/15/13
to cython...@googlegroups.com
Jason - Thanks for your reply. I have followed that post and have a similar setup.py file that is now able to use either the pyx or the c file.

I have a another question related to this; is it also possible to include the compiled cython modules (pyd on Windows) in a python package? I tried to create a "dumb binary", which appears to work ok, but when I upload it to PyPi it says that my file is an invalid distribution file. That is, I created a "dumb binary" on Windows using distutils via:

python setup.py bdist

which creates a zip file with the pyd file in it ok, but when I try to upload it to PyPi it says that my zip file is an invalid distribution file. Looking at the other packages on PyPi that have cython extension modules, I found that almost all of these only supply the source, and not the compiled extension module. Do you know if what I am trying to do is possible, or if this is just a PyPi error?

Note: I don't want to create a windows installer, as this is a plug-in to another program that doesn't get installed in the default location. I just need the user to copy the directory containing my package to another directory.

Thanks again
Mike

 



  

Jason Rudy

unread,
Apr 15, 2013, 4:57:01 PM4/15/13
to cython...@googlegroups.com
Hi Mike,
Unfortunately I have no idea.  I've never used PyPi or tried to package windows binaries.  Maybe someone else on this list can point to a good resource?  I'd be interested in learning the answer if you find it out.

Best,

Jason



 



  

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "cython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cython-users/Q97qH46pj-U/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to cython-users...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages