python: dropping the .py files [was Re: Fedora 23 cloud image (and, for that matter, minimal anything)] bloat

Florian Weimer fw at deneb.enyo.de
Fri Sep 25 20:23:11 UTC 2015


* Matthew Miller:

> On Thu, Sep 24, 2015 at 10:10:40AM +0200, Vít Ondruch wrote:
>> Also, you might consider to ship the precompiled bytecode just
>> optionally, using recommends.
>> 
>> On contrary, if you insist on shipping the bytecode, why you don't drop
>> the .py files? I see a lot of duplication all around python packages ....
>
> Wait, we can do that? Why don't we?

It alters backtraces:

Here's a silly example:

Traceback (most recent call last):
  File "u.py", line 2, in <module>
    t.t()
  File "/tmp/t.py", line 2, in t
    a()
  File "/tmp/t.py", line 5, in a
    b()
  File "/tmp/t.py", line 8, in b
    c()
NameError: global name 'c' is not defined

This turns into:

Traceback (most recent call last):
  File "u.py", line 2, in <module>
    t.t()
  File "/tmp/t.py", line 2, in t
  File "/tmp/t.py", line 5, in a
  File "/tmp/t.py", line 8, in b
NameError: global name 'c' is not defined

Such a change will not be universally well-received.

In any case, source code (with comments stripped and whitespace
normalized) is often smaller than bytecode (or most other forms of
serializing syntax), and compresses better.


More information about the devel mailing list