From mboxrd@z Thu Jan 1 00:00:00 1970 From: sirgazil Subject: Re: How can I replace Python venv and pip with Guix? Date: Tue, 04 Feb 2020 09:26:33 -0500 Message-ID: <17010987aea.10e346ca921639.3448394854234656618@zoho.com> References: <170082257a9.bbf196a73697.871070894081541659@zoho.com> <20200204075925.mcfwd7gyzeko5lwz@rafflesia> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyzA3-0003xw-Ow for help-guix@gnu.org; Tue, 04 Feb 2020 09:26:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyzA2-0000H9-Au for help-guix@gnu.org; Tue, 04 Feb 2020 09:26:43 -0500 Received: from sender4-pp-o91.zoho.com ([136.143.188.91]:25171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iyzA1-00008v-W0 for help-guix@gnu.org; Tue, 04 Feb 2020 09:26:42 -0500 In-Reply-To: <20200204075925.mcfwd7gyzeko5lwz@rafflesia> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Sender: "Help-Guix" To: Tanguy Le Carrour Cc: Guix Help ---- On Tue, 04 Feb 2020 02:59:25 -0500 Tanguy Le Carrour wrote ---- > Hi, >=20 > Le 02/02, sirgazil a =C3=A9crit : > > I'm currently using two package managers when working on my projects > > written in Python. I use Guix to install Python, > > Depending on your OS, you can also use Pyenv [1][] to install what > ever version of Python you like. I haven't figured out how to package it > for Guix, though. >=20 > [1]: https://github.com/pyenv/pyenv I only mentioned Python here as something I install with the OS package man= ager, but I actually install other things that are not packaged for the lan= guage package manager. And I wanted to see if I can use Guix instead of sev= eral package managers. > > [=E2=80=A6] > > Emacs Elpy detects the virtual environments I create in this way, so I= can > > activate and deactivate them from Emacs with an easy to use interface = and > > have code completion that depends on the packages available in the act= ive > > environment. > >=20 > > I'd like to use Guix and its environments to replace this functionalit= y and > > to make my development environments easier to reproduce, but I don't > > understand how to that exactly. > >=20 > > So far I have tried the "guix environment" command as follows, trying = to > > create a persistent environment I can activate/deactivate whenever I w= ant: > >=20 > > #+BEGIN_EXAMPLE > > $ guix environment --pure --manifest=3Dguix.scm --root=3D/path/to/my-g= uix-envs/my-project > > #+END_EXAMPLE >=20 > If you want to create a persistent environment, you should use a profile= , > not the `environment` command. > There's a good cookbook entry for that [2][]. >=20 > [2]: https://guix.gnu.org/cookbook/en/html_node/Guix-Profiles-in-Practic= e.html#Guix-Profiles-in-Practice I don't know how I missed this information. I'll take a look, thanks :) > > After running that command, I can see the prompt adds a "[env]" label > > indicating that I'm in the environment, and I can use the packages spe= cified > > in the manifest file. But > >=20 > > =E2=80=A2 How could one make the prompt add "[my-project]" instead of = the generic > > "[env]"? >=20 > I would say this depends on the shell you are using. If you are a Bash > user, you have to set the PS1 variable. If you use Fish [3][], you have = to set your > prompt in a config file: `~/.config/fish/functions/fish_prompt.fish` > and/or `~/.config/fish/functions/fish_right_prompt.fish`. Sorry, what I wanted to say is that I would expect that label to change aut= omatically to "[my-project]" when I use the "--root" option. > > =E2=80=A2 Once I deactivate this environment (Ctrl+D), how can I activ= ate it again? >=20 > I personally use Direnv [4][] to manage this. Whenever I `cd` to a > project folder, it creates and/or activates the venv and deactivates it > when you `cd` out of it. >=20 > [4]: https://github.com/direnv/direnv/wiki/Python >=20 >=20 > Using poetry + pyenv + direnv might be a bit confusing at first, but it'= s > really worth a try! I will give all that a try if Guix doesn't satisfy my needs. Thanks, Tanguy :)