[Cython] Cython, py2exe and cimport

Jay Parlar parlar at gmail.com
Thu Sep 11 22:20:44 CEST 2008


On Thu, Sep 11, 2008 at 1:15 AM, Robert Bradshaw
<robertwb at math.washington.edu> wrote:
> I've never used py2exe either, but if you do get it to work could you
> please put the info up on http://wiki.cython.org?

Ok, the answer wasn't anything Cython specific, just some distutils
particulars for py2exe.

The setup() function takes a few keyword args, including 'options'.
You can pass multiple things to this. So I did:

setup(console = ['PC_viewer.py'],
         options={'py2exe': {'includes': ['module1', 'module2'],
                                      'packages': ['package1', 'package2']
                                     }
                       }
        )

And this included the modules and packages that the automatic
detection by py2exe hadn't discovered. I think that py2exe (at a high
level) just scans Python code for 'import' statements, and makes sure
to bundle whatever it finds. It can't scan compiled extensions, so it
just needs the user to explicitly list them.

I haven't made an entry on the wiki yet, but I'll try to add a short
example by the end of next week. I've added it as an action OmniFocus,
so I guarantee it'll get done :)

Lisandro's _deps.py solution did work, but this way is a bit more
explicit and correct.

Thanks,
Jay P.


More information about the Cython-dev mailing list