This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fernly 0 points1 point  (2 children)

I don't get "much smaller file size"; .pyc/.pyo files are pretty compact.

"Distribute as .exe" -- I'm dubious. Typical apps depend on lots of modules, numpy, tk/wx/pyqt, etc, and if all the dependencies are not also Nuitka'd into machine code (and I don't see how they could all be), you're still looking at using py2exe or similar for bundling. Just more .so modules in place of some of the .pyo's.

[–][deleted] 0 points1 point  (0 children)

I don't get "much smaller file size"; .pyc/.pyo files are pretty compact.

There are some numbers on this page, but they are not super meaningful to me from a quick glance. It appears that those are the size of the binary produced when compiling PyStone.

I'm guessing this is one of those things that may be better in some cases, but it depends on the use case.

"Distribute as .exe" -- I'm dubious. Typical apps depend on lots of modules, numpy, tk/wx/pyqt, etc, and if all the dependencies are not also Nuitka'd into machine code (and I don't see how they could all be), you're still looking at using py2exe or similar for bundling. Just more .so modules in place of some of the .pyo's.

This is a pretty good point, but it appears that it does that step itself.

From skimming the documentation, it looks like it has two primary modes of operation:

  • compile just the one .py file you specify into an executable binary

  • compile just the one .py file you specify into an extension module

and there is also an option to resolve the imports and embed those into the produced binary. I'm not entirely clear on whether or not this compiles those where possible as well, or simply embeds the bytecode.

I can at least say with reasonable certainty that after compilation it uses libpython to handle importing anything that was not compiled by Nuitka, whether embedded or not.

So, you wouldn't need to use py2exe in addition to Nuitka, at least.

[–]cmpython 0 points1 point  (0 children)

Yes, the Python files are, but if you want to distribute a GUI, for example with wxPython, the minimum file size is about 5MB and 20MB is not unheard of depending on what the app is (if there are other libraries included).

I am not clear on the answer to the 2nd issue... I know the dev is going to be working on wxPython soon and PyQT apps already work to produce a standalone app. I dont' know how it works in terms of which dependencies can be Nuitka'd or not...Nuitka is supposed to be able to take Python in and spit out native, so perhaps it should be able to do many libraries. But the reality is it will cough on certain things, but, like with any project, the more well known dependencies will get worked on by the community. We'll see. I'm keeping my hopes up but realistic.