conda-mirror icon indicating copy to clipboard operation
conda-mirror copied to clipboard

Support custom channel settings

Open analog-cbarber opened this issue 3 years ago • 4 comments

Any custom channel aliases configured in the user's .condarc file should be recognized so that users can write the alias instead of having to write out the full URL.

E.g. If you have:

custom_channels:
   my-channel: https://my-custom-server.com/

you should be able to specify my-channel as the channel rather than https://my-custom-server.com/my-channel

analog-cbarber avatar Jun 24 '21 00:06 analog-cbarber

To support this we would either need to run conda config --show custom_channels --json and parse the output or find the appropriate .condarc file (see https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#searching-for-condarc). I believe that conda reads all of the config files it can find in the search path in order and applies the keys, so the last file that specifies custom_channels is the correct one.

Probably easier to just call conda config.

analog-cbarber avatar Jul 15 '21 20:07 analog-cbarber

Note that if you run conda config without --json then the auth and token portions of the original URL will be omitted, which is probably not what you want, so you will need to reconstruct the URL from the fields reported in the json records.

analog-cbarber avatar Jul 15 '21 20:07 analog-cbarber

Note that if you run conda config without --json then the auth and token portions of the original URL will be omitted, which is probably not what you want, so you will need to reconstruct the URL from the fields reported in the json records.

Worth pointing out that folks should really be using .netrc files for auth as conda will automatically insert the authentication into the URL as appropriate.

FaustinCarter avatar Jul 15 '21 21:07 FaustinCarter

Worth pointing out that folks should really be using .netrc files for auth as conda will automatically insert the authentication into the URL as appropriate.

Good to know. There is no mention of that in the conda docs.

I think support for that should be in a separate ticket since it applies to all HTTP urls, not just those in custom channels.

FYI, here is the conda code.

analog-cbarber avatar Jul 15 '21 22:07 analog-cbarber