Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search algorithm for environments.txt file (remove hardcoded path) #13724

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jrom99
Copy link

@jrom99 jrom99 commented Mar 23, 2024

Description

As seem on #13453, the environments.txt file is a configuration file that is currently hardcoded to ~/.conda/environments.txt and is one (among many) files responsible for the creation of ~/.conda. This commit tries to reduce the dependency on that directory.

The current behavior of get_user_environments_txt_file is ambiguous in that it may return a file to write (default behavior) or multiple files to read (during the execution of list_all_known_prefixes). This commit adds a search algorithm for it so that it is not written to ~/.conda by default (but it's still able to find it there), and adds a docstring specifying the "file to write" behavior.

This commit expands list_all_known_prefixes search algorithm to include all config paths specified in https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#searching-for-condarc.

One should be aware that another user on the same computer may choose to set their $XDG_CONFIG_HOME to a value that is different from $HOME/.config. Since this was not dealt with before (and I'm not sure what should be the expected behavior when one lists environments with admin privileges), I choose not to implement this.

Checklist - did you ...

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

@conda-bot
Copy link
Contributor

We require contributors to sign our Contributor License Agreement and we don't have one on file for @jrom99.

In order for us to review and merge your code, please e-sign the Contributor License Agreement PDF. We then need to manually verify your signature, merge the PR (conda/infrastructure#896), and ping the bot to refresh the PR.

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Apr 3, 2024
@bigodel
Copy link

bigodel commented May 6, 2024

adding a +1 to this feature

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
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

None yet

3 participants