<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Nuitka Home and Blog of Kay Hayen</title> <atom:link href="http://nuitka.net/blog/feed/" rel="self" type="application/rss+xml" /><link>http://nuitka.net/blog</link> <description>From the creator of the Python compiler</description> <lastBuildDate>Mon, 14 May 2012 06:03:45 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Nuitka Release 0.3.22</title><link>http://nuitka.net/blog/2012/05/nuitka-release-0-3-22/</link> <comments>http://nuitka.net/blog/2012/05/nuitka-release-0-3-22/#comments</comments> <pubDate>Sun, 13 May 2012 11:17:54 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=935</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. Please see the page &#8220;What is Nuitka?&#8221;for clarification of what it is now and what it wants to be. This release is a continuation of the trend of &#8230; <a href="http://nuitka.net/blog/2012/05/nuitka-release-0-3-22/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a>for clarification of what it is now and what it wants to be.</p><p>This release is a continuation of the trend of previous releases, and added more re-formulations of Python that lower the burden on code generation and optimizations.</p><p>It also improves Python3 support substantially. In fact this is the first release to not only run itself under Python3, but for Nuitka to <em>compile itself</em> with Nuitka under Python3, which previously only worked for Python2. For the common language subset, it&#8217;s quite fine now.</p><div id="bug-fixes" class="section"><h2>Bug fixes</h2><ul class="simple"><li>List contractions produced extra entries on the call stack, after they became functions, these are no more existent. That was made possible my making frame stack entries an optional element in the node tree, left out for list contractions.</li><li>Calling a compiled function in an exception handler cleared the exception on return, it no longer does that.</li><li>Reference counter handling with generator &#8220;throw&#8221; method is now correct.</li><li>A module &#8220;builtins&#8221; conflicted with the handling of the Python builtins module. Those now use different identifiers.</li></ul></div><div id="new-features" class="section"><h2>New Features</h2><ul><li><p class="first">New &#8220;metaclass&#8221; syntax for the &#8220;class&#8221; statement works, and the old &#8220;__metaclass__&#8221; attribute is properly ignored.</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #408080; font-style: italic;"># Metaclass syntax in Python3, illegal in Python2</span>
<span style="color: #008000; font-weight: bold;">class</span> <span style="color: #0000ff; font-weight: bold;">X</span>(metaclass <span style="color: #666666;">=</span> Y ):
    <span style="color: #008000; font-weight: bold;">pass</span></pre></div><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #408080; font-style: italic;"># Metaclass syntax in Python2, no effect in Python3</span>
<span style="color: #008000; font-weight: bold;">class</span> <span style="color: #0000ff; font-weight: bold;">X</span>:
    __metaclass__ <span style="color: #666666;">=</span> Y</pre></div><div class="note"><p class="first admonition-title">Note</p><p>The way to make a use of a metaclass in a portable way, is to create a based class that has it and then inherit from it. Sad, isn&#8217; it. Surely, the support for &#8220;__metaclass__&#8221; could still live.</p><div class="last"><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #408080; font-style: italic;"># For Python2/3 compatible source, we create a base class that has the metaclass</span> <span style="color: #408080; font-style: italic;"># used and doesn't require making a choice.</span>  CPythonNodeMetaClassBase <span style="color: #666666;">=</span> NodeCheckMetaClass( <span style="color: #ba2121;">"CPythonNodeMetaClassBase"</span>, (<span style="color: #008000;">object</span>, ), {} )</pre></div></div></div></li><li><p class="first">The &#8220;&#8211;dump-xml&#8221; option works with Nuitka running under Python3. This was not previously supported.</p></li><li><p class="first">Python3 now also has compatible parameter errors and compatible exception error messages.</p></li><li><p class="first">Python3 has changed scope rules for list contractions (assignments don&#8217;t affect outside values) and this is now respected as well.</p></li><li><p class="first">Python3 has gained support for recursive programs and stand alone extension modules, these are now both possible as well.</p></li></ul></div><div id="new-optimizations" class="section"><h2>New Optimizations</h2><ul><li><p class="first">Avoid frame stack entries for functions that cannot raise exceptions, i.e. where they would not be used.</p><p>This avoids overhead for the very simple functions. And example of this can be seen here:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">def</span> <span style="color: #0000ff;">simple</span>():
   <span style="color: #008000; font-weight: bold;">return</span> <span style="color: #666666;">7</span></pre></div></li><li><p class="first">Optimize &#8220;len&#8221; builtin for non-constant, but known length values.</p><p>An example can be seen here:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #408080; font-style: italic;"># The range isn't constructed at compile time, but we still know its length.</span>
<span style="color: #008000;">len</span>( <span style="color: #008000;">range</span>( <span style="color: #666666;">10000000</span> ) )

<span style="color: #408080; font-style: italic;"># The string isn't constructed at compile time, but we still know its length.</span>
<span style="color: #008000;">len</span>( <span style="color: #ba2121;">"*"</span> <span style="color: #666666;">*</span> <span style="color: #666666;">1000</span> )

<span style="color: #408080; font-style: italic;"># The tuple isn't constructed, instead it's known length is used, and side effects</span>
<span style="color: #408080; font-style: italic;"># are maintained.</span>
<span style="color: #008000;">len</span>( ( a(), b() ) )</pre></div><p>This new optimizations applies to all kinds of container creations and the &#8220;range&#8221; builtin initially.</li><li><p class="first">Optimize conditions for non-constant, but known truth values.</p><p>At this time, known truth values of non-constants means &#8220;range&#8221; builtin calls with know size and container creations.</p><p>An example can be seen here:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">if</span> ( a, ):
   <span style="color: #008000; font-weight: bold;">print</span> <span style="color: #ba2121;">"In Branch"</span></pre></div><p>It&#8217;s clear, that the tuple will be true, we just need to maintain the side effect, which we do.</li><li><p class="first">Optimize &#8220;or&#8221; and &#8220;and&#8221; operators for known truth values.</p><p>See above for what has known truth values currently. This will be most useful to predict conditions that need not be evaluated at all due to short circuit nature, and to avoid checking against constant values. Previously this could not be optimized, but now it can:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #408080; font-style: italic;"># The access and call to "something()" cannot possibly happen</span>
<span style="color: #666666;">0</span> <span style="color: #aa22ff; font-weight: bold;">and</span> something()

<span style="color: #408080; font-style: italic;"># Can be replaced with "something()", as "1" is true. If it had a side effect, it</span>
<span style="color: #408080; font-style: italic;"># would be maintained.</span>
<span style="color: #666666;">1</span> <span style="color: #aa22ff; font-weight: bold;">and</span> something()

<span style="color: #408080; font-style: italic;"># The access and call to "something()" cannot possibly happen, the value is already</span>
<span style="color: #408080; font-style: italic;"># decided, it's "1".</span>
<span style="color: #666666;">1</span> <span style="color: #aa22ff; font-weight: bold;">or</span> something()

