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

Add a serverReadyAction.action to open the URI in the Viewer pane #4553

Closed
seeM opened this issue Sep 3, 2024 · 1 comment
Closed

Add a serverReadyAction.action to open the URI in the Viewer pane #4553

seeM opened this issue Sep 3, 2024 · 1 comment
Assignees
Labels
area: viewer Issues related to Viewer category. enhancement New feature or request theme: app builder

Comments

@seeM
Copy link
Contributor

seeM commented Sep 3, 2024

There is existing support to configure debugging to run some action when a server starts, determined by scraping the contents of the terminal (docs). This is implemented in the debug-server-ready extension.

There are actions to open the URI externally, or debug in Chrome/Edge. We should add an action to open the URI in the Viewer pane.

Here's how you might use it with Streamlit.

  1. Create an app.py file with:
    import pandas as pd
    df = pd.DataFrame({
      'first column': [1, 2, 3, 4],
      'second column': [10, 20, 30, 40]
    })
    df
  2. Create a launch.json with:
    {
      "configurations": [
        {
          "name": "Streamlit",
          "type": "debugpy",
          "request": "launch",
          "module": "streamlit",
          "args": [
            "run",
            "${file}",
            "--server.headless",
            "true",
          ],
          "console": "integratedTerminal",
          "serverReadyAction": {
            "action": "openInViewer",
            "killOnServerStop": false,
            "pattern": "Local URL: http://localhost:([0-9]+)",
            "uriFormat": "http://localhost:%s",
          }
        }
      ]
    }
  3. Start the Streamlit debugger configuration.
  4. It should debug the app (stopping at any breakpoints) and display the app in the Viewer pane.
@seeM seeM added enhancement New feature or request area: viewer Issues related to Viewer category. theme: app builder labels Sep 3, 2024
@seeM seeM added this to the 2024.10.0 Pre-Release milestone Sep 3, 2024
@seeM seeM self-assigned this Sep 3, 2024
seeM added a commit that referenced this issue Sep 4, 2024
@testlabauto
Copy link
Contributor

Verified Fixed

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

Test scenario(s)

debugging with the specified launch.json works with the streamlit-py-example from qa-example-content

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: viewer Issues related to Viewer category. enhancement New feature or request theme: app builder
Projects
None yet
Development

No branches or pull requests

2 participants