posit-dev / posit-dev/positron
Clarify in the session selector when a session is running with renv
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
When a new R project is initiated in Positron with renv, a message is printed in the R consoole:
> renv::init()
The following package(s) will be updated in the lockfile:
# CRAN -----------------------------------------------------------------------
- renv [* -> 1.1.4]
The version of R recorded in the lockfile will be updated:
- R [* -> 4.5.0]
- Lockfile written to "~/test-renv/renv.lock".
- renv activated -- please restart the R session.
It would be nice to automatically restart the R session to apply those changes if appropriate.
Subsequent or restarts of consoles print this:
R 4.5.0 restarted.
- Project '~/test-renv' loaded. [renv 1.1.4]
However, there is no visual indicator on the session itself that the R session is backed by renv:
Compare this to how we approach Python virtual environments:
Now while, both renv and venv/uv venv/conda and other tooling approach project-specific environments is not identical, it would still be nice to visually indicate and associate an active session with the renv constraint/project library.
Importantly, an R runtime only becomes renv-managed once the R runtime begins to start, loads the .Rprofile, and loads the renv tooling, which displays in the running console after startup as "Project '~/' loaded. [renv ]"
Proposals
For console sessions that have successfully loaded renv, we could:
- We append
renvalone likeR 4.5.0 (renv) - We append project-name/virtual env name like we do with
uvandvenvand the like or indicate likeR 4.5.0 (renv project-name) - We modify the icon from R to
renvalong with some combination of 1 and 2.
What about opening different "environments"?
If you open a console for a different version of R, ie R 4.3.2, Positron and renv will do the below:
# Bootstrapping renv 1.1.4 ---------------------------------------------------
- Downloading renv ... OK
- Installing renv ... OK
ℹ Using R 4.3.2 (lockfile was generated with R 4.5.0)
- Project '~/test-renv' loaded. [renv 1.1.4]
- The project is out-of-sync -- use `renv::status()` for details.
>
In the Interpreter selector, do we need indicate an option to start a console and loading with or without renv? This might be "wrong", as any R console session within a renv project will load the .Rprofile but is it appropriate for renv to be bootstrapped into new runtime versions?
Open to more discussion but wanted to capture the high-level feedback here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files or tests are named. Start by reviewing the session selector and interpreter selector, comparing their existing Python environment indicators with the reported renv startup state; done means an agreed visual indication for successfully loaded renv sessions and defined behavior when switching R versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100