Date: Fri, 23 Oct 2015 22:00:00 -0400
<p>Visit our <a href="http://pythonpodcast.com?utm_source=rss&utm_medium=rss">site</a> to listen to past episodes, support the show, and sign up for our mailing list.</p> <h3>Summary</h3> <p>Kay Hayen is a systems engineer from Germany who has dedicated his spare time to the creation of Nuitka, a library that will compile your Python project to C++. In this episode we talked to Kay about what inspired him to create the project, how it operates, and some of the challenges he has faced. It is a very interesting project and it has the potential to let you run your Python code in a whole new way!</p> <h3>Brief Introduction</h3> <ul> <li>Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.</li> <li>Subscribe on <a href="https://itunes.apple.com/us/podcast/podcast.-init/id981834425?mt=2&uo=6&at=&ct=&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">iTunes</a>, <a href="http://www.stitcher.com/s?fid=64838&refid=stpr&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Stitcher</a>, <a href="http://tunein.com/embed/follow/p726240/#?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">TuneIn</a> or <a href="https://www.pythonpodcast.com/feed/mp3/?utm_source=rss&utm_medium=rss">RSS</a></li> <li>Follow us on <a href="https://twitter.com/Podcast__init__?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Twitter</a> or <a href="https://plus.google.com/+Podcastinit-the-python-podcast?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Google+</a></li> <li>Give us feedback! Leave a review on <a href="https://itunes.apple.com/us/podcast/podcast.-init/id981834425?mt=2&uo=6&at=&ct=&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">iTunes</a>, <a href="https://twitter.com/Podcast__init__?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Tweet</a> to us, send us an <a href="mailto:hosts@podcastinit.com">email</a>, leave us a message on <a href="https://plus.google.com/+Podcastinit-the-python-podcast?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Google+</a>, or leave a comment on our <a href="http://pythonpodcast.com/kay-hayen-nuitka.html?utm_source=rss&utm_medium=rss">show notes</a></li> <li>I would like to thank everyone who has donated to the show. Your contributions help us make the show sustainable. For details on how to support the show you can visit our site at <a href="http://pythonpodcast.com?utm_source=rss&utm_medium=rss">pythonpodcast.com</a></li> <li>I would also like to thank Hired, a job marketplace for developers, for sponsoring this episode of Podcast.__init__. Use the link <a href="http://hired.com/podcastinit?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">hired.com/podcastinit</a> to double your signing bonus. Linode has also sponsored this episode and you can get a $10 credit using the link linode.com/podcastinit to try out their fast and reliable linux virtual servers.</li> <li>We are recording today on October 6th, 2015 and your hosts as usual are Tobias Macey and Chris Patti</li> <li>Today we are interviewing Kay Hayen about the Nuitka project</li> <li> <hr /> </li> </ul> <div class="well"><a href="https://hired.com/?utm_content=shownotes-4k&utm_medium=podcast&utm_source=podcastinit&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank"><img alt="Hired Logo" src="https://i0.wp.com/podcastinit.podbean.com/mf/web/ehi957/hired-logo-dark-padding.png?w=1200&utm_source=rss&utm_medium=rss" /></a>On Hired software engineers & designers can get 5+ interview requests in a week and each offer has salary and equity upfront. With full time and contract opportunities available, users can view the offers and accept or reject them before talking to any company. Work with over 2,500 companies from startups to large public companies hailing from 12 major tech hubs in North America and Europe. Hired is totally free for users and If you get a job you’ll get a $2,000 “thank you” bonus. If you use our <a href="https://hired.com/?utm_content=shownotes-4k&utm_medium=podcast&utm_source=podcastinit&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">special link</a> to signup, then that bonus will double to $4,000 when you accept a job. If you’re not looking for a job but know someone who is, you can refer them to Hired and get a $1,337 bonus when they accept a job.</p> </div> <div class="well"><a href="http://linode.com/podcastinit?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank"><img alt="Linode Sponsor Banner" src="https://i0.wp.com/podcastinit.podbean.com/mf/web/tdegpr/linode-banner-sponsor-large.png?w=1200&utm_source=rss&utm_medium=rss" /></a>Use the promo code <strong>podcastinit10</strong> to get a $10 credit when you sign up!</p> </div> <hr /> <h3>Interview with Kay Hayen</h3> <ul> <li>Introductions <ul> <li>German, family with 2 kids, one cat</li> <li>Working in ATM (Air Traffic Management), tracker product</li> <li>Systems Engineer</li> <li>Nuitka as a hobbyist</li> </ul> </li> <li>How did you get introduced to Python? <ul> <li>Once was Perl “Guru”.</li> <li>Python was getting a lot of positive press</li> <li>Team decision to want to use readable stuff</li> <li>CPAN was still more complete, but Python was making inroads</li> </ul> </li> <li>Can you describe how to pronounce the name of your project? <ul> <li>Wife Anna, Russian, Annuitka -> Nuitka</li> </ul> </li> <li>Can you briefly describe what Nuitka is and what your motivation was for creating it? <ul> <li>I was thinking a fully integrated and compatible compiler should be possible.</li> <li>Why is nobody doing it?</li> <li>I can do it.</li> <li>I am doing it.</li> <li>Take Python beyond current use cases. <ul> <li>Everbody currently using Python needs no compiler, or wouldn’t use it</li> <li>Less need for time consuming C++/Python hybrid coding</li> <li>Simple code should compile to fast code by default</li> <li>Complex code should still work</li> </ul> </li> </ul> </li> <li>On the project web site it says that Nuitka does a lot of clever things after being fed a Python project. Can you provide some details as to what some of that cleverness is? <ul> <li>Re-formulations of Python into simpler Python <ul> <li>No “class”</li> <li>No “assert”</li> <li>No complex assignments</li> </ul> </li> <li>SSA tracing <ul> <li>Attaching uses to assignments properly <ul> <li>Despite try/finally</li> <li>Loops</li> </ul> </li> <li>Avoids checks for known defined/undefined values</li> </ul> </li> <li>Function inlining (coming)</li> <li>Constant propagation</li> <li>Closure variable removal</li> </ul> </li> <li>What is libpython and how is it used in both Nuitka and CPython? <ul> <li>Core of the Python interpreter</li> <li>With Python VM and C interface</li> <li>Nuitka can fall back to it</li> <li>Avoiding it as often as we can, key to performance</li> </ul> </li> <li>Is there any way to provide hints to Nuitka to generate more optimized output? <ul> <li>Nuitka is yet to make a difference based on type information</li> <li>Not yet there, but coming soonish. SSA was pre-requisite</li> <li>PEP 484 will be unreliable type information, mostly useless</li> <li>I want type hints that are checked at Python run time</li> </ul> </li> <li>What are some of the biggest challenges in generating statically compiled code from a language as dynamic as Python? <ul> <li>Python is compiled to .pyc files</li> <li>Compatible Frame stack, cached</li> <li>Exception handling of Python is terrible</li> <li>CPython type system designed to be extensible <ul> <li>Extension types for functions, bound/unbound methods, generators, etc.</li> </ul> </li> <li>Many details to get right</li> </ul> </li> <li>Are there any particular Python constructs that Nuitka is unable to translate and as a corollary to that is the compilation step lossy at all or do you have some way of ensuring that the functionality of the program remains unaltered? <ul> <li>Big point, no price attached</li> <li>Except for not having bytecode, there is nothing missing</li> <li>No pdb support</li> <li>Edit / run cycle is not accelerated</li> <li>That said: PyQt (integrated), PySide (available, unmerged), wxPython (available, maybe merged) needed patches to take compiled function/method objects for function objects too</li> </ul> </li> <li>Are there any particular types of programs that benefit the most from Nuitka’s compilation? <ul> <li>Bindings with ctypes of cffi compile into zero overhead C calls (planned)</li> <li>Scientific programs are the most obvious goal (float type inference)</li> <li>CPU bound or low latency programs</li> </ul> </li> <li>Is it possible to feed an entire project with multiple modules into Nuitka all at once or is the standard use to perform compilation one source file or submodule at a time? <ul> <li>You give it the main program and it recurses imports according to “PYTHONPATH”</li> <li>nuitka –recurse-all “/usr/bin/hg” supposed to work</li> <li>Might have to give directories with program plug-ins</li> </ul> </li> <li>I’m curious about what led you to choose compilation to C++ for Nuitka rather than making Nuitka an LLVM back end like Numba? <ul> <li>When I started Nuitka, I was using C++0x and variadic templates</li> <li>Wanted to make a proof of concept that compatibility and integration is feasible</li> <li>From there, code generation got less high level to goto ridden C</li> </ul> </li> <li>How does Nuitka compare to projects like Numba or Cython? <ul> <li>Graceful degradation goal</li> <li>Complete compatibility with Python whole stack</li> </ul> </li> <li>How does Nuitka compare to PyPy? – Kay <ul> <li>PyPy is the coolest project ever</li> <li>Pure Python goals shared</li> </ul> </li> <li>How can users evaluate the performance of Nuitka – Kay <ul> <li>They currently cannot</li> <li>Developing a tool to compare CPython and Nuitka runs <ul> <li>Based on vmprof from PyPy people</li> <li>Identify parts of program where Nuitka is slower</li> <li>Links to source code</li> </ul> </li> <li>To be done, help needed.</li> <li>Nuitka is only starting to get to serious performance <ul> <li>Compatibility is such a high bar to take</li> <li>C++ to C took a year (avoiding C++ exceptions)</li> <li>SSA literally took forever</li> </ul> </li> </ul> </li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="http://amzn.to/1MbCskV?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Forbidden Island</a></li> <li><a href="http://amzn.to/1MbCycj?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Forbidden Desert</a></li> <li><a href="https://ottoproject.io?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Otto Project</a></li> </ul> </li> <li>Chris <ul> <li><a href="http://grimmales.com/supersymmetry/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Grimm Super Symmetry</a></li> <li><a href="http://youarelistening.to/boston?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Are You Listening To?: Boston</a></li> <li><a href="https://ripple.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Ripple</a></li> </ul> </li> <li>Kay <ul> <li><a href="http://www.atheist-experience.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Learn being skeptic, Atheist Experience</a></li> <li><a href="https://micropython.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">MicroPython</a></li> </ul> </li> </ul> <h3>Keep In Touch</h3> <ul> <li><a href="http://nuitka.net?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Nuitka Homepage</a></li> <li><a href="https://plus.google.com/+KayHayen?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Google+</a></li> <li><a href="mailto:kay.hayen@gmail.com">Email</a></li> </ul> <p>The intro and outro music is from Requiem for a Fish <a href="http://freemusicarchive.org/music/The_Freak_Fandango_Orchestra/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">The Freak Fandango Orchestra</a> / <a href="http://creativecommons.org/licenses/by-sa/3.0/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">CC BY-SA</a><img alt="" height="0" src="https://analytics.boundlessnotions.com/piwik.php?idsite=1&rec=1&url=https%3A%2F%2Fwww.pythonpodcast.com%2Fepisode-28-kay-hayen-on-nuitka%2F&action_name=Kay+Hayen+on+Nuitka+-+Episode+28&urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&utm_source=rss&utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" /></p>