<span style="color: #408080; font-style: italic;"># Can be replaced with "something()", as "0" is false. If it had a side effect, it</span>
<span style="color: #408080; font-style: italic;"># would be maintained.</span>
<span style="color: #666666;">0</span> <span style="color: #aa22ff; font-weight: bold;">or</span> something()</pre></div></li><li><p class="first">Optimize print arguments to become strings.</p><p>The arguments to &#8220;print&#8221; are now converted to strings at compile time.</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">print</span> <span style="color: #666666;">1</span></pre></div><p>becomes:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">print</span> <span style="color: #ba2121;">"1"</span></pre></div></li><li><p class="first">Combine print arguments to single ones.</p><p>When multiple strings are printed, these are now combined.</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">print</span> <span style="color: #ba2121;">"1+1="</span>, <span style="color: #666666;">1+1</span></pre></div><p>becomes:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">print</span> <span style="color: #ba2121;">"1+1= 2"</span></pre></div></li></ul></div><div id="organizational" class="section"><h2>Organizational</h2><ul class="simple"><li>Enhanced Python3 support, enabling support for most basic tests.</li><li>Check files with PyLint in deterministic (alphabetical) order.</li></ul></div><div id="cleanups" class="section"><h2>Cleanups</h2><ul class="simple"><li>Frame stack entries are now part of the node tree instead of part of the template for every function, generator, class or module.</li><li>The try/except/else has been re-formulated to use an indicator variable visible in the node tree, that tells if a handler has been executed or not.</li><li>Side effects are now a dedicated node, used in several optimizations to maintain the effect of an expression with known value.</li></ul></div><div id="new-tests" class="section"><h2>New Tests</h2><ul class="simple"><li>Expanded and adapted basic tests to work for Python3 as well.</li><li>Added reference count tests for generator functions &#8220;throw&#8221;, &#8220;send&#8221;, and &#8220;close&#8221; methods.</li><li>Cover calling a function with &#8220;try/except&#8221; in an exception handler twice. No test was previously doing that.</li></ul></div><div id="summary" class="section"><h2>Summary</h2><p>This release offers enhanced compatibility with Python3, as well as the solution to many structural problems. Calculating lengths of large non-constant values at compile time, is technically a break through, as is avoiding lengthy calculations. The frame guards as nodes is a huge improvement, making that costly operational possible to be optimized away.</p><p>There still is more work ahead, before value propagation will be safe enough to enable, but we are seeing the glimpse of it already. Not for long, and looking at numbers will make sense.</p></div> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/05/nuitka-release-0-3-22/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Nuitka Release 0.3.21</title><link>http://nuitka.net/blog/2012/04/nuitka-release-0-3-21/</link> <comments>http://nuitka.net/blog/2012/04/nuitka-release-0-3-21/#comments</comments> <pubDate>Fri, 13 Apr 2012 08:19:56 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=924</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. Please see the page &#8220;What is Nuitka?&#8221; for clarification of what it is now and what it wants to be. This releases contains some really major enhancements, all &#8230; <a href="http://nuitka.net/blog/2012/04/nuitka-release-0-3-21/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>This releases contains some really major enhancements, all heading towards enabling value propagation inside Nuitka. Assignments of all forms are now all simple and explicit, and as a result, now it should be easy to track them.</p><p>Contractions have become functions internally, with statements use temporary variables, complex unpacking statement were reduced to more simple ones, etc.</p><p>Also there are the usual few small bug fixes, and a bunch of organizational improvements, that make the release complete.</p><div id="bug-fixes" class="section"><h2>Bug fixes</h2><ul class="simple"><li>The builtin &#8220;next&#8221; could causes a program crash when iterating past the end of an iterator. Issue#34. Fixed in 0.3.20.1 already.</li><li>The &#8220;set&#8221; constants could cause a compiler error, as that type was not considered in the &#8220;mutable&#8221; check yet. Fixed in 0.3.20.2 already.</li><li>Performance regression. Optimize expression for exception types caught as well again, this was lost in last release.</li><li>Functions that contain &#8220;exec&#8221;, are supposed to have a writable locals. But when removing that &#8220;exec&#8221; statement as part of optimizations, this property of the function could get lost.</li><li>The so called &#8220;overflow functions&#8221; are once again correctly handled. These once were left behind in some refactoring and had not been repaired until now. An overflow function is a nested function with an &#8220;exec&#8221; or a star import.</li><li>The syntax error for &#8220;return&#8221; outside of a function, was not given, instead the code returned at run time. Fixed to raise a &#8220;SyntaxError&#8221; at compile time.</li></ul></div><div id="new-optimizations" class="section"><h2>New Optimizations</h2><ul><li><p class="first">Avoid &#8220;tuple&#8221; objects to be created when catching multiple exception types, instead call exception match check function multiple times.</p></li><li><p class="first">Removal of dead code following &#8220;break&#8221;, &#8220;continue&#8221;, &#8220;return&#8221;, and &#8220;raise&#8221;. Code that follows these statements, or conditional statements, where all branches end with it.</p><div class="note"><p class="first admonition-title">Note</p><p class="last">These may not actually occur often in actual code, but future optimizations may produce them more frequently, and their removal may in turn make other possible optimizations.</p><p>&nbsp;</p></div></li><li><p class="first">Detect module variables as &#8220;read only&#8221; after all writes have been detected to not be executed as removed. Previously the &#8220;read only indicator&#8221; was determined only once and then stayed the same.</p></li><li><p class="first">Expanded conditional statement optimization to detect cases, where condition is a compile time constant, not just a constant value.</p></li><li><p class="first">Optimize away assignments from a variable to the same variable, they have no effect. The potential side effect of accessing the variable is left intact though, so exceptions will be raised still.</p><div class="note"><p class="first admonition-title">Note</p><p class="last">An exception is where &#8220;len = len&#8221; actually does have an impact, because that variable becomes assignable. The &#8220;compile itself&#8221; test of Nuitka found that to happen with &#8220;long&#8221; from the &#8220;nuitka.__past__&#8221; module.</p><p>&nbsp;</p></div></li><li><p class="first">Created Python3 variant of quick &#8220;unicode&#8221; string access, there was no such thing in the API, but we make the distinction in the source code, so it makes sense to have it.</p></li><li><p class="first">Created an optimized implementation for the builtin &#8220;iter&#8221; with 2 parameters as well. This allows for slightly more efficient code to be created with regards to reference handling, rather than using the CPython API.</p></li><li><p class="first">For all types of variable assigned in the generated code, there are now methods that accept already taken references or not, and the code generator picks the optimal variant. This avoids the drop of references, that e.g. the local variable will insist to take.</p></li><li><p class="first">Don&#8217;t use a &#8220;context&#8221; object for generator functions (and generator expressions) that don&#8217;t need one. And even if it does to store e.g. the given parameter values, avoid to have a &#8220;common context&#8221; if there is no closure taken. This avoids useless &#8220;malloc&#8221; calls and should speed up repeated generator object creation.</p></li></ul></div><div id="organizational" class="section"><h2>Organizational</h2><ul class="simple"><li>Changed the Scons build file database to reside in the build directory as opposed to the current directory, not polluting it anymore. Thanks for the patch go to Michael H Kent, very much appreciated.</li><li>The &#8220;&#8211;experimental&#8221; option is no longer available outside of checkouts of git, and even there not on stable branches (&#8220;master&#8221;, &#8220;hotfix/&#8230;&#8221;). It only pollutes &#8220;&#8211;help&#8221; output as stable releases have no experimental code options, not even development version will make a difference.</li><li>The binary &#8220;bin/Nuitka.py&#8221; has been removed from the git repository. It was deprecated a while ago, not part of the distribution and served no good use, as it was a symbolic link only anyway.</li><li>The &#8220;&#8211;python-version&#8221; option is applied at Nuitka start time to re-launch Nuitka with the given Python version, to make sure that the Python run time used for computations and link time Python versions are the same. The allowed values are now checked (2.6, 2.7 and 3.2) and the user gets a nice error with wrong values.</li><li>Added &#8220;&#8211;keep-pythonpath&#8221; alias for &#8220;&#8211;execute-with-pythonpath&#8221; option, probably easier to remember.</li><li>Support &#8220;&#8211;debug&#8221; with clang, so it can also be used to check the generated code for all warnings, and perform assertions. Didn&#8217;t report anything new.</li><li>The contents environment variable &#8220;CXX&#8221; determines the default C++ compiler when set, so that checking with &#8220;CXX=g++-4.7 nuitka-python &#8230;&#8221; has become supported.</li><li>The &#8220;check-with-pylint&#8221; script now has a real command line option to control the display of &#8220;TODO&#8221; items.</li></ul></div><div id="cleanups" class="section"><h2>Cleanups</h2><ul><li><p class="first">Changed complex assignments, i.e. assignments with multiple targets to such using a temporary variable and multiple simple assignments instead.</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;">a <span style="color: #666666;">=</span> b <span style="color: #666666;">=</span> c</pre></div><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;">_tmp <span style="color: #666666;">=</span> c
b <span style="color: #666666;">=</span> _tmp
a <span style="color: #666666;">=</span> _tmp</pre></div><p>In CPython, when one assignment raises an exception, the whole thing is aborted, so the complexity of having multiple targets is no more needed, now that we have temporary variables in a block.</p><p>All that was really needed, was to evaluate the complete source expression only once, but that made code generation contain ugly loops that are no more needed.</li><li><p class="first">Changed unpacking assignments to use temporary variables. Code like this:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;">a, b <span style="color: #666666;">=</span> c</pre></div><p>Is handled more like this:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;">_tmp_iter <span style="color: #666666;">=</span> <span style="color: #008000;">iter</span>( c )
_tmp1 <span style="color: #666666;">=</span> <span style="color: #008000;">next</span>( _tmp_iter )
_tmp2 <span style="color: #666666;">=</span> <span style="color: #008000;">next</span>( _tmp_iter )
<span style="color: #008000; font-weight: bold;">if</span> <span style="color: #aa22ff; font-weight: bold;">not</span> finished( _tmp_iter ):
    <span style="color: #008000; font-weight: bold;">raise</span> <span style="color: #d2413a; font-weight: bold;">ValueError</span>( <span style="color: #ba2121;">"too many values to unpack"</span> )
