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

Cache interpreter versions #1932

Merged
merged 4 commits into from
Jul 22, 2024
Merged

Cache interpreter versions #1932

merged 4 commits into from
Jul 22, 2024

Conversation

mmarchetti
Copy link
Collaborator

Intent

This PR avoids repeatedly invoking R and Python interpreters to query their versions, by caching those versions.

Draft PR because I need to think about whether we need to not cache the .pyenv/shims/python interpreter, which runs different interpreters based on pyenv settings and potentially .python-version files.

Follow-on to #1929

Type of Change

    • Bug Fix
    • New Feature
    • Breaking Change
    • Documentation
    • Refactor
    • Tooling
    • Performance

Approach

Cache interpreter versions in agent memory, using interpreter path as the key.

Automated Tests

Existing tests have been updated.

Directions for Reviewers

Inspect projects (especially recursively). We should only request each R or Python interpreter version once.

@mmarchetti mmarchetti marked this pull request as ready for review July 15, 2024 16:07
Copy link
Collaborator

@tdstein tdstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious; what happens if an executable is deleted on the system after it has been added to the cache?

@mmarchetti
Copy link
Collaborator Author

just curious; what happens if an executable is deleted on the system after it has been added to the cache?

If it was still the selected interpreter in Positron/VSCode, the extension would succeed at creating configurations using it, but fail if dependency scanning was attempted.

It seems like we should have these cache entries expire, to handle that case as well as the case where a user removes a local virtualenv and recreates it with a different Python version (for example, because their Connect server doesn't have the prior version).

@sagerb sagerb merged commit 846c26b into main Jul 22, 2024
12 checks passed
@sagerb sagerb deleted the mm-cache-interpreter-versions branch July 22, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants