From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 6qqYEjYbFGAnXgAA0tVLHw (envelope-from ) for ; Fri, 29 Jan 2021 14:27:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id SAwlDjYbFGA3EAAAB5/wlQ (envelope-from ) for ; Fri, 29 Jan 2021 14:27:02 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9A122940501 for ; Fri, 29 Jan 2021 14:27:01 +0000 (UTC) Received: from localhost ([::1]:40194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Ujk-0002mJ-Ej for larch@yhetil.org; Fri, 29 Jan 2021 09:27:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5Uhv-0001hi-TS for guix-devel@gnu.org; Fri, 29 Jan 2021 09:25:07 -0500 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:40411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5Uhu-00010q-2S; Fri, 29 Jan 2021 09:25:07 -0500 Received: by mail-qk1-x729.google.com with SMTP id u20so8801037qku.7; Fri, 29 Jan 2021 06:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=PRlAh5eeEi5gJFse8+/ccdqsjBPVUqvyMChBjZB31Zc=; b=B2dGK6v0hnZXm8TEhEbRD1hzu5M9tWY1BUBP9R/+82cd18ROGsdf2y8N0tXQOC3N8Z 2IggBvMeV3bjLWBhvcormryASKl2U2PPu51F7pSKQHzzYyNXsYpZkfsARLnyNzCA9U0q jwMMddD1hgJrE+719wLmFRt1gfgZB9SkpJQ4OCyAiRn01h7okLZkwNWzqFsxbE/fcNjH rej2US1ahna5vUU0LdW0NTxF1BpVizz8shkC5LdX8h5mb+tWg6cX4yno/Lq8V4Um+C0d yd3Houe0XlWCVR0hGjJPOy2TsduYGBjS4Ip9VqU5esC9eG9XQS4eVAN4zUtIlPactjaF xgMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=PRlAh5eeEi5gJFse8+/ccdqsjBPVUqvyMChBjZB31Zc=; b=aVvixtcsQ7c96XcUAC/DdlbMsuw68n+VttA/uwaLV43TBOOc7US5XgYiWuwlKhCfwp zAPG/CclLn6mPw+sIk9n+jhZtUo765lSQE8u1tOVjyuFAoBN0VAHQjy3O5NC29TK46Yq g8cRDljiaNQzvG/zZmynxNYl3Ru8AtOfVQLMhDYBGTIlhC5XDg+CFVjfJGHG5tIooUTB 2sFQCbAmeRGX80cutMeaFsPLvu6oi/jrCHCq5LlHR39qCMZFe+m+U3BWBNSZyoSnvPHr t3e7/Tj+VEbth74efwtxg4UGCudxxiGR0bnJvo0NuLaJrg2IiHJT8oBqvkzuHIoiUkBg 4z0A== X-Gm-Message-State: AOAM5327oAanxPwxs1KEV/r3xDI425bDeOaO6yIu8PDeaeAfXAWKec12 +x4QA3svaINlGgAEccOize25YwE8zSQ= X-Google-Smtp-Source: ABdhPJyRfp9SbCOHupu2eQPPOYwogpFKG2ppVMyLSOUpu0HvvInEZqjDC0TZ+HKHdIvQGBroP+AKWg== X-Received: by 2002:a37:c40b:: with SMTP id d11mr4396203qki.73.1611930304478; Fri, 29 Jan 2021 06:25:04 -0800 (PST) Received: from hurd (dsl-148-165.b2b2c.ca. [66.158.148.165]) by smtp.gmail.com with ESMTPSA id c7sm5800552qtm.60.2021.01.29.06.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 06:25:03 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: 03/163: build/python: Add a new guix-pythonpath procedure. References: <20210125070022.22870.17321@vcs0.savannah.gnu.org> <20210125070114.03C0B20E1C@vcs0.savannah.gnu.org> <87czxs3d1i.fsf@gnu.org> <878s8g3bxa.fsf@gmail.com> <87lfcdm9jb.fsf@gnu.org> Date: Fri, 29 Jan 2021 09:25:03 -0500 In-Reply-To: <87lfcdm9jb.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 28 Jan 2021 15:16:24 +0100") Message-ID: <87im7fyg5c.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x729.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.05 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=B2dGK6v0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 9A122940501 X-Spam-Score: -3.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: J/DakrT/MXrs Hi Ludo, Ludovic Court=C3=A8s writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >>>> +(define (guix-pythonpath inputs) >>>> + "Derive the GUIX_PYTHONPATH_X_Y string , with the major and minor v= ersion >>>> +numbers substituted for X and Y, respectively." >>>> + (let ((python (assoc-ref inputs "python"))) >>>> + (string-append "GUIX_PYTHONPATH_" >>>> + (string-replace-substring (python-version python) = "." "_")))) >>> >>> One pattern used elsewhere, notably for =E2=80=98GUIX_LOCPATH=E2=80=99,= is to still keep >>> a single environment variable (that=E2=80=99d be =E2=80=98GUIX_PYTHONPA= TH=E2=80=99 here) but to >>> ensure that only MAJOR.MINOR sub-directories are taken into >>> consideration. >>> >>> IOW, instead of having GUIX_PYTHONPATH_3_8 and GUIX_PYTHONPATH_2_7, >>> you=E2=80=99d have just GUIX_PYTHONPATH but Python 3.8 would only care = about >>> 3.8/ sub-directories while 2.7 would only care about 2.7/ >>> sub-directories. >>> >>> That=E2=80=99s perhaps easier to document and to deal with generally (y= ou only >>> need to look at one specific environment variable). >>> >>> Does that make sense? I don=E2=80=99t know if it=E2=80=99s applicable = in this case >>> though. >> >> One of the limitations lifted by this change is the limitation of >> running a single version of Python per profile. As mentioned in past >> discussions, it's not trivial ensuring that packages installed won't end >> up pulling various versions of Python in a same profile, so it's better >> to prepared for it :-). >> >> Using a non-versioned GUIX_PYTHONPATH would not allow for this, unless >> I'm missing something. > > Sure, I definitely agree. > > I=E2=80=99m advocating for a versioned environment variable too, but I=E2= =80=99m > suggesting that versioning should not be part of the variable name. > > In the =E2=80=98GUIX_LOCPATH=E2=80=99 example I gave, locale data is look= ed up not > directly in the search path entries, but instead in those entries > prefixed by the libc version. See =E2=80=98glibc-versioned-locpath.patch= =E2=80=99. > > If possible, the proposed =E2=80=98GUIX_PYTHONPATH=E2=80=99 variable coul= d work > similarly: =E2=80=9C/MAJOR.MINOR=E2=80=9D would automatically be appended= to each search > path entry. > > That way, both Python 2.7 and 3.8 can populate the same =E2=80=98GUIX_LOC= PATH=E2=80=99 > variable, and eventually 2.7 only picks 2.7 packages and 3.8 only picks > 3.8 packages. > > Does that make more sense? Indeed, I thought about the possibility to filter the GUIX_PYTHONPATH entries based on their version at runtime after I wrote my initial reply. It makes life easier. I've updated the cu/farewell-to-pythonpath branch with this new way of doing things. Thanks for the suggestion! Maxim