a <span style="color: #666666;">=</span> _tmp1
b <span style="color: #666666;">=</span> _tmp2</pre></div><p>In reality, not really &#8220;next&#8221; is used, as it wouldn&#8217;t raise the correct exception for unpacking, and the &#8220;finished&#8221; check is more condensed into it.</p><p>Generally this cleanup allowed that the &#8220;AssignTargetTuple&#8221; and associated code generation was removed, and in the future value propagation should optimize these &#8220;next&#8221; and &#8220;iter&#8221; calls away where possible. At this time, this is not done yet.</li><li><p class="first">Exception handlers assign caught exception value through assignment statement.</p><p>Previously the code generated for assigning from the caught exception was not considered part of the handler. It now is the first statement of an exception handler or not present, this way it may be optimized as well.</li><li><p class="first">Exception handlers now explicitly catch more than one type.</p><p>Catching multiple types worked by merits of the created tuple object working with the Python C/API function called, but that was not explicit at all. Now every handler has a tuple of exceptions it catches, which may only be one, or if None, it&#8217;s all.</li><li><p class="first">Contractions are now functions as well.</p><p>Contractions (list, dict, and set) are now re-formulated as function bodies that contain for loops and conditional statements. This allowed to remove a lot of special code that dealt with them and will make these easier to understand for optimization and value propagation.</li><li><p class="first">Global is handled during tree building.</p><p>Previously the global statement was its own node, which got removed during the optimization phase in a dedicated early optimization that applied its effect, and then removed the node.</p><p>It was determined, that there is no reason to not immediately apply the effect of the global variable and take closure variables and add them to the provider of that &#8220;global&#8221; statement, allowing to remove the node class.</li><li><p class="first">Read only module variable detection integrated to constraint collection.</p><p>The detection of read only module variables was so far done as a separate step, which is no more necessary as the constraint collection tracks the usages of module variables anyway, so this separate and slow step could be removed.</li></ul></div><div id="new-tests" class="section"><h2>New Tests</h2><ul><li><p class="first">Added test to cover order of calls for complex assignments that unpack, to see that they make a fresh iterator for each part of a complex assignment.</p></li><li><p class="first">Added test that unpacks in an exception catch. It worked, due to the generic handling of assignment targets by Nuitka, and I didn&#8217;t even know it can be done, example:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">try</span>:
    <span style="color: #008000; font-weight: bold;">raise</span> <span style="color: #d2413a; font-weight: bold;">ValueError</span>(<span style="color: #666666;">1</span>,<span style="color: #666666;">2</span>)
<span style="color: #008000; font-weight: bold;">except</span> <span style="color: #d2413a; font-weight: bold;">ValueError</span> <span style="color: #008000; font-weight: bold;">as</span> (a,b):
    <span style="color: #008000; font-weight: bold;">print</span> <span style="color: #ba2121;">"Unpacking caught exception and unpacked"</span>, a, b</pre></div><p>Will assign &#8220;a=1&#8243; and &#8220;b=2&#8243;.</li><li><p class="first">Added test to cover return statements on module level and class level, they both must give syntax errors.</p></li><li><p class="first">Cover exceptions from accessing unassigned global names.</p></li><li><p class="first">Added syntax test to show that star imports do not allow other names to be imported at the same time as well.</p></li></ul></div><div id="summary" class="section"><h2>Summary</h2><p>From a user standpoint, Nuitka is <em>still</em> not very useful. But the progress made towards value propagation and type inference is <em>very</em> significant, and makes those appears as if they are achievable &#8220;relatively soon&#8221; now.</p><p>&nbsp;</p></div> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/04/nuitka-release-0-3-21/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Nuitka Release 0.3.20</title><link>http://nuitka.net/blog/2012/02/nuitka-release-0-3-20-10/</link> <comments>http://nuitka.net/blog/2012/02/nuitka-release-0-3-20-10/#comments</comments> <pubDate>Mon, 27 Feb 2012 21:48:30 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=892</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. Please see the page &#8220;What is Nuitka?&#8221; for clarification of what it is now and what it wants to be. This time there are a few bug fixes &#8230; <a href="http://nuitka.net/blog/2012/02/nuitka-release-0-3-20-10/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>This time there are a few bug fixes and some really major cleanups, lots of new optimizations and preparations for more. And then there is a new compiler clang and a new platform supported. MacOS X appears to work mostly, thanks for the patches from Pete Hunt.</p><div id="bug-fixes" class="section"><h2>Bug fixes</h2><ul class="simple"><li>The use of a local variable name as an expression was not covered and lead to a compiler crash. Totally amazing, but true, nothing in the test suite of CPython covered this. Issue#30. Fixed in release 0.3.19.1 already.</li><li>The use of a closure variable name as an expression was not covered as well. And in this case corrupted the reference count. Issue#31. Fixed in release 0.3.19.1 already.</li><li>The &#8220;from x import *&#8221; attempted to respect &#8220;__all__&#8221; but failed to do so. Issue#32. Fixed in release 0.3.19.2 already.</li><li>The &#8220;from x import *&#8221; didn&#8217;t give a &#8220;SyntaxError&#8221; when used on Python3. Fixed in release 0.3.19.2 already.</li><li>The syntax error messages for &#8220;global for function argument name&#8221; and &#8220;duplicate function argument name&#8221; are now identical as well.</li><li>Parameter values of generator function could cause compilation errors when used in the closure of list contractions. Fixed.</li></ul></div><div id="new-features" class="section"><h2>New Features</h2><ul class="simple"><li>Added support for disabling the console for Windows binaries. Thanks for the patch go to Michael H Kent.</li><li>Enhanced Python3 support for syntax errors, these are now also compatible.</li><li>Support for MacOS X was added.</li><li>Support for using the &#8220;clang&#8221; compiler was added, it can be enforced via &#8220;&#8211;clang&#8221; option. Currently this option is mainly intended to allow testing the &#8220;MacOS X&#8221; support as good as possible under Linux.</li></ul></div><div id="new-optimizations" class="section"><h2>New Optimizations</h2><ul class="simple"><li>Enhanced all optimizations that previously worked on &#8220;constants&#8221; to work on &#8220;compile time constants&#8221; instead. A &#8220;compile time constant&#8221; can currently also be any form of a builtin name or exception reference. It is intended to expand this in the future.</li><li>Added support for builtins &#8220;bin&#8221;, &#8220;oct&#8221;, and &#8220;hex&#8221;, which also can be computed at compile time, if their arguments are compile time constant.</li><li>Added support for the &#8220;iter&#8221; builtin in both forms, one and two arguments. These cannot be computed at compile time, but now will execute faster.</li><li>Added support for the &#8220;next&#8221; builtin, also in its both forms, one and two arguments. These also cannot be computed at compile time, but now will execute faster as well.</li><li>Added support the the &#8220;open&#8221; builtin in all its form. We intend for future releases to be able to track file opens for including them into the executable if data files.</li><li>Optimize the &#8220;__debug__&#8221; builtin constant as well. It cannot be assigned, yet code can determine a mode of operation from it, and apparently some code does. When compiling the mode is decided.</li><li>Optimize the &#8220;Ellipsis&#8221; builtin constant as well. It falls in the same category as &#8220;True&#8221;, &#8220;False&#8221;, &#8220;None&#8221;, i.e. names of builtin constants that a singletons.</li><li>Added support for anonymous builtin references, i.e. builtins which have names that are not normally accessible. An example is &#8220;type(None)&#8221; which is not accessible from anywhere. Other examples of such names are &#8220;compiled_method_or_function&#8221;. Having these as represented internally, and flagged as &#8220;compile time constants&#8221;, allows the compiler to make more compile time optimizations and to generate more efficient C++ code for it that won&#8217;t e.g. call the &#8220;type&#8221; builtin with &#8220;None&#8221; as an argument.</li><li>All builtin names used in the program are now converted to &#8220;builtin name references&#8221; in a first step. Unsupported builtins like e.g. &#8220;zip&#8221;, for which Nuitka has no own code or understanding yet, remained as &#8220;module variables&#8221;, which made access to them slow, and difficult to recognize.</li><li>Added optimization for module attributes &#8220;__file__&#8221;, &#8220;__doc__&#8221; and &#8220;__package__&#8221; if they are read only. It&#8217;s the same as &#8220;__name__&#8221;.</li><li>Added optimization for slices and subscripts of &#8220;compile time constant&#8221; values. These will play a more important role, once value propagation makes them more frequent.</li></ul></div><div id="organizational" class="section"><h2>Organizational</h2><ul class="simple"><li>Created a &#8220;change log&#8221; from the previous release announcements. It&#8217;s as ReStructured Text and converted to PDF for the release as well, but I chose not to include that in Debian, because it&#8217;s so easy to generate the PDF on that yourself.</li><li>The posting of release announcements is now prepared by a script that converts the ReStructured Text to HTML and adds it to WordPress as a draft posting or updates it, until it&#8217;s release time. Simple, sweet and elegant.</li></ul></div><div id="cleanups" class="section"><h2>Cleanups</h2><ul><li><p class="first">Split out the &#8220;nuitka.nodes.Nodes&#8221; module into many topic nodes, so that there are now &#8220;nuitka.nodes.BoolNodes&#8221; or &#8220;nuitka.nodes.LoopNodes&#8221; to host nodes of similar kinds, so that it is now cleaner.</p></li><li><p class="first">Split &#8220;del&#8221; statements into their own node kind, and use much simpler node structures for them. The following blocks are absolutely the same:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">del</span> a, b<span style="color: #666666;">.</span>c, d</pre></div><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">del</span> a
