help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of python pip packages and python virtual environments in guix


From: Hartmut Goebel
Subject: Re: Use of python pip packages and python virtual environments in guix
Date: Thu, 21 Sep 2023 09:12:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

Am 18.09.23 um 17:07 schrieb Timothee Mathieu:
I am new to guix, and I would like to use the containers in order to have 
reproducible development environments for python.

I'm using python virtual env on top of guix, automated using direnv. Anyhow I did not yet try to setup containers for this.

Anyhow, my .envrc might be a starting point:

strict_env

# Colors constants
__NONE="$(tput sgr0)"
__GREEN="$(tput setaf 2)"
__BOLD=$(tput bold)


use_guix --ad-hoc glibc-locales python-wrapper python-pip python-virtualenv \
        python-pyyaml  # add whatever you need

__has_pyenv=no
if [ $(ls $(direnv_layout_dir) 2>/dev/null | grep --count python || true) != 0 ] ; t
hen
   __has_pyenv=yes
fi
if [ $__has_pyenv != yes ] ; then
   echo "${__GREEN}${__BOLD}Setting up virtual environment${__NONE}"
   layout_python3
   python -m pip install -U pip
else
   path_add PATH $(ls -d $(direnv_layout_dir)/python-*/bin)
fi

# more setup


if [ $__has_pyenv != yes ] ; then
   # do this after cloning debops
   echo "${__GREEN}${__BOLD}Installing packages${__NONE}"
   python -m pip install -r requirements.txt
fi




--
Regards
Hartmut Goebel

| Hartmut Goebel          |h.goebel@crazy-compilers.com                |
|www.crazy-compilers.com  | compilers which you thought are impossible |


reply via email to

[Prev in Thread] Current Thread [Next in Thread]