[Cython] Store list of imported modules in .so file

Robert Bradshaw robertwb at gmail.com
Thu Nov 26 01:15:21 EST 2015

On Tue, Nov 24, 2015 at 12:50 PM, Hartmut Goebel
<h.goebel at crazy-compilers.com> wrote:
> Hi,
> I'm a core-developer for PyInstaller. We would like to enhance cython
> support in PyInstaller and resolve dependencies of cython-compiled
> modules automatically. This would ease freezing cython modules with
> PyInstaller a lot and thus help users including cythonized-modules into
> their shipped application.
> For us, the most elegant way to get the dependencies would be to have
> the list of imported modules in the .so-file. E.g. some simple string
> marked by some cookie which is easily grepped out of the binary.
> Is there any chance to get suche a list into the .so/.dll-file?

It's not clear how to embed such information deterministically into
the so/dll file (which are produced by the C compilers), but if you
had/could create the generated C files we do put some metadata at the
top of those when compiled with cythonize, e.g.

/* BEGIN: Cython Metadata
    [JSON data about cimports, distutils options, etc]
END: Cython Metadata */

We could consider putting imports there as well.

> If you like, you can comment directly on our related ticket:
> https://github.com/pyinstaller/pyinstaller/issues/1674
> --
> Regards
> Hartmut Goebel
> | Hartmut Goebel          | h.goebel at crazy-compilers.com               |
> | www.crazy-compilers.com | compilers which you thought are impossible |
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel

More information about the cython-devel mailing list