From owner-freebsd-python@freebsd.org Tue Dec 13 11:39:15 2016 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20B40C75C1D for ; Tue, 13 Dec 2016 11:39:15 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0452D36 for ; Tue, 13 Dec 2016 11:39:14 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg0-x243.google.com with SMTP id p66so4283248pga.2 for ; Tue, 13 Dec 2016 03:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=clLtdAXUEQCdKoxzJgNoBpb7rkF2JgSGvwDDp3lUnMo=; b=fBjPHaX67kBt765SK4vFFbtJE1lv6pgqp/1Ihit8Sa7LUmesQ/N8xzEmsuIuqPUuQk 5eruA0Rp6TVmUDV1982GRnxjpqPM76fIk7C81t69BGkWYX+A0+89cS0eEYraIM9n2LC5 LnAIUJCGL3BSNJIDiU2GdGTrQ8ErOGP7cJV9UGfO7oSTz8qu2peU26szJJdn3ixlu9NZ 3RQwldGKU95QhLwggzUj3kltXp45VgR7S4qj5x3mufF2WqsgWMe7RCK8ZXmG3Y0p6Od2 ZIGyGxGYGKT6bW85+VIUrXaLUkFI7ydt/WlPG/5yroRmLY+Awb28VYG0hXVAPyrNnGot gOCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=clLtdAXUEQCdKoxzJgNoBpb7rkF2JgSGvwDDp3lUnMo=; b=AW+I/5vEZiOGbuhI4/rwawW2Qpw4TP/++4WZ3Zi4aettH2/XOvkWnoTNyoBF4LKnz5 2/B4DxSWEzHjoAwg7998pNMGo0Mn6LYtKkuT2aEr1kyhUOhJMuiMSNMAw8OdMoZzFd1l D7r3OZbn2XiAiEcNSq1KX7HtydMBs6p9Y9UBapfL7MGWwv3ECbY29qNTLsrsebkApksU dLaGwhgXw9i7bn9dFRbmoY+bIQjaN4t5C8pNb0CIXf+I0iYBCdghUwa3Bt4d6txywirN IRUm8L+O9WviIukOFuLYiTHFX1wxg0VoMTGOG7VSzBU8LwP/pHUVRri15bI86do8xnkt vvHw== X-Gm-Message-State: AKaTC03Kh7Rgo0LmHVlzjCcArFZN07FycdA0kIEdt8ksJNfTcR69Du4LAphd1j+DpfhOIQ== X-Received: by 10.99.129.200 with SMTP id t191mr170807523pgd.180.1481629154307; Tue, 13 Dec 2016 03:39:14 -0800 (PST) Received: from ?IPv6:2001:44b8:31ae:7b01:605f:517:1eea:14db? (2001-44b8-31ae-7b01-605f-0517-1eea-14db.static.ipv6.internode.on.net. [2001:44b8:31ae:7b01:605f:517:1eea:14db]) by smtp.gmail.com with ESMTPSA id n17sm79954230pfg.80.2016.12.13.03.39.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2016 03:39:13 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: lang/python3* ports, __pycache__ included To: "Vlad K." , freebsd-python@freebsd.org References: From: Kubilay Kocak Message-ID: Date: Tue, 13 Dec 2016 22:36:53 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2016 11:39:15 -0000 On 13/12/2016 10:08 PM, Vlad K. wrote: > On 2016-12-13 11:59, Kubilay Kocak wrote: >> >> Note that they will be re-created on import unless one overrides >> the default for the interpreter to produce these optimization >> files. > > Depends. Those modules are installed in a root owned directory, and > the bytecode cache will get created only if you run (import is enough > as you say) those modules as root, because the cache is written in > the module package directory. > > So pre-packaging the bytecode is a form of optimization, as the > bytecode will be there when you run it as an unprivileged user. > > > I left out "... if the thing you're running can write to site-packages" because the second law of thermodynamics (or rather the proclivity of python software and users to use root) basically guarantees that *if* they can be generated, they eventually *will* be generated. My main point was that if disk utilisation is something one wants to minimise (at deployment), that one would need to be able to turn the optimization knob off each time (or system-wide) and that that would be a handy thing to know and do. Said another way, even if we (FreeBSD) de-packaged optimization files which we want to do, that that *by itself* that would only save package repository size and bandwidth, not deployment size. ./koobs