Skip to content

Fix Conda Sourcing Search & Add Profile Init Check #674

@eleanorjboyd

Description

@eleanorjboyd

Current we get the script to conda and then in the function getNamedCondaPythonInfo we locate the sourcing script (like with getCondaHookPs1Path) and check to see if different candidates for where that script could be exist. Instead the design should be as follows:

design

in registerCondaFeatures we should handle all searching in an async manner then store it so we can retrieve it quickly when it actually comes time to build the info in getNamedCondaPythonInfo

in registerCondaFeatures we should:

  • get all the different terminal types
  • get their shell profiles
  • check their shell profiles for the conda init script like this content.includes('# >>> conda initialize >>>#');
  • for each shell, store if conda is sourced in it already
  • additionally search common locations where the conda sourcing script will be and check them, storing the path where each is found
  • if the user has set "condaPath" setting, make sure to include that in the search path to find the conda hook (sourcing script)

other information:

see specific per-shell files that contain getProfile functions, for example that for fish: https://github.com/microsoft/vscode-python-environments/blob/main/src/features/terminal/shells/fish/fishStartup.ts#L22. There are folders per shell here: /Users/eleanorboyd/vscode-python-environments/src/features/terminal/shells

here is a list of paths to check for conda.sh (relative to the conda root):

    • etc/profile.d/conda.sh
    • shell/etc/profile.d/conda.sh
    • Library/etc/profile.d/conda.sh
    • lib/pythonX.Y/site-packages/conda/shell/etc/profile.d/conda.sh
    • site-packages/conda/shell/etc/profile.d/conda.sh
  • Also checks some system-level locations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions