这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@soapy1
Copy link
Contributor

@soapy1 soapy1 commented Mar 5, 2025

Description

Fixes #12137

This PR introduces two new flag options to the conda config command:

  • --name allows users to specify the name of an environment to apply the config to
  • --prefix allows the user to specify the prefix to apply the config to

For example, if a user wants to add a new channel to their environment named myenv they may do:

$ conda config --append channels my-new-channel -n myenv

This will update the .condarc file in <path to conda deir>/envs/myenv/.condarc.

For invalid environment names or prefixes provided, an error will be returned to the user:

$ conda config --get channels --prefix /i/dont/exist

EnvironmentLocationNotFound: Not a conda environment: /i/dont/exist

Users can see the addition of the new flags:

$ conda config -h
. . .
Config File Location Selection:
  Without one of these flags, the user config file at '/home/sophia/.condarc' is used.

  --system              Write to the system .condarc file at
                        '/home/sophia/projects/conda/devenv/Linux/x86_64/envs/devenv-3.10-c/.condarc'.
  --env                 Write to the active conda environment .condarc file
                        (/home/sophia/projects/conda/devenv/Linux/x86_64/envs/devenv-3.10-c). If no
                        environment is active, write to the user config file (/home/sophia/.condarc).
  --file FILE           Write to the given file.
  -n ENVIRONMENT, --name ENVIRONMENT
                        Name of environment.
  -p PATH, --prefix PATH
                        Full path to environment location (i.e. prefix).
. . .

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Mar 5, 2025
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Mar 5, 2025
@soapy1 soapy1 force-pushed the conda-config-specify-env branch from 84bdf47 to 6607a09 Compare March 5, 2025 17:14
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 5, 2025

CodSpeed Performance Report

Merging #14648 will not alter performance

Comparing soapy1:conda-config-specify-env (856bf01) with main (caeae4f)

Summary

✅ 21 untouched benchmarks

@soapy1 soapy1 marked this pull request as ready for review March 5, 2025 17:36
@soapy1 soapy1 requested a review from a team as a code owner March 5, 2025 17:36
@github-project-automation github-project-automation bot moved this from 🆕 New to 🏗️ In Progress in 🔎 Review Mar 5, 2025
Co-authored-by: Daniel Holth <dholth@anaconda.com>
Co-authored-by: Jannis Leidel <jannis@leidel.info>
@soapy1 soapy1 force-pushed the conda-config-specify-env branch from 2e20d81 to 5b0ccb5 Compare March 6, 2025 00:08
@soapy1 soapy1 force-pushed the conda-config-specify-env branch from 5b0ccb5 to 7c37b89 Compare March 6, 2025 00:11
@kenodegard
Copy link
Contributor

pre-commit.ci autofix

Co-authored-by: jaimergp <jaimergp@users.noreply.github.com>
@kenodegard kenodegard requested a review from jezdez March 6, 2025 20:25
@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to ✅ Approved in 🔎 Review Mar 13, 2025
@jezdez
Copy link
Member

jezdez commented Mar 13, 2025

Huzzah, welcome back @soapy1!

@jezdez jezdez merged commit 83e63ee into conda:main Mar 13, 2025
85 checks passed
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Mar 13, 2025
@soapy1 soapy1 deleted the conda-config-specify-env branch March 13, 2025 16:58
@kenodegard kenodegard mentioned this pull request Mar 17, 2025
81 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add --name/-n option to conda config

6 participants