Minimising py2exe filesize?

Hi, is it possible to exclude certain parts of wx being included in my exe, such as wx/tools, which adds ~3.5MB of things like editra, or some portions of wx.lib, such as AUI and a few others I don't use.

If I add "wx.tools" to the excludes section of py2exe, it complains about not being able to find it (it's asking for module includes, but I guess wx is some sort of package, and there's no "package exclude")

I've done all I can to make my application's exe smaller, and it seems 9.8MB is around the min I can achieve, knocking off 2MB if I do UNX compression on the exe

Any ideas?

Hi, I just fixed my problem!

I removed ‘wx’ from the packages to build, and py2exe automatically compiled only the parts of wx I was using, bringing my app down to 6MB without UNX compression, much better!

Also, compilation time has decreased from ~30 seconds to 4; hurrah

···

2009/4/13 Steven Sproat sproaty@gmail.com

Hi, is it possible to exclude certain parts of wx being included in my exe, such as wx/tools, which adds ~3.5MB of things like editra, or some portions of wx.lib, such as AUI and a few others I don’t use.

If I add “wx.tools” to the excludes section of py2exe, it complains about not being able to find it (it’s asking for module includes, but I guess wx is some sort of package, and there’s no “package exclude”)

I’ve done all I can to make my application’s exe smaller, and it seems 9.8MB is around the min I can achieve, knocking off 2MB if I do UNX compression on the exe

Any ideas?

Fine, but how did you remove wx from the packages? If in setup.py could you please pass a copy of your file?
Thanks

···

2009/4/13 Steven Sproat sproaty@gmail.com

Hi, I just fixed my problem!

I removed ‘wx’ from the packages to build, and py2exe automatically compiled only the parts of wx I was using, bringing my app down to 6MB without UNX compression, much better!

Also, compilation time has decreased from ~30 seconds to 4; hurrah

2009/4/13 Steven Sproat sproaty@gmail.com

Hi, is it possible to exclude certain parts of wx being included in my exe, such as wx/tools, which adds ~3.5MB of things like editra, or some portions of wx.lib, such as AUI and a few others I don’t use.

If I add “wx.tools” to the excludes section of py2exe, it complains about not being able to find it (it’s asking for module includes, but I guess wx is some sort of package, and there’s no “package exclude”)

I’ve done all I can to make my application’s exe smaller, and it seems 9.8MB is around the min I can achieve, knocking off 2MB if I do UNX compression on the exe

Any ideas?


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

raffaello wrote:

Fine, but how did you remove wx from the packages? If in setup.py could you please pass a copy of your file?
Thanks

Hello raffaello,
I've been using GUI2EXE, and looking through the save file it generated for my project, it doesn't seem to have all my excludes!
Well, initially I had wx and wx.lib added to the packages in GUI2exe, but removing them made the biggest difference. I didn't have to add them to any includes list, either

Hi Steven

raffaello wrote:

Fine, but how did you remove wx from the packages? If in setup.py could
you please pass a copy of your file?
Thanks

Hello raffaello,
I've been using GUI2EXE, and looking through the save file it generated for
my project, it doesn't seem to have all my excludes!
Well, initially I had wx and wx.lib added to the packages in GUI2exe, but
removing them made the biggest difference. I didn't have to add them to any
includes list, either

When compiling wxPython applications using py2exe (or GUI2Exe, which
is more or less the same), you don't need to add "wx" and "wx.lib" as
Includes, as py2exe will find them for you. Maybe you followed the
tutorial on how to compile the wxPython demo on the GUI2Exe page, but
that is a bit different from standard wxPython apps. They usually
don't need the access the source code of the Python files as the
wxPython demo does.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Tue, Apr 14, 2009 at 1:37 PM, Steven Sproat wrote:

Andrea Gavana wrote:

Hi Steven
  When compiling wxPython applications using py2exe (or GUI2Exe, which
is more or less the same), you don't need to add "wx" and "wx.lib" as
Includes, as py2exe will find them for you. Maybe you followed the
tutorial on how to compile the wxPython demo on the GUI2Exe page, but
that is a bit different from standard wxPython apps. They usually
don't need the access the source code of the Python files as the
wxPython demo does.

Andrea.

ah right. I can't remember exactly *why* I added them in, I think I was following some tutorial somewhere. The strange this is, in my Python modules excludes, I manually entered in a good 30 or so modules I didn't need (and DLLs), which helped reduce my filesize considerably, but they're not showing up in GUI2EXE's save file, just the same ones that are shown in py2app. However, when loading the program the correct values are shown.

'py2exe' : {
        'ascii': 0,
        'bitmap_resources': ,
        'bundle_files': 3,
        'compressed': 0,
        'custom_boot_script': '',
        'data_files': ,
        'dist_dir': r'dist',
        'dist_dir_choice': 0,
        'dll_excludes': ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
                    'tk84.dll'],
        'excludes': ['Tkconstants', 'Tkinter', 'tcl', '_gtkagg', '_tkagg', 'pywin.debugger',
                    'pywin.debugger.dbgcon',
                    'pywin.dialogs', 'bsddb',
                    'curses', 'email'],
        'icon_resources': ,
        'ignores': ,
        'includes': ,
        'manifest_file': 0,
        'multipleexe': [('windows', 'E:\\Downloads\\whyteboard-0.36.4\\whyteboard.py',
                    'Whyteboard', '0.36.4',
                    'Steven Sproat', 'Steven Sproat',
                    'Whyteboard')],
        'optimize': 0,
        'other_resources': ,
        'packages': ,
        'skip_archive': 0,
        'xref': 0,
        'zipfile': r'None',
        'zipfile_choice': 0,
                                }

By the way Andrea, thanks very much for this amazing program, it is very easy to use, looks great and performs awesomely!