[ty] distinguish base conda from child conda by Gankra · Pull Request #19990 · astral-sh/ruff (original) (raw)
Multi-file analysis & type inference
label
Gankra deleted the gankra/conda-venv branch
dcreager added a commit that referenced this pull request
- main: (29 commits)
[ty] add docstrings to completions based on type (#20008)
[
pyupgrade] Avoid reporting__future__features as unnecessary when they are used (UP010) (#19769) [flake8-use-pathlib] Add fixes forPTH102andPTH103(#19514) [ty] correctly ignore field specifiers when not specified (#20002)Option::unwrapis now const (#20007) [ty] Re-arrange "list modules" implementation for Salsa caching [ty] Test "list modules" versus "resolve module" in every mdtest [ty] Wire up "list modules" API to make module completions work [ty] Tweak some completion tests [ty] Add "list modules" implementation [ty] Lightly exposeFileModuleandNamespacePackagefields [ty] Add some more helper routines toModulePath[ty] Fix a bug when convertingModulePathtoModuleName[ty] Split out another constructor forModuleName[ty] Add stub-file tests to existing module resolver [ty] Expose some routines in the module resolver [ty] Add more path helper functions [flake8-annotations] Remove unused import in example (ANN401) (#20000) [ty] distinguish base conda from child conda (#19990) [ty] Fix server hang (#19991) ...
Gankra added a commit that referenced this pull request
Summary
#19990 didn't completely fix the base vs. child conda environment distinction, since it detected slightly different behavior than what I usually see in conda. E.g., I see something like the following:
(didn't yet activate conda, but base is active)
➜ printenv | grep CONDA
CONDA_PYTHON_EXE=/opt/anaconda3/bin/python
CONDA_PREFIX=/opt/anaconda3
CONDA_DEFAULT_ENV=base
CONDA_EXE=/opt/anaconda3/bin/conda
CONDA_SHLVL=1
CONDA_PROMPT_MODIFIER=(base)
(activating conda)
➜ conda activate test
(test is an active conda environment)
❯ printenv | grep CONDA
CONDA_PREFIX=/opt/anaconda3/envs/test
CONDA_PYTHON_EXE=/opt/anaconda3/bin/python
CONDA_SHLVL=2
CONDA_PREFIX_1=/opt/anaconda3
CONDA_DEFAULT_ENV=test
CONDA_PROMPT_MODIFIER=(test)
CONDA_EXE=/opt/anaconda3/bin/condaBut the current behavior looks for CONDA_DEFAULT_ENV = basename(CONDA_PREFIX) for the base environment instead of the child
environment, where we actually see this equality.
This pull request fixes that and updates the tests correspondingly.
Test Plan
I updated the existing tests with the new behavior. Let me know if you
want more tests. Note: It shouldn't be necessary to test for the case
where we have conda/envs/base, since one should not be able to create
such an environment (one with the name of CONDA_DEFAULT_ENV).
Co-authored-by: Aria Desires aria.desires@gmail.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})