From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eErjHbrVvl+7KQAA0tVLHw (envelope-from ) for ; Wed, 25 Nov 2020 22:07:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ML+rGbrVvl8udwAA1q6Kng (envelope-from ) for ; Wed, 25 Nov 2020 22:07:54 +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 ADE5B9402DD for ; Wed, 25 Nov 2020 22:07:53 +0000 (UTC) Received: from localhost ([::1]:42582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ki2x5-0000az-G4 for larch@yhetil.org; Wed, 25 Nov 2020 17:07:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ki2wx-0000aY-Qr for help-guix@gnu.org; Wed, 25 Nov 2020 17:07:43 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:40613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ki2wv-0004P2-1G for help-guix@gnu.org; Wed, 25 Nov 2020 17:07:43 -0500 Received: by mail-wr1-x436.google.com with SMTP id m6so3387441wrg.7 for ; Wed, 25 Nov 2020 14:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=XLAzb7/8dumIjoFgIR4YM4cvmCu/jrsnItv61UYM+UY=; b=PtgZsAkdn0KOBhSPoFuLk7eeCXQ2FG7zaOGrvzNm0Z/ONBNUoaUhwKJNwmYBgo6twN jx7Mgetf/Njj1IfGrE4TvbDhnr79fuQO1cxxkWJ8wAid6n4fzKKRcXoPEnrBIIfP+8FV /dX/2A8h+sReuuYQY0bknrtCfsOKYTcusrVgdvYhjpDufHId8OIiHIaMHf1uFUQsqpYH uW39ZSNGfNW9ZINlxnekcslT9t/kfR63jnBDExrhal2PLNJJ78JcbrDXYSdnCPvEeQ9/ RhKtop2SjgCHFHfqjVZe9TYhdjDI2FRIXXNxQkoQK0/XbwkWi8OQHlFEUVzeZ9glce4O pkOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=XLAzb7/8dumIjoFgIR4YM4cvmCu/jrsnItv61UYM+UY=; b=Smb6KzBrJBdVFyZAQ22DDkpik8AWzVkEnLyolsaVdpLBLAACdckO1YfW7gNUBW9ABk yruLna051ItNSuelVMPk8te3Mz5KtMqXtgR8XuAyi6zpZ9wTfHEq+HnysD7sTxTpAhXb Ii+hdpZz5wUpEvS6Gva8zIhdxbzZp661Oiou6QjoZ+7gaMjNmt9wSqsKeWNpxg0GPxWh +crQDe7uvS3N1pIL78gg+ipw5yxHTuF3oJmAGmoJbN2cJJQyDp67lMrbOEeftr51mjrF 1aaeKylLZHpnv0HXP7fCYOJ2DyFCd34LKucfOLNCUSyapN/JwEX66uW72ZPFGWhh9lAB Wjsw== X-Gm-Message-State: AOAM531NbUlZ5I8As3UYQApBMt4m5vv0t2tttarmxFa7de2iVIJbBJ8J 1WoUtQBs7nC346EvNK/xxAEsD2T/bwpxSw== X-Google-Smtp-Source: ABdhPJw3zl7e1PaD2OTxUPpyH6O0UzfrnkW2LbPZt5/bacs/2uChGcoGduYiLQjRDk+iOswAS4Ge5Q== X-Received: by 2002:adf:ea50:: with SMTP id j16mr6314463wrn.283.1606342058883; Wed, 25 Nov 2020 14:07:38 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id w17sm6462662wru.82.2020.11.25.14.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 14:07:38 -0800 (PST) From: zimoun To: Phil , help-guix@gnu.org Subject: Re: Replacing python venv - environment or profile? In-Reply-To: <858sapqjai.fsf@beadling.co.uk> References: <85r1oifz56.fsf@beadling.co.uk> <86ft4ytrgd.fsf@gmail.com> <858sapqjai.fsf@beadling.co.uk> Date: Wed, 25 Nov 2020 23:00:42 +0100 Message-ID: <86sg8xrt9x.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x436.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: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=PtgZsAkd; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: -0.71 X-TUID: LvJ5JtGuh6pD Hi, On Wed, 25 Nov 2020 at 20:21, Phil wrote: > Yes this makes perfect sense to me, I guess what I was missing was that > a 'guix environment' is just a temporary and special case of sourcing a > Guix profile. Yes, if you are curious by the internal machinery. The default profile ~/.guix-profile is a symlink $ readlink -f ~/.guix-profile /gnu/store/z32aid8bjbz7ylwbjfh5x6lbg2g7fiv0-profile Now compare: $ guix environment --ad-hoc hello [env]$ echo $GUIX_ENVIRONMENT /gnu/store/hgh67ilwsbx6v2irc7vgrnv354cv4h8a-profile but no symlink points to the environment temporary profile, so once out, the GC can do its job. To end with the internals, give a look to the file: /gnu/store/=E2=80=A6-profile/etc/profile it describes how the environment variables are set. >> guix environment --ad-hoc python >> [..work..] >> guix pull >> guix environment --ad-hoc python >> >> Now, the first Python is not necessary the exact same than the second >> one. Considering the sequence, > > Yep you're creating two separate environments each taken from the > current 'latest' python version. Which may have been updated by guix > pull for example. Yes, exactly. >>> $ guix environment --pure --manifest=3Dmanifest.scm --root=3D./test-pro= file >> >> I am not convinced you need the --root at first. > > This is purely a way of creating a pure environment from a manifest, and > creating a profile from that same manifest as a one-liner (to pin the > packages in the store). If you'd previously created a profile with the > same manifest this would be unnecessary. Yes. My point was to have at first an explanation about environment vs profile, trying to avoid to mix all the concept in the same time. :-) >> This create a environment, not a profile. For a profile, you should do: >> >> guix package -m manifest.scm -p ./test-profile > > Yep - so this does the same thing as the above, but doesn't then put me > into a 'guix environment' referencing the same pacakges as the > test-profile does. I am not sure that understand what you mean. $ guix environment --pure --manifest=3Dmanifest.scm --root=3D./test-profi= le <=3D> $ guix package -m manifest.scm -p ./test-profile $ eval $(guix package =E2=80=93search-paths=3Dexact) I almost never use the former, i.e., options -m and -r in the same line. And I prefer the latter. Just a matter of taste. However, I use =E2=80=9Cguix environment hello -r /tmp/guix=E2=80=9D. I le= t you notice the difference. ;-) > So, if I instantiate the environment using "--search-paths=3Dexact" then I > get *pure* environment variables, rather than appending or prepending to > the current variables. Yes, even if I do not know if =E2=80=9Cinstantiate the environment=E2=80=9D= is the correct terminology here. :-) > So using this I don't need "guix environment --pure" anymore! Which was > what I wanted. It depends. Sometimes, you want to temporary extend a profile so =E2=80=9C= guix environment=E2=80=9D is really useful. Or run in a container. Or have all= the dependencies necessary of one package, for example: guix environment python-mypy --ad-hoc python-numpy >> But if you want crazy isolation with container, you can do: >> >> guix describe -f channels > my-channels.scm Run guix help guix describe and then the commit capture everything of Guix. So at any point in time, you can still run: guix time-machine =E2=80=93commit=3D123456 =E2=80=93 help and it will be the exact same code running =E2=80=9Chelp=E2=80=9D that the = one running now. And any command works: install, environment, pack, system, etc. >> then any point in time, you will have the exact same environment with: >> >> guix time-machine -C my-channels -- environment -C -m my-manifest.scm > > This is snapshotting not just my manifest, but also the exact state of > the Guix commands themselves - so the environment and the tooling for > that environment are both replicated? Yes. In a repo, you have to track 2 things: the manifest.scm about the packages you need **and** the channels.scm file which is the correct description of their versions (and the versions of all the machinery used to bootstrap, compile or byte-compile them). This way, you can regenerate the exact same =E2=80=9Cenvironment=E2=80=9D a= t any time and any where, for example: guix time-machine -C my-channels -- pack -f docker -m my-manifest.scm > Yes agreed - let's discuss later, I just wanted to give the group a > vague idea of where I'm hopefully ultimately heading with my Guix use, > but I must walk before I run! Sound a cool goal! All the best, simon