Skip to content

Creating a new Conda Env creates a ton of calls to onDidChangeEnvironments #19900

Closed

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:

  1. Created extension for pythonAPI usage
  2. Hooked up to onDidChangeEnvironments
  3. Logged e.env.name and e.env.path and e.type on onDidChangeEnvironments
  4. In a terminal, did conda create --name endgameEnv4 python=3.9
  5. 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.

Activity

  1. karrtikr commented on Sep 27, 2022

    @karrtikr

    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 endgameEnv4 emitted in the logs, was the environment visible in environment.all property?

  2. IanMatthewHuff commented on Sep 27, 2022

    @IanMatthewHuff
    MemberAuthor

    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.

    Changed Env: endgameEnv5 /Users/ianhuff/opt/miniconda3/envs/endgameEnv5/bin/python add
    /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94
    Changed Env: jupyterEnv /Users/ianhuff/opt/miniconda3/envs/jupyterEnv/bin/python update
    /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94
    Changed Env: endgameEnv5 /Users/ianhuff/opt/miniconda3/envs/endgameEnv5/bin/python 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.

    Changed Env: pipenvFolder-qBnzia5Z /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python add
    /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94
    Changed Env: undefined /usr/bin/python3 update
    /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94
    Changed Env: undefined /Users/ianhuff/.local/share/virtualenvs/pipenvFolder-qBnzia5Z/bin/python remove
    
  3. added
    area-environmentsFeatures relating to handling interpreter environments
    and removed
    info-neededIssue requires more information from poster
    on Sep 27, 2022
  4. karrtikr commented on Sep 28, 2022

    @karrtikr

    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.

    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.

  5. karrtikr commented on Sep 28, 2022

    @karrtikr

    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.

  6. added
    needs proposalNeed to make some design decisions
    feature-requestRequest for new features or functionality
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 28, 2022
  7. added
    needs PRReady to be worked on
    and removed
    needs proposalNeed to make some design decisions
    on Oct 6, 2022
  8. IanMatthewHuff commented on Oct 25, 2022

    @IanMatthewHuff
    MemberAuthor

    Looks good. I just see a single call now when adding a new env:
    image

  9. locked as resolved and limited conversation to collaborators on Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionalityneeds PRReady to be worked onverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions