Hi,

matus valo via cython-devel schrieb am 11.02.25 um 20:25:
I am writing to you to not get lost in
https://github.com/cython/cython/pull/6531. I would like to get an
agreement on how we would like to proceed with a CLI.

I think the tool should be part of the normal cython command, maybe:

    cython --share=scipy._lib.cyshared  --generate-shared

The question then is whether this can be combined with a normal module translation (and should still generate the shared code file) or whether it's a separate step to do the shared module generation.

If it's combined, we could end up with multiple generations, even concurrently in parallel builds. This can be handled (temp file + rename) but adds complexity.

Thus, the invocation above can generate the module, whereas

    cython --share=scipy._lib.cyshared  mymodule.py

would integrate it into the translation of "mymodule.py".


The reason why not to use the import path is because the target package can
be hidden inside a directory (e.g. src). This does not work well with the
import path.

The generated file should be written into the build directory. If users want to have it in a subdirectory, they'll have to specify that as build directory when invoking cython.


* should utility create directories or to fail if directory does not exist?

Create all necessary directories, then write the output into the target directory. No need for a failure.


2. cython parameter to instruct cython to compile module with shared utility

Here, I propose to use import path and compilation directive:

cython -X use_shared_utility=scipy._lib.cyshared my_module.pyx

I'd rather have that as an option than a directive. "--share=fqmn" seems enough.


The reason to use the import path is because the file must be internally
imported in any case. The import path is a full path including the shared
module.

You mean the fully qualified module name, including packages, right? That seems right.

Stefan

_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to