pixi icon indicating copy to clipboard operation
pixi copied to clipboard

feat(cli): add `pixi config` command

Open chawyehsu opened this issue 1 year ago • 7 comments

Implement #1022

chawyehsu avatar May 07 '24 11:05 chawyehsu

Awesome!

wolfv avatar May 07 '24 12:05 wolfv

ready for review

chawyehsu avatar May 09 '24 10:05 chawyehsu

I just played around with this a little. One thing I found is that a broken value just shows "no config found" instead of showing an error when I run pixi config list. This may be something to improve in the config loading :)

wolfv avatar May 10 '24 15:05 wolfv

I also just ran cargo r -- config set change-ps1 false and it would be nice if pixi would print what file it actually changed (e.g. "✅ Added "change-ps1 = true" to your local config at ./.pixi/config.toml".

wolfv avatar May 10 '24 15:05 wolfv

I also couldn't figure out if lists work (e.g. cargo r -- config set default-channels 'bioconda,conda-forge,robostack'). Did you try that? Just curious. I know that conda config had some options for append and prepend, but I am not sure if it's used often enough to warrant more complexity. We could also do something like take a comma delimited list or so ...

wolfv avatar May 10 '24 15:05 wolfv

Hey @chawyehsu awesome job! I just briefly did some tests on my end for functionality (without looking much at the code). Let me know what you think about the comments :) Looking forward to shipping this! 🚢

wolfv avatar May 10 '24 15:05 wolfv

I found is that a broken value just shows "no config found" instead of showing an error when I run pixi config list. This may be something to improve in the config loading :)

If you mean "No configuration values found" then that's when all the options are default and no user defined ones. A different message could be used here but I'm not sure what's better.

it would be nice if pixi would print what file it actually changed

Sounds good, will add.

I also couldn't figure out if lists work (e.g. cargo r -- config set default-channels 'bioconda,conda-forge,robostack'). Did you try that? Just curious.

For default-channels, the only valid input format would be something like '["bioconda","conda-forge","robostack"]' which looks tedious but it's a strictly serialized list.

I am not sure if it's used often enough.

Me neither. For me I would prefer pixi config edit rather than pixi config set for editing complex options. And I can't find a friendly way to support editing object type of options like [mirrors], imagine pixi config set mirrors '<input>', what should <input> look like?

had some options for append and prepend

Do they support list type of options only?

chawyehsu avatar May 11 '24 07:05 chawyehsu

He @chawyehsu,

I've been using it now for some time and it feels great.

Could you add documentation? And possible some examples to the --help. E.g.:

> pixi config set -h
Set a configuration value

Example:
	$ pixi config set --global default-channels '["conda-forge", "nvidia"]'

If that's in I would be happy to merge it!

ruben-arts avatar May 17 '24 11:05 ruben-arts

Doc and test have been added. Also, two new subcommands mentioned above prepend and append are added for easier altering list keys.

chawyehsu avatar May 17 '24 16:05 chawyehsu

Thanks a lot @chawyehsu, this looks good to me!

ruben-arts avatar May 19 '24 11:05 ruben-arts