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

Provide a language agnostic way to determine mode in which a Positron session is running #4082

Closed
Tracked by #1617
petetronic opened this issue Jul 19, 2024 · 3 comments
Assignees
Labels
area: builds Issues related to Builds category. area: core Issues related to Core category. enhancement New feature or request

Comments

@petetronic
Copy link
Collaborator

While RStudio uses .rs.api.versionInfo() to describe version and session mode metadata, we want a language agnostic way to provide similar information consistently. Positron currently has ENV vars:
POSITRON=1 and POSITRON_VERSION=YYYY.MM.PP format, which is a reasonable way to achieve this. We need to extend the env with more metadata including the precise build number (the "long" form of the version info), and at least the session mode (e.g. desktop vs. server) once it is hosted in Workbench.

@petetronic petetronic added the enhancement New feature or request label Jul 19, 2024
@petetronic
Copy link
Collaborator Author

Note: Positron also currently passes information to a kernel to describe if the session is supporting a notebook. We should be careful to reconcile terminology here.

@juliasilge juliasilge added area: builds Issues related to Builds category. area: core Issues related to Core category. labels Jul 19, 2024
@juliasilge juliasilge added this to the 2024.10.0 Pre-Release milestone Jul 22, 2024
@juliasilge juliasilge self-assigned this Sep 17, 2024
@juliasilge
Copy link
Contributor

Do we want these additional env vars available in the terminal as well as the Python/R consoles? Right now the terminal only has POSITRON, not any version info at all.

juliasilge added a commit that referenced this issue Sep 19, 2024
…4703)

Addresses #4082 

### TODO

- [x] Bump ark with posit-dev/ark#531

### QA Notes

This PR adds some new env vars to specify the mode (desktop vs. web) and
a long version number, as well as making the terminal env vars more
consistent with the console. You can find them via:

- the R console

```r
Sys.getenv("POSITRON_MODE")
Sys.getenv("POSITRON_LONG_VERSION")
```

- the Python console

```python
import os
print(os.environ['POSITRON_MODE'])
print(os.environ['POSITRON_LONG_VERSION'])
```

- terminals in Positron

```bash
echo "$POSITRON_MODE"
echo "$POSITRON_VERSION"
echo "$POSITRON_LONG_VERSION"
```

In a dev build, the build number isn't defined so you'll see something
like "2024.03.0+undefined" on a web build or "2024.09.0+0" on a desktop
build.

---------

Signed-off-by: Julia Silge <julia.silge@gmail.com>
@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2024.09.0-69
OS Version          : OSX

Test scenario(s)

Verified as described in QA notes here: #4703

Link(s) to TestRail test cases run or created:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: builds Issues related to Builds category. area: core Issues related to Core category. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants