Creating Cython libraries for redistribution in a Python package

preview_player
Показать описание
Cython compiles Python to C for high performance, and Cython modules can be redistributed with your code in a Python package -- a source distribution or "wheel" file -- so others can use it, too. You can deliver both the generated C source code, and a precompiled binary for a specific platform, for the widest possible re-use. Learn in this video how to set up your project when Cython code is present, and what tools you'll need to build wheels and source distributions from it.

Also be sure to check out some of our other videos about Cython:

------------------------------­----
Рекомендации по теме
Комментарии
Автор

Can we include libraries like matplotlib or networkx ?

averageengineeer
Автор

My dear friend, where do you think it’s worth using cython? Only in corporate programming (when you work for a corporation like Google or any other) or can it be used in your own software that is created to make money? (not freelancing, just for yourself)

Now I'm reading about cython - it refers to micro-optimization, which inserts a lot of glue code and other people advise to write directly in C or C++.

I would really like to use cython, because a professional must write fast code, but on the other hand, cython is a huge technology with a lot of subtleties. So where is it worth to use it?

Fillmoreb
Автор

I'm trying to build a similarly structured package (using python -m build). I can build the source distribution fine, but attempting to build the wheel returns a ValueError saying that the .pyx files can't be found (apparently, they are not being copied to the temporary folder setuptools creates to build the wheel). I managed to get around this by including the .pyx paths in a MANIFEST.in file, then python -m build works just fine. Also running python setup.py bdist_wheel works even without the MANIFEST. However, I don't want to run setup.py directly as that's not recommended, and I'd rather not have to include a MANIFEST.in file. Have you encountered this problem or know a way around it?

bernardoabf