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

New function to expose more info about an installed package #5365

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented Nov 13, 2024

Addresses #1957

Requires posit-dev/ark#625

What's the payoff?

QA Notes

To experience that checkInstalled() still works and to see the user-facing message in the absence of a minimum version requirement, here's one idea:

  • Remove the styler package: remove.packages("styler")
  • Trigger the Format Document command

You should see this:

Screenshot 2024-11-13 at 3 46 39 PM

To experience that checkInstalled() still works and to see the user-facing message in the presence of a minimum version requirement, here's one idea:

  • Install renv at a version below positron-r's minimum version, which is currently 1.0.9. I would do this with pak::pak("[email protected]").

  • Walk through File > New Project > R Project and click the box to use renv:

    Screenshot 2024-11-13 at 3 35 45 PM

As the new project is being stood up, you should see this:

Screenshot 2024-11-13 at 3 37 12 PM

Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

I tend to think we want to keep the per-session cache of what we have already looked up, given that this goes all the way through to the R session and we call this every time we install, check, document, etc.

Were you thinking differently about this?

@jennybc
Copy link
Member Author

jennybc commented Nov 14, 2024

I'm going to bring caching back with a bit of modification. Stay tuned.

@jennybc jennybc force-pushed the package-version-info branch from 049f58b to f986a4d Compare November 14, 2024 23:57
Why?

* Sometimes you want to get info about a package version without necessarily challenging the user to install/upgrade.
* If you do need to nudge the user, this extra info allows us to build a better message.

I also removed the caching, because the extra info makes that increasingly awkward.
@jennybc jennybc force-pushed the package-version-info branch from f986a4d to 604f2fe Compare November 15, 2024 23:14
Comment on lines 537 to 539
pkgInst = await this.packageVersion(pkgName, minimumVersion);
compatible = pkgInst?.compatible ?? false;
return compatible;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit new: previously we always assumed that our attempt to install/update the package was successful. Now we check that specifically, cache new version info, and return the result (hopefully true).

@jennybc
Copy link
Member Author

jennybc commented Nov 15, 2024

OK @juliasilge this is done now, complete with restored and upgraded caching. Additional work that is not shown here: I temporarily added lots of logging to verify that the cache was being used/updated as expected and I was satisfied with the results.

Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

I think something here isn't quite working right yet.

With our current release build, if I try to create a new project using renv but I have renv 1.0.8 installed, I see this:

Screenshot 2024-11-15 at 6 10 36 PM

With a dev build in the same situation, the new project opens up but there is no message or prompt to install renv.

Maybe it's just that ark needs to be bumped in this PR?

@@ -33,6 +35,7 @@ interface EnvVar {
// locale to also be present here, such as LC_CTYPE or LC_TIME. These can vary by OS, so this
// interface doesn't attempt to enumerate them.
interface Locale {
// eslint-disable-next-line @typescript-eslint/naming-convention
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you so much 😭

@jennybc
Copy link
Member Author

jennybc commented Nov 16, 2024

I have already rebased and force pushed this PR branch to include the ark version bump I did earlier today. Do you need to refetch this branch? Any chance you've got a local ark build that's getting used in the dev build instead of the 0.1.154 release from this afternoon?

@jennybc
Copy link
Member Author

jennybc commented Nov 16, 2024

I just re-did the QA step described above and I'm still getting the desired pop-up, with locally built ark and after doing cargo clean forcing an ark release download:

Screenshot 2024-11-15 at 5 39 58 PM

@juliasilge
Copy link
Contributor

I think it's possible what we need is step 4 here, like this commit.

@jennybc
Copy link
Member Author

jennybc commented Nov 16, 2024

🤔 step 4 has happened, in main, in 34695a1. And this PR is rebased on that.

Here's the ark requirement in positron/extensions/positron-r/package.json in this branch:

It does feel like an ark mismatch. Does .ps.ark.version() report 0.1.154 in your dev build?

@jennybc
Copy link
Member Author

jennybc commented Nov 16, 2024

I made one more change, but it would not explain what you're seeing (a complete lack of prompt).

Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

I did a full rebuild.sh and now see the correct prompt:

Screenshot 2024-11-17 at 4 59 07 PM

I'm not totally sure what the problem was (no local build of ark, etc) but thank you for your patience!

@jennybc jennybc merged commit 5f3af4d into main Nov 18, 2024
3 checks passed
@jennybc jennybc deleted the package-version-info branch November 18, 2024 16:48
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants