how to prevent generating .c files

51 views
Skip to first unread message

bijan SayyafZadeh

unread,
Dec 8, 2024, 3:12:36 PM12/8/24
to cython-users
Hi,

I'm compiling a python package using cythonize with the following command:

"cythonize **/*.py -b build"

How to prevent of generating *.c files. 
How to force cythonize to just create all generated files (*.pyd) in the build folder and do not create files beside python files?

Thanks in advanced,
Bijan

Stefan Behnel

unread,
Dec 9, 2024, 1:07:14 PM12/9/24
to cython...@googlegroups.com
bijan SayyafZadeh schrieb am 08.12.24 um 18:35:
Could you explain why this is an issue for you?

Stefan

Johannes Fischer

unread,
Dec 10, 2024, 12:25:12 AM12/10/24
to cython-users
Why don't you just use 

cythonize **/*.py -b build && rm -f *.c

bijan SayyafZadeh

unread,
Dec 10, 2024, 12:26:49 AM12/10/24
to cython-users
Absolutely Stefan,

I have a package with multiple subpackages (each subpackage is in a subfolder of the main package). When I want to compile it and publish it, I just want to publish compiled files (I mean that only *.pyd files) but the problem is that all *.pyd files are generated beside my python files in all subpackages directories and managing them is time-consuming. 
If I could tell cythonize to compile everything for example in "build" directory and do not generate them beside existing python files that are in multiple folders, that would be very helpful.

Bijan

Daniele Nicolodi

unread,
Dec 10, 2024, 2:25:47 AM12/10/24
to cython...@googlegroups.com
On 09/12/24 19:17, bijan SayyafZadeh wrote:
> Absolutely Stefan,
>
> I have a package with multiple subpackages (each subpackage is in a
> subfolder of the main package). When I want to compile it and publish
> it, I just want to publish compiled files (I mean that only *.pyd files)
> but the problem is that all *.pyd files are generated beside my python
> files in all subpackages directories and managing them is time-consuming.

In your previous message you wanted to avoid the intermediate C source
code files. Here you mention "Python files". I imagine you refer to the
source code of your Cython extension modules.

I think no Python package build backend includes intermediate C source
code in the Python wheel. If you use Cython pure Python mode, I imagine
that some Python package build backends may be confused and install
these alongside the extension modules.

Which Python package build backend do you use?

Cheers,
Dan

Reply all
Reply to author
Forward
0 new messages