Repository navigation
Creating a new Conda Env creates a ton of calls to onDidChangeEnvironments #19900
Copy link
Copy link
Closed
Closed
Copy link
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityRequest for new features or functionalityneeds PRReady to be worked onReady to be worked onverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Milestone
Description
Testing #19886
The API around onDidChangeEnvironments didn't seem to do what I was expecting when I created a new conda env. I got a ton of calls to this function, an add and an update for the new env were some where in the list, but I was just expecting an add and maybe an update for the new env. Instead it seems like I got an update for basically everything in my python list.
Repro:
- Created extension for pythonAPI usage
- Hooked up to onDidChangeEnvironments
- Logged e.env.name and e.env.path and e.type on onDidChangeEnvironments
- In a terminal, did
conda create --name endgameEnv4 python=3.9 - I expect an add / update for the new env, instead I got the below
Debug Logging
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.10.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.13/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/bin/python3 update
Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python3 update
Extension is using deprecated python APIs which will be removed soon
Changed Env: base /Users/ianhuff/opt/miniconda3/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: base /Users/ianhuff/opt/miniconda3/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.10.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.13/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/bin/python3 update
Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python3 update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: base /Users/ianhuff/opt/miniconda3/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.10.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.13/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/bin/python3 update
Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python3 update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: base /Users/ianhuff/opt/miniconda3/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.10.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.13/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/bin/python3 update
Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python3 update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: base /Users/ianhuff/opt/miniconda3/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Changed Env: .venv /Users/ianhuff/Documents/DataScience/WWBD/.venv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.10.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.0/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /Users/ianhuff/.pyenv/versions/3.9.13/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/bin/python3 update
Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python update
Extension is using deprecated python APIs which will be removed soon
Changed Env: undefined /usr/local/bin/python3 update
Extension is using deprecated python APIs which will be removed soon
Extension is using deprecated python APIs which will be removed soon
Maybe this is expected? But It was not what I was expecting out of this event.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityRequest for new features or functionalityneeds PRReady to be worked onReady to be worked onverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Activity
karrtikr commentedon Sep 27, 2022
This seems expected as currently we trigger a full refresh if a new environment is detected, I think that's why so many changed events were emitted. But I don't see
endgameEnv4emitted in the logs, was the environment visible inenvironment.allproperty?Only log deprecation warning once for each extension (#19901)
IanMatthewHuff commentedon Sep 27, 2022
Sorry the formatting was all wonky on that log. I just tried it again with a new env and I do see the new env (endgameEnv5) getting an add and an update.
Note: This is in with all the others.
Still seems a bit wonky to me that I get all the other updates, just from an API expectation it's not what I was thinking, but I guess the consumers can manage things themselves if they are storing the results and just comparing on what came before.
There also seem to be some entries like this that get added and removed right after so they don't ever show up in .all. Not sure what these are.
karrtikr commentedon Sep 28, 2022
When running a python binary fails, they're removed from the list. Python debug logs should contain the error in detail as to why they were invalid.
karrtikr commentedon Sep 28, 2022
About the API itself, I'll see if there's some way that we can only fire an update for the changed environment. I see two approaches:
Trigger a scoped refresh instead of a full refresh.
For eg. in this case this would mean we only trigger a refresh from the conda locator as that is responsible for emitting the event. This would still lead in events from all conda environments.
Change how we do a full refresh.
Do not update envs during a refresh, and wait for refresh to complete before deciding whether to update an env. This would mean all those extra events won't be emitted as envs haven't really changed.
Only log deprecation warning once for each extension (microsoft#19901)
Wait for refresh to complete before deciding whether an environment h…
Make lookup for new environments detected faster (#19922)
IanMatthewHuff commentedon Oct 25, 2022
Looks good. I just see a single call now when adding a new env:

Only log deprecation warning once for each extension (microsoft#19901)
Make lookup for new environments detected faster (microsoft/vscode-py…