holoviz-dev / pyctdev

Python packaging Common Tasks for Developers
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Install conda packages with `--override-channels` #103

Open maximlt opened 1 year ago

maximlt commented 1 year ago

I've been adding variations of these commands in many parts of the CI, pretty much every time a conflict appeared using this pattern fixed it:

          conda create -n test-environment
          conda activate test-environment
          conda config --env --append channels pyviz/label/dev --append channels conda-forge
          conda config --env --remove channels defaults
          conda install python=3.8 pyctdev
          doit develop_install ...

The idea was to:

  1. create an empty environment
  2. set the channels of that specific environment with conda config --env ...
  3. install the packages without having to define the channels with -c channel1 -c channel2 ...

It seemed like a nice approach that could have been codified in pyctdev to apply it across the repos. Its advantage would be that as a user of that created environment, locally, if you wanted to install something in that environment you wouldn't have to remember what channels it uses and in which order, as the channels are declared for you. However it has two limitations, mostly coming from conda:

Instead of going down that route, I suggest that all the conda create/install commands executed by pyctdev:

I think that approach would be equivalent for conda to what I was doing above. As a user of that created environment, if you want to change the environment, you'll have to remember the whole list of channels and to use --override-channels.