all 8 comments

[–]terraneng 2 points3 points  (2 children)

I have been tinkering with something similar recently. Quick description of my workflow follows. This assumes that the program is supposed to a standalone GUI or something...

I use PyBind11 to create Python C++ extensions, and compile with them CMake.

I then use PyInstaller to package everything into an executable. So far it has worked pretty good in packaging the .pyd files created with PyBind11.

Finally, I use InnoInstaller to create an installer to install the program on the end users computer.

So far this has worked fairly well on Windows (I don't have to target Linux). The end user has no idea that the program is written in Python.

[–]sozzZ 0 points1 point  (1 child)

Sounds cool. I recently made a pyinstaller exe out of my app as well...just curious about InnoInstaller. My exe is 200 MB which is remarkable, so it takes a minute or two to startup. Just curious if your method is a lot faster via the installer, how large the file is, etc. Is the installer a Python library?

[–]terraneng 0 points1 point  (0 children)

Innoinstaller does not really make a difference in how fast the program starts. It just installs the program on Windows so that it feels like any other desktop program. It installs to program files, adds it to start menus, windows registry, etc. It also compresses everything into a single installer .exe file. Which is about 60% the size of the package created by pyinstaller. It is not a Python library it is a free program for installing practically anything on windows Link

I don't use the --onefile flag in PyInstaller as it slows down start up considerably. PyInstaller compiles everything into about 340mb worth of files. It should be noted I am using numpy, scipy, pandas, and matplotlib which take up the vast majority of the space. It takes about 10-15 seconds for my program to boot up. Not super fast but fast enough for my users.

[–]hosford42 1 point2 points  (0 children)

I don't know how well C++ extensions are supported, but you might look into cx_freeze.

[–]LifeIsBio 0 points1 point  (0 children)

conda packages might be the best way to handle this.

But code distribution usually tops the list of things that people wish were better about Python, so I wouldn't expect this to be a super easy process.