Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include .pyx file in python package

Tags:

python

cython

I used cython in my packages pyirt, but when I published it to the pypi, the .pyx file is not included in the tar.gz

I think it must has something to do with the setup file. However, I cannot find a solution to this problem.

like image 939
Junchen Avatar asked Mar 24 '15 08:03

Junchen


People also ask

How do I compile a .PYX file?

To compile the example. pyx file, select Tools | Run setup.py Task command from the main menu. In the Enter setup.py task name type build and select the build_ext task. See Create and run setup.py for more details.

Does Cython work with Python libraries?

Because Cython code compiles to C, it can interact with those libraries directly, and take Python's bottlenecks out of the loop. But NumPy, in particular, works well with Cython. Cython has native support for specific constructions in NumPy and provides fast access to NumPy arrays.


1 Answers

You may want to add a MANIFEST.in file to the top level of your project and add following line:

global-include *.pyx
global-include *.pxd

You can find valid commands for the MANIFEST.in file here.

like image 183
cel Avatar answered Oct 13 '22 14:10

cel