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

Investigate environment detection in our overall environment UX to see if there are scenarios where discovery is unnecessary #19102

Closed
karrtikr opened this issue May 9, 2022 · 8 comments · Fixed by #19145, #19162 or #19169
Assignees
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@karrtikr
Copy link

karrtikr commented May 9, 2022

Related: #17498 #18647 #18671

Users can use the API or the refresh icon for triggering it if needed:

Check #19102 (comment) for investigation results.

@karrtikr karrtikr added feature-request Request for new features or functionality needs PR area-environments Features relating to handling interpreter environments labels May 9, 2022
@karrtikr karrtikr self-assigned this May 9, 2022
@karrtikr karrtikr added this to the May 2022 milestone May 9, 2022
@karrtikr
Copy link
Author

karrtikr commented May 13, 2022

Auto-triggering discovery is probably not needed. Only a couple places need it:

  • When auto-selecting interpreters for a new workspace.
  • Triggering it for every scope exactly once (across sessions).

@karrtikr
Copy link
Author

karrtikr commented May 13, 2022

Question: Is triggering it once in the first session even needed, if an interpreter is already selected?

Perhaps not from a user perspective (#18647), but yes, the discovery API is only considered to be ready for query once refresh has been triggered.

Reasons for doing it in the first session:

@karrtikr karrtikr changed the title Investigate environment detection in our overall environment UX to see if there are scenarios where discovery is unnecessary Only trigger auto environment discovery once in the first session for a particular scope May 13, 2022
@karrtikr karrtikr added the verification-needed Verification of issue is requested label May 13, 2022
@karrtikr karrtikr reopened this May 13, 2022
@karrtikr karrtikr removed the verification-needed Verification of issue is requested label May 13, 2022
@karrtikr karrtikr changed the title Only trigger auto environment discovery once in the first session for a particular scope Investigate environment detection in our overall environment UX to see if there are scenarios where discovery is unnecessary May 13, 2022
@karrtikr
Copy link
Author

We also need to make sure legacy jupyter integration APIs still work.

@karrtikr
Copy link
Author

karrtikr commented May 17, 2022

Proposed approach, only auto-trigger discovery if:

  • A user attempts to choose a different interpreter
  • When a particular scope (workspace or global) is opened for the first time
  • When jupyter queries legacy discovery APIs for envs (Jupyter currently queries this on startup)
  • Environment cache is empty

Note we also need to make sure that the selected environment has the latest version, now that discovery isn't run by default.

@karrtikr
Copy link
Author

karrtikr commented May 18, 2022

Verification steps:

If Jupyter is not installed or disabled, verify we auto-trigger discovery only if:

  • A user attempts to choose a different interpreter when quickpick list is opened the first time.
  • When a particular scope (workspace or global) is opened for the first time
  • No Python is installed

If Jupyter is installed, discovery is always triggered.

@karrtikr
Copy link
Author

Certain components (like diagnostics) call for hasInterpreters() API, which requires that discovery is triggered atleast once for it to work. See if we can avoid calling it and make sure information returned by it is reliable enough.

@rchiodo rchiodo added the verified Verification succeeded label Jun 1, 2022
@rchiodo
Copy link

rchiodo commented Jun 1, 2022

/verified?

It does trigger discovery just when opening 'Select interpreters'? Is this expected?

Otherwise behaves as you outlined.

@karrtikr
Copy link
Author

karrtikr commented Jun 1, 2022

A user attempts to choose a different interpreter when quickpick list is opened the first time

Yep, that's what the above point means in #19102 (comment), only happens the first time though.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.