<span style="color: #008000; font-weight: bold;">del</span> b<span style="color: #666666;">.</span>c
<span style="color: #008000; font-weight: bold;">del</span> d</pre></div><p>So that&#8217;s now represented in the node tree. And even more complex looking cases, like this one, also the same:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">del</span> a, (b<span style="color: #666666;">.</span>c, d)</pre></div><p>This one gives a different parse tree, but the same bytecode. And so Nuitka need no longer concern itself with this at all, and can remove the tuple from the parse tree immediately. That makes them easy to handle. As you may have noted already, it also means, there is no way to enforce that two things are deleted or none at all.</li><li><p class="first">Turned the function and class builder statements into mere assignment statements, where defaults and base classes are handled by wrapping expressions. Previously they are also kind of assignment statements too, which is not needed. Now they were reduced to only handle the &#8220;bases&#8221; for classes and the &#8220;defaults&#8221; for functions and make optional.</p></li><li><p class="first">Refactored the decorator handling to the tree building stage, presenting them as function calls on &#8220;function body expression&#8221; or class body expression&#8221;.</p><p>This allowed to remove the special code for decorators from code generation and C++ templates, making decorations easy subjects for future optimizations, as they practically are now just function calls.</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #aa22ff;">@some_classdecorator</span>
<span style="color: #008000; font-weight: bold;">class</span> <span style="color: #0000ff; font-weight: bold;">C</span>:
    <span style="color: #aa22ff;">@staticmethod</span>
    <span style="color: #008000; font-weight: bold;">def</span> <span style="color: #0000ff;">f</span>():
        <span style="color: #008000; font-weight: bold;">pass</span></pre></div><p>It&#8217;s just a different form of writing things. Nothing requires the implementation of decorators, it&#8217;s just functions calls with function bodies before the assignment.</p><p>The following is only similar:</p><div class="highlight" style="background: #f8f8f8;"><pre style="line-height: 125%;"><span style="color: #008000; font-weight: bold;">class</span> <span style="color: #0000ff; font-weight: bold;">C</span>:
    <span style="color: #008000; font-weight: bold;">def</span> <span style="color: #0000ff;">f</span>():
        <span style="color: #008000; font-weight: bold;">pass</span>

    f <span style="color: #666666;">=</span> <span style="color: #008000;">staticmethod</span>( f )

