Skip to content

Add support for running code in separate process but same runtime #1303

Closed

Description

@juliasilge

Right now, the executeCode API runs code in the console as if the user has typed the code. This is a great fit for many tasks, but there are situations where you want to run code in a separate process, especially a totally clean/fresh one:

  • Running R package tests
  • Checking an R package

We can't use the the default terminal execution for this, because what you get calling R or Python from the terminal is not guaranteed to be the right runtime.

What we are looking for is similar to how the RStudio Build Pane or Background Jobs behaves, although I don't know if we will want a similar UI. Even if we don't want UI like that, we will eventually need to get to a separate process of the right runtime.

Activity

  1. seeM commented on Sep 14, 2023

    @seeM
    Contributor

    We can't use the the default terminal execution for this, because what you get calling R or Python from the terminal is not guaranteed to be the right runtime.

    Could we use default terminal execution but with the full runtime path? E.g. in Python, something like ~/.pyenv/versions/3.12.0a7/bin/python some-command instead of python some-command. I'm not sure if that would work in R.

  2. juliasilge commented on Sep 14, 2023

    @juliasilge
    MemberAuthor

    Ah yes, that may be the way to go, especially initially. In R, we have full runtime path in the metadata that looks like '/Library/Frameworks/R.framework/Resources' so we could do /Library/Frameworks/R.framework/Resources/R -e 'some-R-code'.

    If we did this, I think we would want to use the Task API because it has pretty nice infrastructure for this, ability to parse problems in output, etc.

  3. hadley commented on Sep 22, 2023

    @hadley
    Contributor

    FWIW I think the importance of the build pane is not just a separate process, but also a separate place to put output that's not the console.

  4. self-assigned this
    on Sep 27, 2023
  5. jennybc commented on Sep 28, 2023

    @jennybc
    Member

    I am definitely running into problems from running devtools::check() in the main R session. It clearly changes some options or env vars (which is also a problem, but presumably my problem 😬 ), which, for vroom, creates spurious test failures in subsequent calls to devtools::test().

    Now, obviously, devtools::check() (or maybe vroom's tests?) are part of the problem here. But this underscores that it would be really great to get these package dev tasks out of the user's R session.

  6. added this to the Internal Preview milestone on Oct 3, 2023
  7. lionel- commented on Oct 4, 2023

    @lionel-
    Contributor

    The check task running in the terminal looks nice! I agree that it would be better in the side bar. Should we move the terminal there by default? It would look like:

    Screen.Recording.2023-10-04.at.15.52.45.mov

    Nit: I was a bit surprised to see mentions of the quarto and git extensions in the tooltip:
    Screenshot 2023-10-04 at 15 46 40

    Not a big deal and I guess this might be sorted out once we have a dedicated build pane though.

    @juliasilge Should the "Test" command also be run as a terminal task before we close this issue? It's currently still running in the console. What about "Install package"?

  8. juliasilge commented on Oct 4, 2023

    @juliasilge
    MemberAuthor

    Yep, the changes for testing are being tracked in #1365 and for install/restart/library() in #1279. This issue is about adding the ability to run code in a separate process but the same runtime as a task.

  9. lionel- commented on Oct 5, 2023

    @lionel-
    Contributor

    Sounds good, so we can close this issue! The terminal tasks are looking great.

    I posted my notes about moving the terminal to the side bar in #1486

  10. locked as resolved and limited conversation to collaborators on Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions