All in with Nuitka
nuitka.net
nuitka.net
I think I've told this story before, but oh well. Years ago, not long after Nuitka became a thing, I was blown away by all the effort put into this thing by -1- person. I asked to donate, and suggested he add a donation button to his page someplace. Kay couldn't believe anyone would want to just give him money, and seemed in disbelief with the idea and that I wanted to send money.
I don't know why that sticks with me. It seemed like such a humble exchange. We exchanged a few emails, he's a really smart and kind person. The world would be so lucky if more maintainers mirrored his spirit. Really wish him the best on this.
Nuitka: An extremely compatible Python compiler - https://news.ycombinator.com/item?id=28377541 - Sept 2021 (84 comments)
Nuitka: a Python compiler written in Python - https://news.ycombinator.com/item?id=27537819 - June 2021 (181 comments)
Nuitka 0.6.0 released - https://news.ycombinator.com/item?id=18092837 - Sept 2018 (14 comments)
Nuitka: A Python compiler - https://news.ycombinator.com/item?id=17683932 - Aug 2018 (6 comments)
Nuitka: A Python compiler - https://news.ycombinator.com/item?id=16980704 - May 2018 (4 comments)
Nuitka: A Python Compiler - https://news.ycombinator.com/item?id=16822005 - April 2018 (5 comments)
Nuitka: a Python compiler - https://news.ycombinator.com/item?id=15354613 - Sept 2017 (60 comments)
Nuitka Progress in 2015 – Python Compiler - https://news.ycombinator.com/item?id=10994267 - Jan 2016 (52 comments)
Nuitka – A Python Compiler - https://news.ycombinator.com/item?id=9089523 - Feb 2015 (5 comments)
Nuitka: a Python compiler - https://news.ycombinator.com/item?id=8771925 - Dec 2014 (135 comments)
Nuitka — A Python Compiler - https://news.ycombinator.com/item?id=1746340 - Oct 2010 (33 comments)
But python code as a statically compiled native executable is really cool, compared to other solutions like using pyInstaller.
Missing a : in https://
Thanks a lot, and I hope our small contribution via subscription helps.
I was never quite sure how to apply this to the old code base of shoebot, (a python creative code environment based on nodebox), I think if I start from fresh I might try again.
I've been thinking a lot about transpiling lately. GCC and Clang are state of the art optimizing compilers for C/C++ and it's interesting that all the effort to optimize compilers is for those languages.
Any other language has to do a significant amount of work to build a standard library and value-add features.
There's languages such as D, Dart, Nim, Crystal, Zig, Pony which are impressive but receive little attention.
I'm working on my own multithreaded language, I want multithreaded software to be easier to write. It currently looks similar to Javascript but that might change.
To come back to transpiling, it's interesting finding something that's orthogonal between the source language and the target language that you can add value add features. C with arbitrarily nested hashmaps, safe strings would be useful.
I love the simplicity of Python sourcecode and I think complicated tools should be built in it for approachability. But transpiling or compilation is the problem.
The optimizers from GCC and Clang aren't usable just for C/C++. Both compilers have frontends for different languages that share the optimization pipeline. For example, GCC has a D frontend, and the Zig compiler has a LLVM backend.
LLVM has definitely enabled more language diversity!
Wish I could write python script with python libraries such as: OpenCV, Open3d, SDL, tensorflow and execute directly on android/iOS.
Also I think instead of undetermined donation amount a fixed $99 personal commercial license would be successful.
Doesn't all CPUs offer a different set of opcodes? How can a compiler then work for different CPUs?
For example, this Wikipedia page is listing the CPUs that support instructions for fast SHA calculations:
https://en.wikipedia.org/wiki/Intel_SHA_extensions
How could a compiler ever use those, when not all CPUs support them?
https://stackoverflow.com/questions/47299458/how-can-i-deter...
Though for highly specialized calculations like that. they're often written into popular libraries like OpenSSL with inline assembly for all relevant architectures.
It generates code that works on 1) one CPU, or 2) a family of CPUs, or 3) (less commonly) multiple families of CPUs.
But not all CPUs.
I think you can see how 1) works. Plus, improved versions of a CPU are often backwards compatible, so if the program works on an older Intel x86-64 CPU than it very likely works on a newer one, or on an AMD x86-64 CPU or other compatible CPU.
2) works because programs can query the processor to see which additional features are supported. In your SHA extension example, https://www.intel.com/content/www/us/en/developer/articles/t... says:
> Availability of the Intel® SHA Extensions on a particular processor can be determined by checking the SHA CPUID bit in CPUID.(EAX=07H, ECX=0):EBX.SHA [bit 29].
It gives an example C function with inline assembly which uses the "cpuid" instruction to get that information:
int CheckForIntelShaExtensions() {
int a, b, c, d;
// Look for CPUID.7.0.EBX[29]
// EAX = 7, ECX = 0
a = 7;
c = 0;
asm volatile ("cpuid"
:"=a"(a), "=b"(b), "=c"(c), "=d"(d)
:"a"(a), "c"(c)
);
// Intel® SHA Extensions feature bit is EBX[29]
return ((b >> 29) & 1);
}
A compiler (or programmer) can have one code path execute if CheckForIntelShaExtensions() is true, and another if it's false.3) works in collaboration with the operating system. For example, on macOS the compiler can compile once for x86-64 and again for its "M" series chips and bundle the results into a single binary. The OS knows the CPU and can select the right compiled code to start.
Do note that Nuitka doesn't do any of this. It compiles Python to C code, then lets the C compiler handle the above.
and anything in .NET land since .NET Core will have a ton of SIMD in it
In principle, you could distribute many different binaries optimized for different CPUs. However, the more common approach in high-performance software is to compile most of the program for a generic instruction set and write several versions of the hottest parts. Then you detect the supported CPU features at runtime and dispatch appropriately.
Golang does have weakness as Python, both are pretty much irrelevant on Android and iOS by design, sadly.
What's the benefits over shipping as docker?
e.g. there's some benchmarks here https://pybenchmarks.org/ and they mostly seem to go: Python 3 -> Nuitka (slightly faster) -> Cython (much faster) -> PyPy (faster again)
So I always assumed the main advantage was more in producing a single binary
And I'd consider that a big advantage over "shipping with Docker" for many use cases, e.g. building cli tools
not that i mean to complain about having a working python compiler, i think its neat
* Works fine for graphical applications (again this is possible with Docker but not zero configuration).
* Despite your complaint about size I still suspect it's a lot small than a complete Docker image.
* Works natively on Windows, unlike Docker
BTW the ideal mode is standalone rather than onefile - this outputs a directory including your program and separate files for any C extensions modules. That will let you chase down the offending module(s) that are hundreds of MB. Which in your case there must be - I distribute a small Qt program and even that is only 10s of MB.
Please become a subscriber of Nuitka commercial, even if you do not need the IP protection features it mostly has. All essential packaging and performance features are free, and I have put incredible amounts of works in this, and I need to now make a living off it.
Right now, I am far from being able to sustain my income from it, and I am taking a risk with this effort, hoping for support from you.
In a few years we will have a blog post about how Oss is not able to provide sustainable income and maybe the thing will switch to an hybrid license if possible.We will need to see a major culture shift in industry towards paying for support for free software before that can change. It's ridiculous that companies are willing to shell out so much money for proprietary SaaS products (especially in the data engineering space), but are not willing to pay for support/consulting of open-source products, even if the latter is cheaper. It's not entirely rational, but it's the way things are, and we are still a couple of years off from anything being different.
Well-intentioned developers deserve to make a living on free-ish software more than I deserve fully free software.
Of course people deserve things.
1: https://www.un.org/en/about-us/universal-declaration-of-huma...
e.g. in GP's comment - the 'well-intentioned developers' 'deserve' to make a living, because they earnt it by making the nice 'free-ish software' and being 'well-intentioned' etc.?
I'd suggest finding the features or support systems that only companies really care about and charging for them. Support, paid feature development, etc.
> This is essentially an appeal to charity.
...the problem is that it's not even very clearly an appeal to charity. It's sort of blurring a freemium opencore commercial model with charity.
Paying for the premium-tier of a freemium product is one possible message to put out there. An appeal to charity is quite another. They are different messages appealing to different motivations. But when combined, they sort of diminish each other's effectiveness as a possible sales message.
If I get into my charitable frame of mind, it produces cognitive dissonance to think that maybe this project doesn't need my charity if there are commercial users out there who can sustain the product by paying for the premium tier (as well they should if they make profitable use of the premium features).
If I get into my business purchaser frame of mind, it produces cognitive dissonance to hear the author talk of my purchasing decision as an act of charity. It makes me think that even the sales guy acknowledges that I won't be getting anything worth what I'm paying for here.
Not only that, but they also imply very different kinds of contracts, and as someone paying for this, I'd like to know which contract I'm getting into.
If it's a commercial contract, I expect some kind of warranty that everything will work, and some kind of support or right to my money back if it doesn't. That's just implied in a commercial deal of any kind. (And frequently that's the piece in an open core business model that you pay for when you pay for the premium tier). So if I pay, and I take my problem to the source, I don't then want to hear "Sorry, can't help you out, but I did say from the beginning that the money I took from you was more of a donation than a payment for a commercial deal of any kind, and it's kind of uncharitable of you to now expect me to fix your problem if it distracts me from building new features which, ostensibly, you were supposed to be supporting."
You hit the nail on the head right there.
I know a billion-dollar company that uses all kinds of "free for personal use, $$$ for commercial use" software, and pays exactly $0 for the software.
Even where I work, I've had to choose commercial software over open source solutions because I can't get any middle manager to understand that paying people for work they've already done for free is the right thing to do.
And don't even get me started on the whole "If it's not available at CDW, we don't need it" crap.
That sentence turns my stomach.
I will never in a thousand years run mystery binaries tied to a particular version of operating system and hardware.
If the answer is no, then you are running mystery binaries :)
The bean counter won't really be rewarded (not directly at least) for the engineer and the engineer's team being successful, but they'll be definitely penalized for being haphazard with finances. Ergo, their incentive is to be a stingy bastard by default.
This then puts a high bar on anything that is a cost, which mostly penalizes low expenditures counterintuitively. A line item of $200 is basically not worth fighting for. Something that costs $20000 is generally easier to justify in terms of effort even just subconsciously. Ultimately both line items take asymptotically the same effort to push through, but the larger one appears (at first sight) much more important. It may be that the $200 item is more valuable in the end of course.
IMHO, one of the most important qualities of an engineer is honesty.
I'd take the concern about sustainability into consideration, but being upfront about the need to make money from this is more reassuring than a lot of the fake-it-till-you-make-it that we see.
Another paid for python hosting with Divio.
Whatever both of these are offering is at least worth it.
Financial institutions could be a good fit to pay licensed for Nuitka (enterprise pricing included).
I'm playing devil's advocate there: I do actually think it is the right thing to do to pay the author. But I don't think your argument would work with a manager.
If you want $$$ from enterprise, offer them cost saving or money making tech and charge for it. It can be built on top of your OSS, in fact this is a great way to get in touch with the companies... But don't rely on charity. In the companies I worked for paying for something you can get for free is simply not done, ever.
Finance is a significant obstacle to this goal. Multiple times I have been told, “There is a budget surplus-does anyone have any nice-to-haves we should purchase?” More than once, I have suggested (modest) donations towards open source project X that enables us to operate. Not once have I succeeded.
Not a real charity. Not a real purchase. Good will towards something already free does not make a compelling business case up the chain of command.
I've burned myself twice on this approach. Shortly after I/we started supporting them they changed their license terms. Of course since we were now paying customers we could still use it, but a significant reasons why I advocated for that software in the first place was because it was open source, and now I feel cheated and the advice I gave the company I worked for at that point turned out to be less valuable.
I do sometimes feel that once one get the taste for that sweet sweet recurring revenue it is hard to not start optimizing for it.
For completeness; it has also worked beautifully at least once.
And I guess I'll probably argue again for supporting open source.
But maybe I'll be a little more careful and try to ensure they can't pull these kinds of tricks on me (if a project accepts code contributions and doesn't have a CLA, it will be hard for them to pull such a bait and switch).
I wish more open source developers understood this. Corporations love the business model and Red Hat makes tons of money, they turn around and add to and create more and more Free Software, and those of us that are not corporations with deep pockets can still use and benefit from the software.