C <span style="color: #666666;">=</span> some_classdecorator( C )</pre></div><p>It&#8217;s only similar, because the assignment to an intermediate value of &#8220;C&#8221; and &#8220;f&#8221; is not done, and should an exception be raised by the decoration, that name could persist. For Nuitka, the function and class body, before having a name, are an expression, and so can of course be passed to decorators already.</li><li><p class="first">The in-place assignments statements are now handled using temporary variable blocks</p><p>Adding support for scoped temporary variables and references to them, it was possible to re-formulate in-place assignments expressions as normal lookups, in-place operation call and then assignment statement. This allowed to remove static templates and will yield even better generated code in the future.</li><li><p class="first">The for loop used to have has a &#8220;source&#8221; expression as child, and the iterator over it was only taken at the code generation level, so that step was therefore invisible to optimizations. Moved it to tree building stage instead, where optimizations can work on it then.</p></li><li><p class="first">Tree building now generally allows statement sequences to be &#8220;None&#8221; everywhere, and pass statements are immediately eliminated from them immediately. Empty statement sequences are now forbidden to exist.</p></li><li><p class="first">Moved the optimization for &#8220;__name__&#8221; to compute node of variable references, where it doesn&#8217;t need anything complex to replace with the constant value if it&#8217;s only read.</p></li><li><p class="first">Added new bases classes and mix-in classes dedicated to expressions, giving a place for some defaults.</p></li><li><p class="first">Made the builtin code more reusable.</p></li></ul></div><div id="new-tests" class="section"><h2>New Tests</h2><ul class="simple"><li>Added some more diagnostic tests about complex assignment and &#8220;del&#8221; statements.</li><li>Added syntax test for star import on function level, that should fail on Python3.</li><li>Added syntax test for duplicate argument name.</li><li>Added syntax test for global on a function argument name.</li></ul></div><div id="summary" class="section"><h2>Summary</h2><p>The decorator and building changes, the assignment changes, and the node cleanups are all very important progress for the type inference work, because they remove special casing the that previously would have been required. Lambdas and functions now really are the same thing right after tree building. The in-place assignments are now merely done using standard assignment code, the built functions and classes are now assigned to names in assignment statements, much <em>more</em> consistency there.</p><p>Yet, even more work will be needed in the same direction. There may e.g. be work required to cover &#8220;with&#8221; statements as well. And assignments should never be any more complex than unpacking from a temporary variable.</p><p>For this release, there is only minimal progress on the Python3 front, despite the syntax support, which is only miniscule progress. The remaining tasks appear all more or less difficult work that I don&#8217;t want to touch now.</p><p>But overall, it&#8217;s fantastic progress that was made. There are still remaining steps, but I believe, we can foresee that a release may be done that finally actually does type inference and becomes the effective Python compiler this project is all about.</p></div> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/02/nuitka-release-0-3-20-10/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Award winning cat</title><link>http://nuitka.net/blog/2012/02/award-winning-cat/</link> <comments>http://nuitka.net/blog/2012/02/award-winning-cat/#comments</comments> <pubDate>Mon, 20 Feb 2012 11:51:15 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[family]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=865</guid> <description><![CDATA[The sweetness phase is over. At least in that instant. :-)]]></description> <content:encoded><![CDATA[<p><a rel="attachment wp-att-866" href="http://nuitka.net/blog/2012/02/award-winning-cat/katze_medaille/"><img class="alignnone size-full wp-image-866" title="Katze_Medaille" src="http://nuitka.net/wp-uploads/nuitka.net/Katze_Medaille.jpg" alt="" width="425" height="640" /></a></p><p>The sweetness phase is over. At least in that instant. :-)</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/02/award-winning-cat/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Ubuntu Packages for Nuitka</title><link>http://nuitka.net/blog/2012/01/ubuntu-packages-for-nuitka/</link> <comments>http://nuitka.net/blog/2012/01/ubuntu-packages-for-nuitka/#comments</comments> <pubDate>Tue, 31 Jan 2012 07:25:43 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=851</guid> <description><![CDATA[Hello there, as I previously said, I will make these a separate announcement. Thanks to the NeuroDebian project build infrastructure, there is Nuitka packages for the Ubuntu versions back to Maverick, Natty, and Oneiric. Please see the page &#8220;What is Nuitka?&#8221; &#8230; <a href="http://nuitka.net/blog/2012/01/ubuntu-packages-for-nuitka/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Hello there,</p><p>as I previously said, I will make these a separate announcement. Thanks to the NeuroDebian project build infrastructure, there is Nuitka packages for the Ubuntu versions back to Maverick, Natty, and Oneiric.</p><p>Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>You may use the apt sources to track Nuitka or download the packages from the page where I offer the <a href="/blog/nuitka-a-python-compiler/nuitka-releases/">latest version here</a>.</p><p>Note: In fact, it&#8217;s 0.3.19.1 now, which includes a hotfix release made after 0.3.19. The same is in Debian Unstable right now, waiting to propagate into Debian Testing, where there is still 0.3.18 living at this time.</p><p>I would appreciate feedback on these.</p><p>Thanks in advance,<br /> Kay</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/01/ubuntu-packages-for-nuitka/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Nuitka Release 0.3.19</title><link>http://nuitka.net/blog/2012/01/nuitka-release-0-3-19/</link> <comments>http://nuitka.net/blog/2012/01/nuitka-release-0-3-19/#comments</comments> <pubDate>Thu, 26 Jan 2012 19:49:30 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=804</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. This time there are a few bug fixes, major cleanups, more Python3 support, and even new features. A lot things are in this. Please see the page &#8220;What is &#8230; <a href="http://nuitka.net/blog/2012/01/nuitka-release-0-3-19/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. This time there are a few bug fixes, major cleanups, more Python3 support, and even new features. A lot things are in this.</p><p>Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><h2>Bug fixes</h2><p>- The manpages of &#8220;nuitka&#8221; and &#8220;nuitka-python&#8221; had no special layout for the option groups and broken whitespace for &#8220;&#8211;recurse-to&#8221; option. Also &#8220;&#8211;g++-only&#8221; was only partially bold. Released as 0.3.18.1 hotfix already.</p><p>- The command line length improvement we made to Scons for Windows was not portable to Python2.6. Released as 0.3.18.2 hotfix already.</p><p>- Code to detect already considered packages detection was not portable to Windows, for one case, there was still a use of &#8220;/&#8221; instead of using a &#8220;joinpath&#8221; call. Released as 0.3.18.3 already.</p><p>- A call to the range built-in with no arguments would crash the compiler, see <a href="http://bugs.nuitka.net/issue29">Issue#29</a>. Released as 0.3.18.4 already.</p><p>- Compatibility Fix: When rich comparison operators returned false value other &#8220;False&#8221;, for comparison chains, these would not be used, but &#8220;False&#8221; instead, see .</p><p>The support for &#8220;__import__&#8221; didn&#8217;t cover keyword arguments, these were simply ignored. See <a href="http://bugs.nuitka.net/issue28">Issue#28</a>. Fixed, but no warning is given yet.</p><h2>New Features</h2><p>- A new option has been added, one can now specify &#8220;&#8211;recurse-directory&#8221; and Nuitka will attempt to embed these modules even if not obviously imported. This is not yet working perfect yet, but will receive future improvements.</p><p>- Added support for the &#8220;exec&#8221; built-in of Python3, this enables us to run one more basic test, &#8220;GlobalStatement.py&#8221; with Python3. The test &#8220;ExecEval.py&#8221; nearly works now.</p><h2>New Optimizations</h2><p>- The no arguments &#8220;range()&#8221; call now optimized into the static CPython exception it raises.</p><p>- Parts of comparison chains with constant arguments are now optimized away.</p><h2>Cleanups</h2><p>- Simplified the &#8220;CPythonExpressionComparison&#8221; node, it now always has only 2 operands. If there are more, the so called comparison chain, it&#8217;s done via &#8220;and&#8221; with assignments to temporary variables, which are expressed by a new node type &#8220;CPythonExpressionTempVariableRef&#8221;. This allowed to remove &#8220;expression_temps&#8221; from code templates and generation, reducing the overall complexity.</p><p>- When executing a module (&#8220;&#8211;execute&#8221; but not &#8220;&#8211;exe&#8221;), no longer does Nuitka import it into itself, instead a new interpreter is launched with a fresh environment.</p><p>- The calls to the variadic &#8220;MAKE_TUPLE&#8221; were replaced with calls the MAKE_TUPLExx, that are generated on a as-needed basis. This gives more readable code, because no EVAL_ORDERED_xx is needed at call site anymore.</p><p>- Many node classes have moved to new modules in &#8220;nuitka.nodes&#8221; and grouped by theme. That should make them more accessible.</p><p>- The choosing of the debug python has moved from Scons to Nuitka itself. That way it can respect the &#8220;sys.abiflags&#8221; and works with Python3.</p><p>- The replacing of &#8220;.py&#8221; in filenames was made more robust. No longer is &#8220;str.replace&#8221; used, but instead proper means to assure that having &#8220;.py&#8221; as other parts of the filenames won&#8217;t be a trouble.</p><p>- Module recursion was changed into its own module, instead of being hidden in the optimization that considers import statements.</p><p>- As always, some PyLint work, and some minor TODOs were solved.</p><h2>Organizational</h2><p>- Added more information to the <a href="/doc/Developer_Manual.pdf">&#8220;Developer Manual&#8221;</a>, e.g. documenting the tree changes for &#8220;assert&#8221; to become a conditional statement with a raise statement, etc.</p><p>- The Debian package is as of this version verified to be installable and functional on to Ubuntu Natty, Maverick, Oneiric, and Precise. I expect to make a separate announcement with the links to packages soonish.</p><p>- Added support to specify the binary under test with a &#8220;NUITKA&#8221; environment, so the test framework can run with installed version of Nuitka too.</p><p>- Made sure the test runners work under Windows as well. Required making them more portable. And a workaround for &#8220;os.execl&#8221; not propagating exit codes under Windows. See <a href="http://bugs.nuitka.net/issue26">Issue#26</a> for more information.</p><p>- For windows target the MinGW library is now linked statically. That means there is no requirement for MinGW to be in the &#8220;PATH&#8221; or even installed to execute the binary.</p><h2>New Tests</h2><p>- The &#8220;basic&#8221;, &#8220;programs&#8221;, &#8220;syntax&#8221;, and &#8220;reflected&#8221; were made executable under Windows. Occasionally this meant to make the test runners more portable, or to work around limitations.</p><p>- Added test to cover return values of rich comparisons in comparison chains, and order of argument evaluation for comparison chains.</p><p>- The &#8220;Referencing.py&#8221; test was made portable to Python3.</p><p>- Cover no arguments &#8220;range()&#8221; exception as well.</p><p>- Added test to demonstrate that &#8220;&#8211;recurse-directory&#8221; actually works. This is using an &#8220;__import__&#8221; that cannot be predicted at run time (yet).</p><p>- The created source package is now tested on pbuilder chroots to be installable and capable of the basic tests, in addition to the full tests during package build time on these chroots. This will make sure, that Nuitka works fine on Ubuntu Natty and doesn&#8217;t break without notice.</p><h2>Numbers</h2><p>There are no new numbers. Nuitka should be as fast as it was, 258% speedup:</p><p>python 2.6:</p><pre>Pystone(1.1) time for 50000 passes = 0.48
This machine benchmarks at 104167 pystones/second</pre><p>Nuitka 0.3.11 (driven by python 2.6):</p><pre>Pystone(1.1) time for 50000 passes = 0.19
This machine benchmarks at 263158 pystones/second</pre><h2>Summary</h2><p>This releases contains many changes. The &#8220;temporary variable ref&#8221; and &#8220;assignment expression&#8221; work is ground breaking. I foresee that it will lead to even more simplifications of code generation in the future, when e.g. inplace assignments can be reduced to assignments to temporary variables.</p><p>While there were many improvements related to Windows support and fixing portability bugs, or the Debian package, the real focus is the optimization work, which will ultimately end with &#8220;value propagation&#8221; working.</p><p>These are the real focus. The old comparison chains were a wart. Working, but no way understood by any analysis in Nuitka. Now they have a structure which makes their code generation based on semantics and allows for future optimizations to see through them.</p><p>Going down this route is an important preparatory step. And there will be more work like this needed. Consider e.g. handling of inplace assignments. With an &#8220;assignment expression&#8221; to a &#8220;temporary variable ref&#8221;, these become the same as user code using such a variable. There will be more of these to find.</p><p>So, that is where the focus is. The release now was mostly aiming at getting involved fixes out. The bug fixed by comparison chain reworking, and the &#8220;__import__&#8221; related one, were not suitable for hotfix releases, so that is why the 0.3.19 release had to occur now. But with plugin support, with this comparison chain cleanup, with improved Python3 support, and so on, there was plenty of good stuff already.</p><p>As always you will find its <a href="/blog/nuitka-a-python-compiler/nuitka-releases/">latest version here</a>.</p><p>Yours,<br /> Kay Hayen</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/01/nuitka-release-0-3-19/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Static Site Generator</title><link>http://nuitka.net/blog/2012/01/static-site-generator/</link> <comments>http://nuitka.net/blog/2012/01/static-site-generator/#comments</comments> <pubDate>Thu, 26 Jan 2012 06:32:46 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=817</guid> <description><![CDATA[Hello, somehow triggered by reading about Mynth, and the re-post of the last release announcement on my feed, just because I added a missing category to the post, I am wondering what it takes to achieve the following: Edit the &#8230; <a href="http://nuitka.net/blog/2012/01/static-site-generator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Hello,</p><p>somehow triggered by reading about Mynth, and the re-post of the last release announcement on my feed, just because I added a missing category to the post, I am wondering what it takes to achieve the following:</p><ol><li>Edit the pages site as ReST (reStructured text) document with links inside</li><li>Edit posts as single ReST files</li><li>Have it look decent and provide feeds, proper caching headers, etc.</li><li>Generate a static site from with, with more control over what kind of updates makes it into the feed.</li></ol><p>I am currently very annoyed, because:</p><ol><li>I would normally generate code examples now with &#8220;rst2man&#8221; and replace the existing WordPress plugin that renders in JavaScript. Except I cannot without re-posting all these articles, or removing the &#8220;python&#8221; tag from them.</li><li>The documentation of Nuitka is in ReST and I even intend to expand it with UML diagrams generated from text. Making the cross to HTML content is difficult.</li><li>Some pages only replicate content from the User or Developer Manual, keeping those updated, in sync, etc. is a dull thing to do.</li><li>Extending WordPress in Python is not feasible. And in php, I doubt I want to master.</li></ol><p>Other stuff in favor of it, is that WordPress or any CMS needs more memory and more time to process than static pages of course. I can&#8217;t right now let anyone fork and edit the pages in a practical manner. So while for user manual and developer manual of Nuitka I will get corrections, for the website it&#8217;s not happening.</p><p>Is Mynth an appropiate intermediate step? Do I really want to learn one of these strange templating languages or even consider software that has no Debian package. I never considered &#8220;virtualenv&#8221; and &#8220;pip&#8221; much of options to run software on a website. I guess I am more tied to Debian than to Python still.</p><p>Over the last months I have occasionally looked at Pyramids, but it seems overly complex, if all you want is to simplify the authoring. I have seen that e.g. Trac supports ReST as an exception, but that feels too little for a hefty software like that.</p><p>I may end up with using ReST to generate HTML which is then uploaded via XMLRPC to WordPress. Won&#8217;t give me the &#8220;static&#8221; benefits. Won&#8217;t solve the post update problem. But at least will let me edit more easily.</p><p>Yours,<br /> Kay</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/01/static-site-generator/feed/</wfw:commentRss> <slash:comments>12</slash:comments> </item> <item><title>Nuitka Release 0.3.18</title><link>http://nuitka.net/blog/2012/01/nuitka-release-0-3-18/</link> <comments>http://nuitka.net/blog/2012/01/nuitka-release-0-3-18/#comments</comments> <pubDate>Sat, 14 Jan 2012 10:34:44 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://nuitka.net/blog/?p=786</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. This time there are a few bug fixes, and the important step that triggered the release: Nuitka has entered Debian Unstable. So you if want, you will get &#8230; <a href="http://nuitka.net/blog/2012/01/nuitka-release-0-3-18/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. This time there are a few bug fixes, and the important step that triggered the release: Nuitka has entered Debian Unstable. So you if want, you will get stable Nuitka releases from now on via &#8220;apt-get install nuitka&#8221;.</p><p>Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>The release cycle was too short to have much focus. It merely includes fixes, which were available as hotfixes, and some additional optimizations and node tree cleanups, as well as source cleanups. But</p><h2>Bug fixes</h2><p>- Conditional statements with both branches empty were not optimized away in all cases, triggering an assertion of code generation. <a href="http://bugs.nuitka.net/issue16">Issue#16</a>. Released as 0.3.17a hotfix already.</p><p>- Nuitka was considering directories to contain packages that had no &#8220;__init__.py&#8221; which could lead to errors when it couldn&#8217;t find the package later in the compilation process. Released as 0.3.17a hotfix already.</p><p>- When providing &#8220;locals()&#8221; to &#8220;exec&#8221; statements, this was not making the &#8220;locals()&#8221; writable. The logic to detect the case that default value is used (None) and be pessimistic about it, didn&#8217;t consider the actual value &#8220;locals()&#8221;. Released as 0.3.17b hotfix already.</p><p>- Compatibility Fix: When no defaults are given, CPython uses &#8220;None&#8221; for &#8220;func.func_defaults&#8221;, but Nuitka had been using &#8220;None&#8221;.</p><h2>New Optimizations</h2><p>- If the condition of assert statements can be predicted, these are now optimized in a static raise or removed.</p><p>- For built-in name references, there is now dedicated code to look them up, that doesn&#8217;t check the module level at all. Currently these are used in only a few cases though.</p><p>- Cleaner code is generated for the simple case of &#8220;print&#8221; statements. This is not only faster code, it&#8217;s also more readable.</p><h2>Cleanups</h2><p>- Removed the &#8220;CPythonStatementAssert&#8221; node. It&#8217;s not needed, instead at tree building, assert statements are converted to conditional statements with the asserted condition result inverted and a raise statement with &#8220;AssertionError&#8221; and the assertion argument. This allowed to remove code and complexity from the subsequent stetps of Nuitka, and enabled existing optimizations to work on assert statements as well.</p><p>- Moved builtin exception names and builtin names to a new module &#8220;nuitka.Builtins&#8221; instead of having in other places. This was previously a bit spread-out and misplaced.</p><p>- Added cumulative &#8220;tags&#8221; to node classes for use in checks. Use it annotate which node kinds to visit in e.g. per scope finalization steps. That avoids kinds and class checks.</p><p>- Enhanced the &#8220;visitor&#8221; interface to provide more kinds of callbacks, enhanced the way &#8220;each scope&#8221; visiting is achieved by generalizing is as &#8220;child has not tag &#8216;closure_taker&#8217;&#8221; and that for every &#8220;node that has tag &#8216;closure_taker&#8217;&#8221;.</p><p>- Moved &#8220;SyntaxHighlighting&#8221; module to &#8220;nuitka.gui&#8221; package where it belongs.</p><p>- More white listing work for imports. As recursion is now the default, and leads to warnings for non-existent modules, the CPython tests gave a lot of good candidates for import errors that should be white listed.</p><p>- Consistently use &#8220;nuitka&#8221; in test scripts, as there isn&#8217;t a &#8220;Nuitka.py&#8221; on all platforms. The later is scheduled for removal.</p><p>- New node for builtin name loopups, which allowed to remove tricks played with adding module variable lookups for &#8220;staticmethod&#8221; when adding them for &#8220;__new__&#8221; or module variable lookups for &#8220;str&#8221; when predicting the result of &#8220;type( &#8216;a&#8217; )&#8221;, which was unlikely to cause a problem, but an important TODO item still.</p><h2>Organizational</h2><p>- The &#8220;Download&#8221; page is now finally updated for releases automatically. This closes <a href="http://bugs.nuitka.net/issue7">Issue#7</a> completely. Up to this release, I had to manually edit that page, but I now mastered the art of upload via XMLRCP and a Python script, so that I don&#8217;t loose as much time with editing, checking it, etc.</p><p>- Added a <a href="/doc/Developer_Manual.pdf">&#8220;Developer Manual&#8221;</a> to the release. It&#8217;s incomplete, but it details some of the existing stuff, coding rules, plans for &#8220;type inference&#8221;, etc.</p><p>- The Debian package is backportable to Ubuntu Natty, Maverick, Oneiric, I expect to make a separate announcement with links to packages soonish.</p><p>- Made sure the test runners worth with bare &#8220;python2.6&#8243; as well.</p><h2>New Tests</h2><p>- Added some tests intended for type inference development.</p><h2>Numbers</h2><p>There are no new numbers. Nuitka should be as fast as it was, 258% speedup:</p><p>python 2.6:</p><pre>Pystone(1.1) time for 50000 passes = 0.48
This machine benchmarks at 104167 pystones/second</pre><p>Nuitka 0.3.11 (driven by python 2.6):</p><pre>Pystone(1.1) time for 50000 passes = 0.19
This machine benchmarks at 263158 pystones/second</pre><h2>Summary</h2><p>This releases contains not as much changes as others. It&#8217;s going to be the stable one for a while. In the mean time, we are going to work on the branch <a href="http://www.nuitka.net/gitweb/?p=Nuitka.git;a=shortlog;h=refs/heads/feature/ctypes_annotation">&#8220;feature/ctypes_annotation&#8221;</a> and rebasing it often while things are still flowing.</p><p>The &#8220;exec&#8221; fix was detected by continued work on the branch <a href="http://www.nuitka.net/gitweb/?p=Nuitka.git;a=shortlog;h=refs/heads/feature/minimize_CPython26_tests_diff">&#8220;feature/minimize_CPython26_tests_diff&#8221;</a> branch, but that work is now complete.</p><p>It is being made pretty (many git rebases) with lots of Issues being added to the bug tracker and referenced for each change. The intention is to have a clean commits repository with the changed made.</p><p>But of course, the real excitement is the the &#8220;type inference&#8221; work. It will give a huge boost to Nuitka. With this in place, new benchmarks may make sense. I am working on getting it off the ground, but also to make us more efficient. So when I learn something. e.g. &#8220;assert&#8221; is not special, I apply it to the &#8220;develop&#8221; branch immediately, to keep the differences as small as possible.</p><p>Overall, this is a great day. I would appreciate it, if you give Nuitka a whirl and let me know how it works for you.</p><p>As always you will find its <a href="/blog/nuitka-a-python-compiler/nuitka-releases/">latest version here</a>.</p><p>Yours,<br /> Kay Hayen</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/01/nuitka-release-0-3-18/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Nuitka 0.3.17 Release</title><link>http://nuitka.net/blog/2012/01/nuitka-0-3-17-release/</link> <comments>http://nuitka.net/blog/2012/01/nuitka-0-3-17-release/#comments</comments> <pubDate>Mon, 09 Jan 2012 09:59:24 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://www.nuitka.net/blog/?p=771</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. This time there are a few bug fixes, lots of very important organisational work, and yet again improved compatibility and cleanups. Also huge is the advance in making &#8230; <a href="http://nuitka.net/blog/2012/01/nuitka-0-3-17-release/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of <a href="http://nuitka.net">Nuitka</a>. This time there are a few bug fixes, lots of very important organisational work, and yet again improved compatibility and cleanups. Also huge is the advance in making &#8220;&#8211;deep&#8221; go away and making the recursion of Nuitka controllable, which means a lot for scalability of projects that use a lot of packages that use other packages, because now you can choose which ones to embed and which ones one.</p><p>Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>The release cycle had a focus on improving the quality of the test scripts, the packaging, and generally to prepare the work on &#8220;type inference&#8221; in a new feature branch. I have also continued to work towards CPython3.2 compatibility, and this version, while not there, supports Python3 with a large subset of the basic tests programs running fine (of course via &#8220;2to3&#8243; conversion) without trouble. There is still work to do, exceptions don&#8217;t seem to work fully yet, parameter parsing seems to have changed, etc. but it seems that CPython3.2 is going to work one day.</p><p>And there has been a lot of effort, to address the Debian packaging to be cleaner and more complete, addressing issues that prevented it from entering the Debian repository. I have entered Debian Mentors, and found a potential sponsor who may upload the packages in foreseeable time. There may be more review comments, but I expect that Nuitka may enter Debian proper.</p><h2>Bug fixes</h2><p>- Fixed the handling of modules and packages of the same name, but with different casing. Problem showed under Windows only. Released as 0.3.16a hotfix already.</p><p>- Fixed an error where the command line length of Windows was exceeded when many modules were embedded, Christopher Tott provided a fix for it. Released as 0.3.16a hotfix already.</p><p>- Fix, avoid to introduce new variables for where built-in exception references are sufficient. Released as 0.3.16b hotfix already.</p><p>- Fix, add the missing &#8220;staticmethod&#8221; decorator to &#8220;__new__&#8221; methods before resolving the scopes of variables, this avoids the use of that variable before it was assigned a scope. Released as 0.3.16b hotfix already.</p><h2>New Features</h2><p>- Enhanced compatibility again, provide enough &#8220;co_varnames&#8221; in the code objects, so that slicing them up to &#8220;code_object.co_argcount&#8221; will work. They are needed by &#8220;inspect&#8221; module and might be used by some decorators as well.</p><p>- New options to control the recursion:</p><ul><li>&#8211;recurse-none (do not warn about not-done recursions)</li><li>&#8211;recurse-all (recurse to all otherwise warned modules)</li><li>&#8211;recurse-to (confirm to recurse to those modules)</li><li>&#8211;recurse-not-to (confirm to not recurse to those modules)</li></ul><h2>New Optimizations</h2><p>- The optimization of constant conditional expressions was not done yet. Added this missing constant propagation case.</p><p>- Eliminate near empty statement sequences (only contain a pass statement) in more places, giving a cleaner node structure for many constructs.</p><p>- Use the pickle &#8220;protocol 2&#8243; on CPython2 except for &#8220;unicode&#8221; strings where it does not work well. It gives a more compressed and binary representation, that is generally more efficient to un-stream as well. Also use the cPickle protocol, the use of &#8220;pickle&#8221; was not really necessary anymore.</p><h2>Organizational</h2><p>- Added a <a href="/doc/Developer_Manual.pdf">&#8220;Developer Manual&#8221;</a> to the release. It&#8217;s incomplete, but it details some of the existing stuff, coding rules, plans for &#8220;type inference&#8221;, etc.</p><p>- Improved the &#8220;&#8211;help&#8221; output to use &#8220;metavar&#8221; where applicable. This makes it more readable for some options.</p><p>- Instead of error message, give help output when no module/program file name was given. This should make Nuitka help more convenient.</p><p>- Consistently use &#8220;#!/usr/bin/env python&#8221; for all scripts, this was previously only done for some of them.</p><p>- Ported the PyLint check script to Python as well, enhancing it on the way to check the exit code, and to only output changes things, as well as making the output of warnings for &#8220;TODO&#8221; items optional.</p><p>- All scripts used for testing, PyLint checking, etc. now work with Python3 as well. Most useful on Arch Linux, where it&#8217;s also already the default for &#8220;Python&#8221;.</p><p>- The help output of Nuitka was polished a lot more. It is now more readable and uses option groups to combine related options together.</p><p>- Make the tests run without any dependence on &#8220;PATH&#8221; to contain the executables of Nuitka. This should make it easier to use.</p><p>- Add license texts to 3rd party file that were missing them, apply &#8220;licensecheck&#8221; results to cleanup Nuitka. Also removed own copyright statement from inline copy of Scons, it had been added by accident only.</p><p>- Release the tests that I own as well as the Debian packaging I created under <a href="http://www.apache.org/licenses/LICENSE-2.0">&#8220;Apache License 2.0&#8243;</a> which is very liberal, meaning every project should be able to use it.</p><p>- Don&#8217;t require copyright assignment for contributions anymore, instead only <a href="http://www.apache.org/licenses/LICENSE-2.0">&#8220;Apache License 2.0&#8243;</a>, the future Nuitka license, so that the code won&#8217;t be a problem when changing the license of all of Nuitka to that license.</p><p>- Give contributors listed in the user manual an exception to the GPL terms until Nuitka is licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">&#8220;Apache License 2.0&#8243;</a> as well.</p><p>- Added an &#8220;&#8211;experimental&#8221; option which can be used to control experimental features, like the one currently being added on <a href="http://www.nuitka.net/gitweb/?p=Nuitka.git;a=shortlog;h=refs/heads/feature/ctypes_annotation">&#8220;feature/ctypes_annotation&#8221;</a>, where &#8220;type inference&#8221; is currently only activated when that option is given. For this stable release, it does nothing.</p><p>- Check the static C++ files of Nuitka with &#8220;cppcheck&#8221; as well. Didn&#8217;t find anything.</p><p>- Arch Linux packages have been contributed, these are linked for download, but the stable package may lag behind a bit.</p><h2>Cleanups</h2><p>- Changed &#8220;not&#8221; boolean operation to become a normal operator. Changed &#8220;and&#8221; and &#8220;or&#8221; boolean operators to a new base class, and making their interface more similar to that of operations.</p><p>- Added cumulative &#8220;tags&#8221; to node classes for use in checks. Use it annotate which node kinds to visit in e.g. per scope finalization steps. That avoids kinds and class checks.</p><p>- Enhanced the &#8220;visitor&#8221; interface to provide more kinds of callbacks, enhanced the way &#8220;each scope&#8221; visiting is achieved by generalizing is as &#8220;child has not tag &#8216;closure_taker&#8217;&#8221; and that for every &#8220;node that has tag &#8216;closure_taker&#8217;&#8221;.</p><p>- Moved &#8220;SyntaxHighlighting&#8221; module to &#8220;nuitka.gui&#8221; package where it belongs.</p><p>- More white listing work for imports. As recursion is now the default, and leads to warnings for non-existent modules, the CPython tests gave a lot of good candidates for import errors that should be white listed.</p><p>- Consistently use &#8220;nuitka&#8221; in test scripts, as there isn&#8217;t a &#8220;Nuitka.py&#8221; on all platforms. The later is scheduled for removal.</p><p>- Some more PyLint cleanups.</p><h2>New Tests</h2><p>- Make sure the basic tests pass with CPython or else fail the test. This is to prevent false positives, where a test passes, but only because it fails in CPython early on and then does so with Nuitka too. For the syntax tests we make sure they fail.</p><p>- The basic tests can now be run with &#8220;PYTHON=python3.2&#8243; and use &#8220;2to3&#8243; conversion in that case. Also the currently not passing tests are not run, so the passing tests continue to do so, with this run from the release test script &#8220;check-release&#8221;.</p><p>- Include the syntax tests in release tests as well.</p><p>- Changed many existing tests so that they can run under CPython3 too. Of course this is via &#8220;2to3&#8243; conversion.</p><p>- Don&#8217;t fail if the CPython test suites are not there. Currently they remain largely unpublished, and as such are mostly only available to me (exception, <a href="http://www.nuitka.net/gitweb/?p=Nuitka.git;a=shortlog;h=refs/heads/feature/minimize_CPython26_tests_diff">&#8220;feature/minimize_CPython26_tests_diff&#8221;</a> branch references the CPython2.6 tests repository, but that remains work in progress).</p><p>- For the compile itself test: Make the presence of the Scons inline copy optional, the Debian package doesn&#8217;t contain it.</p><p>- Also make it more portable, so it runs under Windows too, and allow to choose the Python version to test. Check this test with both CPython2.6 and CPython2.7 not only the default Python.</p><p>- Before releasing, test that the created Debian package builds fine in a minimal Debian &#8220;unstable&#8221; chroot, and passes all the tests included in the package (&#8220;basics&#8221;, &#8220;syntax&#8221;, &#8220;programs&#8221;, &#8220;reflected&#8221;). Also many other Debian packaging improvements.</p><h2>Numbers</h2><p>There are no new numbers. Nuitka should be as fast as it was, 258% speedup:</p><p>python 2.6:</p><pre>Pystone(1.1) time for 50000 passes = 0.48
This machine benchmarks at 104167 pystones/second</pre><p>Nuitka 0.3.11 (driven by python 2.6):</p><pre>Pystone(1.1) time for 50000 passes = 0.19
This machine benchmarks at 263158 pystones/second</pre><h2>Summary</h2><p>The &#8220;git flow&#8221; was used again in this release cycle and proved to be useful not only for hotfix, but also for creating the branch <a href="http://www.nuitka.net/gitweb/?p=Nuitka.git;a=shortlog;h=refs/heads/feature/ctypes_annotation">&#8220;feature/ctypes_annotation&#8221;</a> and rebasing it often while things are still flowing. The few hotfixes didn&#8217;t require a new release, but the many organisational improvements and the new features did warrant the new release, because of e.g. the much better test handling in this release and the improved recursion control.</p><p>The work on Python3 support has slowed down a bit. I mostly only added some bits for compatibility, but generally it has slowed down. I wanted to make sure it doesn&#8217;t regress by accident, so running with CPython3.2 is now part of the normal release tests.</p><p>What&#8217;s still missing is more &#8220;hg&#8221; completeness. Only the &#8220;co_varnames&#8221; work for &#8220;inspect&#8221; was going in that direction, and this has slowed down. It was more important to make Nuitka&#8217;s recursion more accessible with the new options, so that was done first.</p><p>And of course, the real excitement is the the &#8220;type inference&#8221; work. It will give a huge boost to Nuitka, and I am happy that it seems to go well. With this in place, new benchmarks may make sense. I am working on getting it off the ground, so other people can work on it too. My idea of &#8220;ctypes&#8221; native calls may become true sooner than expected. To support that, I would like to add more tools to make sure we discover changes earlier on, checking the XML representations of tests to discover improvements and regressions more clearly.</p><p>Overall, this feels very good. I would appreciate it, if you give Nuitka a whirl and let me know how it works for you.</p><p>As always you will find its <a href="/blog/nuitka-a-python-compiler/nuitka-releases/">latest version here</a>.</p><p>Yours,<br /> Kay Hayen</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2012/01/nuitka-0-3-17-release/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Nuitka Release 0.3.16</title><link>http://nuitka.net/blog/2011/12/nuitka-release-0-3-16/</link> <comments>http://nuitka.net/blog/2011/12/nuitka-release-0-3-16/#comments</comments> <pubDate>Sun, 18 Dec 2011 19:24:16 +0000</pubDate> <dc:creator>kayhayen</dc:creator> <category><![CDATA[compiler]]></category> <category><![CDATA[Nuitka]]></category> <category><![CDATA[Python]]></category><guid isPermaLink="false">http://www.nuitka.net/blog/?p=734</guid> <description><![CDATA[This is to inform you about the new stable release of Nuitka. This time there are many bug fixes, some important scalability work, and again improved compatibility and cleanups. Please see the page &#8220;What is Nuitka?&#8221; for clarification of what it &#8230; <a href="http://nuitka.net/blog/2011/12/nuitka-release-0-3-16/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>This is to inform you about the new stable release of Nuitka. This time there are many bug fixes, some important scalability work, and again improved compatibility and cleanups.</p><p>Please see the page <a href="/blog/nuitka-a-python-compiler/what-is-nuitka/">&#8220;What is Nuitka?&#8221;</a> for clarification of what it is now and what it wants to be.</p><p>The release cycle had a focus on fixing the bug reports I received. I have also continued to look at CPython3 compatibility, and this is the first version to support Python3 somewhat, at least some of the basic tests programs run (of course via &#8220;2to3&#8243; conversion) without trouble. I don&#8217;t know when, but it seems that it&#8217;s going to work one day.</p><p>Also there has an effort to make the Debian packaging cleaner, addressing all kinds of small issues that prevented it from entering the Debian repository. It&#8217;s still not there, but I am getting more helpful now.</p><h2>Bug fixes</h2><p>- Fixed a packaging problem for Linux and x64 platform, the new &#8220;swapFiber.S&#8221; file for the fiber management was not included. Released as 0.3.15a hotfix already.</p><p>- Fixed an error where optimization was performed on removed unreachable code, which lead to an error. Released as 0.3.15b hotfix already.</p><p>- Fixed an issue with &#8220;__import__&#8221; and recursion not happening in any case, because when it did, it failed due to not being ported to new internal APIs. Released as 0.3.15c hotfix already.</p><p>- Fixed &#8220;eval()&#8221; and &#8220;locals()&#8221; to be supported in generator expressions and contractions too. Released as 0.3.15d hotfix already.</p><p>- Fixed the Windows batch files &#8220;nuitka.bat&#8221; and &#8220;nuitka-python.bat&#8221; to not output the &#8220;rem&#8221; statements with the copyright header. Released as 0.3.15d hotfix already.</p><p>- Fixed re-raise with &#8220;raise&#8221;, but without a current exception set. Released as 0.3.15e hotfix already.</p><p>- Fixed &#8220;vars()&#8221; call on the module level, needs to be treated as &#8220;globals()&#8221;. Released as 0.3.15e hotfix already.</p><p>- Fix handling of broken new lines in files. Read the source code in &#8220;universal line ending mode&#8221;. Released as 0.3.15f hotfix already.</p><p>- Fixed handling of constant module attribute &#8220;__name__&#8221; being replaced. Don&#8217;t replace local variables of the same name too. Released as 0.3.15g hotfix already.</p><p>- Fixed assigning to &#8220;True&#8221;, &#8220;False&#8221; or &#8220;None&#8221;. There was this old TODO, and some code has compatibility craft that does it. Released as 0.3.15g hotfix already.</p><p>- Fix constant dictionaries not always being recognized as shared. Released as 0.3.15g hotfix already.</p><p>- Fix generator function objects to not require a return frame to exist. In finalize cleanup it may not.</p><p>- Fixed non-execution of cleanup codes that e.g. flush &#8220;sys.stdout&#8221;, by adding &#8220;Py_Finalize()&#8221;.</p><p>- Fix &#8220;throw()&#8221; method of generator expression objects to not check arguments properly.</p><p>- Fix missing fallback to subscript operations for slicing with non-indexable objects.</p><p>- Fix, in-place subscript operations could fail to apply the update, if the intermediate object was e.g. a list and the handle just not changed by the operation, but e.g. the length did.</p><p>- Fix, the future spec was not properly preserving the future division flag.</p><h2>New Optimizations</h2><p>- The optimization scales now much better, because per-module optimizations only require the module to be reconsidered, but not all modules all the time. With many modules recursed into, this makes a huge difference in compilation time.</p><p>- The creation of dictionaries from constants is now also optimized.</p><p>- The names &#8220;True&#8221;, &#8220;False&#8221; and &#8220;None&#8221; are now converted to constants only when they are read-only module variables.</p><h2>Organizational</h2><p>- As a new feature functions now have the &#8220;func_defaults&#8221; and &#8220;__defaults__&#8221; attribute. It works only well for non-nested parameters and is not yet fully integrated into the parameter parsing. This improves the compatibility somewhat already though.</p><p>- The help output of Nuitka was polished a lot more. It is now more readable and uses option groups to combine related options together.</p><p>- The &#8220;PYTHONPATH&#8221; variable is now cleared when immediately executing a compiled binary unless &#8220;&#8211;execute-with-pythonpath&#8221; is given, in which case it is preserved. This allows to make sure that a binary is in fact containing everything required.</p><p>- The inline copy of Scons is not checked with PyLint anymore. We of course don&#8217;t care.</p><p>- Program tests are no longer executed in the program directory, so failed module inclusions become immediately obvious.</p><p>- The basic tests can now be run with &#8220;PYTHON=python3.2&#8243; and use &#8220;2to3&#8243; conversion in that case.</p><h2>Cleanups</h2><p>- Moved &#8220;tags&#8221; to a separate module, make optimizations emit only documented tags, checked against the list of allowed ones.</p><p>- The Debian package has seen lots of improvements, to make it &#8220;lintian clean&#8221;, even in pedantic mode. The homepage of Nuitka is listed, a watch file can check for new releases, the git repository and the gitweb are referenced, etc.</p><p>- Use &#8220;os.path.join&#8221; is more of the test code.</p><p>- Some more PyLint cleanups.</p><h2>New Tests</h2><p>- There is now a &#8220;Crasher&#8221; test, for tests that crashed Nuitka previously.</p><p>- Added a program test where the imported module does a &#8220;sys.exit()&#8221; and make sure it really doesn&#8217;t continue after the &#8220;SystemExit&#8221; exception that creates.</p><p>- Cover the type of &#8220;__builtins__&#8221; in the main program and in imported modules in tests too. It&#8217;s funny and differs  between module and dict in CPython2.</p><p>- Cover a final print without newline in the test. Should still receive a newline, which only happens when &#8220;Py_Finalize()&#8221; is called.</p><p>- Added test with functions that makes a &#8220;raise&#8221; without an exception set.</p><p>- Cover the calling of &#8220;vars()&#8221; on module level too.</p><p>- Cover the use of eval in contractions and generator expressions too.</p><p>- Cover &#8220;func_defaults&#8221; and &#8220;__default__&#8221; attributes for a function too.</p><p>- Added test function with two &#8220;raise&#8221; in an exception handler, so that one becomes dead code and removed without the crash.</p><h2>Numbers</h2><p>There are no new numbers. Nuitka should be as fast as it was, 258% speedup:</p><p>python 2.6:</p><pre>Pystone(1.1) time for 50000 passes = 0.48
This machine benchmarks at 104167 pystones/second</pre><p>Nuitka 0.3.11 (driven by python 2.6):</p><pre>Pystone(1.1) time for 50000 passes = 0.19
This machine benchmarks at 263158 pystones/second</pre><h2>Summary</h2><p>The &#8220;git flow&#8221; was really great in this release cycle. There were many hotfix releases being made, so that the bugs could be addressed immediately without requiring the overhead of a full release. I believe that this makes Nuitka clearly one of the best supported projects.</p><p>This quick turn-around also encourages people to report more bugs, which is only good. And the structure is there to hold it. Of course, the many bug fixes meant that there is not as much new development, but that is not the priority.</p><p>The work on Python3 is a bit strange. I don&#8217;t need Python3 at all. I also believe it is that evil project to remove cruft from the Python core and make developers of all relevant Python software, add compatibility cruft to their software instead. Yet, I can&#8217;t really stop to work on it. It has that appeal of small fixups here and there, and then something else works too. It&#8217;s like when I was struggling with Nuitka to pass the CPython2 unit tests the first time. It&#8217;s fun. And then it finds real actual bugs that apply to CPython2 too. Not doing &#8220;Py_Finalize&#8221; (but having to), the slice operations shortcomings, the bug of subscript in-place, and so on. There is likely more things hidden, and the early &#8220;Python3&#8243; is supported, the more benefit from increased test covered.</p><p>What&#8217;s missing is more &#8220;hg&#8221; completeness. I think only the &#8220;raise&#8221; without exception set and the &#8220;func_defaults&#8221; issue were going into its direction, but it won&#8217;t be enough yet. Before that, the plan is to make Nuitka&#8217;s options to control recursion more accessible. Right now it requires you to embed all dist-packages or None. And there is no way to specify modules that should be included even if not directly used, which would be important for the hg plugins to use.</p><p>Overall, this feels very good. I would appreciate it, if you give Nuitka a whirl and let me know how it works for you.</p><p>As always you will find its <a href="/blog/nuitka-a-python-compiler/nuitka-releases/">latest version here</a>.</p><p>Yours,<br /> Kay Hayen</p> ]]></content:encoded> <wfw:commentRss>http://nuitka.net/blog/2011/12/nuitka-release-0-3-16/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic
Database Caching using disk: basic

Served from: nuitka.net @ 2012-05-19 17:49:54 -->
