Resources

Multiple Console Sessions in Positron (Dhruvi Sompura, Posit) | posit::conf(2025)

Multiple Console Sessions in Positron Speaker(s): Dhruvi Sompura Abstract: When it comes to everyday data science work, having access to one interactive R or Python session is often just not enough to get meaningful work done. Having access to multiple interactive sessions has proven useful across a wide variety of data science IDEs, and it has recently become available in Positron! In this talk, learn why data science practitioners need to be able to fluently access more than one interactive session, the specifics of when you might reach for an additional console session to solve a problem, and how to manage multiple console sessions in Positron. posit::conf(2025) Subscribe to posit::conf updates: https://posit.co/about/subscription-management/

image: thumbnail.jpg

Transcript#

This transcript was generated automatically and may contain errors.

Hello, I'm Dhruvi, a member of the Positron team, and I wanted to talk to you about the Multiple Sessions feature we added and how it's going to improve your multitasking workflows.

So this is a feature that has been asked for a lot. We know it's been requested in RStudio for a while, and in Positron this made the top five list of most requested features. I think I'd been on the team less than a day when I found out this is what I'd be working on before I went GA in July. And in March of 2025, we finally got to introduce this to Positron.

You'll notice that this feature is referred to by a couple different names, Multiple Console Sessions or Multiple Interpreter Sessions. It's all the same feature in case that naming confuses you a bit. I'm going to be referring to it as Multiple Interpreter Sessions.

How sessions work

So the first thing I want to do is walk us through how this feature works, like how you create a session, give you an overview of the session UI, and then talk about what an active session is.

The main way you interact with Interpreter Sessions is through the console pane. You create sessions via the Create button. You've already got a session. Clicking the plus button creates a copy of the active session. That's the highlighted session. And we'll learn a little bit more about what the active session is later. But if you click the dropdown next to the plus button, you'll see a list of runtimes Positron has discovered. You can pick one from there to create a session for it.

So once we've got more than one session, you'll see them listed to the right of the console pane. These are all the sessions that are running concurrently. This means you can have each one running code at the same time. We've also introduced icons to the left of the session names that indicate the code execution state. So these icons are used to communicate whether a session is idle or if it's busy executing code. This should make it really easy to see the state of each session at a glance.

You can also rename your sessions. This is handy when you need to tell sessions of the same runtime apart.

So we know how to create and manage sessions. Next question is, how do we know which session the IDE is using? That's where the active session comes in. The active session is the one you've selected from the console pane that is powering the IDE. Editor helpers like Code Completions and Diagnostics use this active session.

So when the active session changes, the editor context also instantly updates. And it's not just editor features. Other UI panes like Plots and Variables also get updated to show you results from this active session.

Use cases for multiple sessions

So we've got the basics of managing sessions down. Now I want to walk us through a couple different use cases that really highlight how multiple sessions removes a lot of friction from multitasking workflows when compared to RStudio. We're going to focus on having two concurrent sessions, but this does work for any number of sessions.

I'm sure many of you have been in the situation where you have a long-running task you need to kick off and a data set that you want to do some analysis on at the same time. In RStudio, you'd probably have handled this by starting a background job or maybe by having two separate RStudio instances open. In Positron, all you have to do is create another session from the console pane like we covered earlier. You could have two sessions of the same runtime running different code. The only thing you need to be aware of is which session is active when you go to execute a piece of code.

And this is all with that native UI support in the IDE that you're used to. You also get to keep the full state of logs, variables, execution history, and errors for each session.

You also get to keep the full state of logs, variables, execution history, and errors for each session.

When it comes to using different runtime versions of a language, we know in RStudio getting multiple IDE instances up against different R versions involves setting an environment variable, setting a directory alias, or even using a third-party tool. But because Positron was made with the intention to natively run against different runtimes, the ability to run concurrent sessions isn't limited to a single runtime version. So if you're trying to test your code against two versions of R, like R4.3 and R4.6, you can get both versions running at the same time. And comparing outputs across both is really simple because the context of each session is just a single click away.

So this can be helpful if you're a package developer, instructor, or anyone who needs to maintain backwards and forwards compatibility for a project.

I want to wrap up with this last idea, which is that you're not limited to your sessions being in the same language either. Positron's a polyglot IDE, which means you can have sessions for different languages running side by side. So if there's a Python package that makes data cleaning a breeze, but you want to use R and Shiny for everything else, you can create a workflow to do that pretty easily in Positron. So whether it's different runtimes or even different languages, multitasking should be easier with a lot less friction now.

Thank you.