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

Refresh branch #4116

Merged
merged 38 commits into from
Jul 22, 2024
Merged

Refresh branch #4116

merged 38 commits into from
Jul 22, 2024

Conversation

limasilet
Copy link

QA Notes

jmcphers and others added 30 commits July 15, 2024 14:58
This change addresses some feedback we've been getting that people who
report issues don't know what the Developer Tools console is or how to
access it.

The "output" can also be unclear but is a more nuanced topic so I've
linked it to our troubleshooting page.

### QA Notes

N/A, issue template change only
Added an integration test for the connections pane.
At this level of abstraction, we are not testing individual clicks (like
in the smoke tests), but testing the internal logic in the extension
that is used by the TreeView API to render the values.

---------

Signed-off-by: Daniel Falbel <[email protected]>
Co-authored-by: Jonathan <[email protected]>
… row data frame from a Parquet file and verifies that three rows in the file (the first, the middle, and the last) render correctly in Pandas, Polars, and R. (#3947)

This PR adds a Data Explorer smoke test that loads a 100 column x 100
row data frame from a Parquet file and verifies that three rows in the
file (the first, the middle, and the last) render correctly in Pandas,
Polars, and R. The data for this smoke test is loaded from the
`qa-example-content` repo.
Merges upstream VS Code 1.91 into Positron.

Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com>
…owerShell (#3909)

Addresses #3816 by using `vscode.ProcessExecution` instead of
`vscode.ShellExecution`, to bypass some tricky quoting issues presented
by PowerShell, without doing our own quoting or writing (much) OS- or
shell-specific code.

The problem is that we want to execute a code snippet like
`rmarkdown::render("whatever.Rmd")` (where `"whatever.Rmd"` needs to be
interpolated in, which is really neither here nor there). So you need
quotes around this file path. But using `ShellExecution` you also need
quotes around the whole `rmarkdown::render()` snippet; let's say these
are single quotes. And, when executed in PowerShell, the entire command
_also_ gets double quoted, which then changes the context for the quotes
in the code snippet, leading to much misery:

```
The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command &
'C:\Program Files\R\R-4.3.3\bin\x64\R.exe' -e 'rmarkdown::render("d:\Users\jenny\rmd-render-
fun\test.Rmd")'" terminated with exit code: 1. 
```

By the time you get to R, the double quotes around the file path have
gone missing (since I captured this error, I have changed the path
separators here as well; but also that is not the problem):

```
> rmarkdown::render(d:\Users\jenny\rmd-render-fun\test.Rmd)
Error: unexpected symbol in "rmarkdown::render(d:\Users"
Execution halted
```

I tried all sorts of things, trying to stick with
`vscode.ShellExecution` and `vscode.ShellQuoting` but never succeeded in
finding a combination of argument strings and quoting that worked on
Windows (PowerShell) and macOS. I became increasingly convinced, similar
to this issue microsoft/vscode#187661, that it
might be impossible.

### QA Notes

Exercise these commands on multiple OSes:

* *R: Render Document with R Markdown*, find this in the command palette
* *R: Source R File*, find this in the command palette or use the "play"
button

Here's a repo I used for experimentation while working on this PR:
https://github.com/jennybc/rmd-render-fun.

You could grab it with

```r
usethis::create_from_github("https://github.com/jennybc/rmd-render-fun", destdir = "~/tmp")
```

Substitute your favorite destination directory for experiments in
`destdir`. This folder sports 2 `.Rmd` files, with and without spaces in
the filename, and likewise for `.R`.
This change fixes an annoying issue in Windows dev environments that can
cause Visual Studio to open during the incremental build.

The problem is that Gulp is invoking `show-version.js`. On Unix-alikes,
the shebang comment in this file causes it to run under Node, but on
Windows, invoking the file opens it in the default editor for `.js`
files.

The fix is to use Node explicitly instead of relying on the shebang. 

### QA Notes

N/A, build change only.
Addresses #3752.

I've also given all of our `@keyframes` unique names to avoid
unintentionally overwriting keyframes across components, which broke
debouncing the activity item to begin with.

I also made the activity item indicator animation timing the same as the
interrupt button, which I think feels better.

Lastly, I added the same fade in to the action bar separator. Before
this PR, it would show immediately even though the interrupt button next
to it faded in.

https://github.com/user-attachments/assets/1c24e135-1910-4f0d-907d-06dab8dbf142

#### QA Notes

It's worth playing around with different Positron components that
animate to make sure the renames didn't break anything.
Addresses #2170.

I also noticed a warning in the console about leaked listeners for the
`onDidRenderThumbnail` event so cleaned that up too.
Tests defaults, setting file name and format.
Added a couple of helpers for the File Explorer and modals

---------

Co-authored-by: Jon Vanausdeln <[email protected]>
There were some missing TestRail Test IDs, so they weren't being reported in TestRail.

### QA Notes

They now show up in TestRail
Basic smoke test of the output pane. For R and Python, enters a bad line
of code and then asserts that it sees a corresponding log in the output
pane.

### QA Notes

All smoke tests should pass.
Address the image referencing problem revealed from #3996

Reference SVG in style sheet so optimizer handles it correctly
This is a simple console user input test. In both Python and R, the
"user" is prompted to enter their name and "Hello ${name}" is echoed
back. The test waits until the echo is received in the console output to
determine pass/fail. This PR also adds in a pasteToConsole function that
simulates a user pasting code as opposed to entering code via a command
(to use the console itself more).

### QA Notes

All smoke tests should pass!
…rnel tests (#3951)

## Description

- Addresses the Python Project ipykernel tests part of #3879

### Summary
- Reorganizes the automation class for Project Wizard
- Each step now has a class which is contained in the Project Wizard
class
    - Selectors are scoped to the class constructors whenever possible
- Opting for usage of the `Locator` class when reasonable (sometimes
waiting for elements and clicking on them still works better with the
BaseElement class)
- Adds a couple ipykernel project wizard tests
- Reorganize Project Wizard smoke tests so all of the Project Wizard
tests can be run with one `only`
- Modify the frontend components for the Project Wizard so that wizard
steps and substeps have an easily referenceable ID, making constructing
selectors easier
<img width="1470" alt="proj_wiz_set_up_py_env_ids"
src="https://github.com/posit-dev/positron/assets/25834218/c6b9028e-3a5a-456f-8062-cc59843fced8">
- Add option to `PositronPythonFixtures` to install ipykernel as part of
selecting the interpreter
- Add new method `popupCurrentlyOpen()` to `PositronPopups` to check if
a popup is currently open
- Support retrieving the active interpreter path from the Interpreter
Dropdown
- Modify `StartInterpreter` methods to support returning the interpreter
path
- NOTE: `StartInterpreter` methods don't seem to be used elsewhere, so
we should add some tests to confirm the class methods are working.
Possibly in
test/smoke/src/areas/positron/top-action-bar/top-action-bar.test.ts?

### 🆕 Smoke Tests
#### Python Project with existing interpreter:
- With ipykernel already installed
- With ipykernel not already installed

## QA Notes

Please add new test IDs and validate on Windows. Thank you :)

---------

Co-authored-by: Jon Vanausdeln <[email protected]>
)

## Description

- Addresses the Python Project conda env part of #3879

### Summary
- Add installation of conda to CI script
`.github/workflows/positron-full-test.yml`
- Add handling for selecting the environment provider in the Project
Wizard Python env provider dropdown
- Add new smoke test for creating a new Python project with a new Conda
environment in the Project Wizard

### 🆕 Smoke Test
#### Python Project with new environment:
- Create a new Conda environment

### QA Notes

If you're testing this locally, make sure you have Conda installed!
Either of the following are lighter-weight options than installing
Anaconda:
- miniforge3:
https://github.com/conda-forge/miniforge?tab=readme-ov-file#install
- miniconda:
https://docs.anaconda.com/miniconda/#quick-command-line-install

Please add new test ID and verify this works on Windows too. Thank you!
## Description

- Addresses the `git init` part of #3879

### Summary
- Add 🆕 smoke test for creating a new Python Project with `git init`
selected

### QA Notes

Please add new test ID and verify this works on Windows too. Thank you!
Another step toward #3276.

This PR moves the rendering of our notebook output webview service to
inside the webview, giving the notebook renderer access to features
which previously did not work, including (from the code):

> Some features known to be NYI:
> - Message passing between the renderer and the host (RenderContext)
> - Extending another renderer (RenderContext)
> - State management (RenderContext)
> - Raw Uint8Array data and blobs

We do this by listening for a new `positronRender` message inside the
webview. I also changed our `render_complete` message to
`positronRenderComplete` and added it to the known message types.

I also made some changes to how we determine the required preloads and
resource roots to bring it more in line with the backlayer webview:

1. **Preloads:** We get preloads by view type instead of by extension.
2. **Resource roots:**
    1. Removed the renderer's extension folder.
    2. Added each renderer's parent folder.
    3. Added each preload's parent folder.
    4. Added each preload's specified `localResourceRoots`.

### QA Notes

This should not break any existing widgets/plots/HTML outputs. Here are
some tests for different code paths:

1. R html content: `gt::gt(mtcars)`
2. Python notebook renderer: `import plotly.express as px;
px.bar(x=["a", "b", "c"], y=[1, 3, 2])`
3. R notebook renderer: `library(plotly); plot_ly(data = iris, x =
~Sepal.Length, y = ~Petal.Length)`
4. Python custom ipywidgets webview: `from ipyleaflet import Map;
display(Map(center=(52.204793, 360.121558), zoom=12))`
Very much like the existing variables test except for notebook sessions.
Tests Python and R notebooks' variables.

### QA Notes

All smoke tests should pass.
Just a minor typo fix and another cleanup. The polars test was using the
R fixture.

### QA Notes

All smoke tests should pass.
<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will 
  automatically close the issue. If there are any details about your 
approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->

This PR improves the logging for the Data Explorer 100x100 test by
outputting row and column information in the `expect` test case.

### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
Just added retries to the console input test so it is less likely to
experience an issue with characters being dropped.

Also removed a dead function that I thought I had previously deleted.

### QA Notes

All smoke tests (besides ones with open product bugs) should pass.
### Intent

Add TestRail Test IDs to 100x100 dataframe tests.

### QA Notes

Now will show up in TestRail runs
Addresses #3453. There is some refactoring here to improve code reuse
with the pandas implementation.

### QA Notes

Enable experimental data explorer features and try expanding the column
profiles for various data types.
See: #2860

This PR differentiates special values in Data Explorer by rendering them
at 65% opacity.

For example, execute the following code:

```
import pandas as pd
df = pd.DataFrame([['ant', 'bee', None, float('nan')], ['None', None, 'fly', float('nan')]])
```

And open the resulting data frame in Data Explorer.

And you will notice that the cells containing `None` and `float('nan')`
are rendered at 65% opacity to differentiate them from normal, non-null
values (like 'ant', 'bee', 'None', and 'fly').

<img width="1240" alt="image"
src="https://github.com/user-attachments/assets/c4b2a9e5-cadb-40a0-9e0c-0189142f02f5">

This applies to data cell values of the following kinds:

NULL
NA
NaN
NotATime
None
INFINITY
NEG_INFINITY
UNKNOWN

### QA Notes

I'd like to generate some example of these values in the
`qa-example-content` repo. I will do this soon.
### Intent

Due to #4070 this test needs to be skipped for run stability


### QA Notes

Test should be enabled once issue is resolved.
…ates (#4066)

## Description

- Addresses remaining pieces of #3879
- Adds Conda installation steps documentation to smoke test README
- Fixes and reorders checks in `pythonEnvironmentStep.tsx` to resolve timing issue when selecting Conda as the env provider while interpreter info is still loading
- Improves timing handling for clicking project wizard navigation buttons (back, next, create, cancel)
- Adds wait for python project wizard dropdown items to load before interacting with them

### QA Notes

- The Conda dropdown timing issue should be resolved
Addresses #4018 

- Add basic support for HTML output, aka things like pandas dataframe
tables.
- Only show a single output element per cell output. 
- A cell output can have multiple data bundles of `mime` + `data`,
previously we would render all of them. Now we just choose one to
render, like other notebook renderers.
- Currently, this is done via a fairly arbitrary ordering of
"interesting" output types, but in the future we may be more structured
about it.

<img width="1199" alt="image"
src="https://github.com/user-attachments/assets/3e9b7e89-855c-48c0-82a3-dcf6ebe4b823">

Also includes a large shuffling of the positron instance code to better
organize it according to how other code in positron is organized with
private and public fields separated.


### QA Notes

Notebooks should continue to work as normal, just simple html outputs
will now actually render. E.g. the above table. Here's the code to
generate one:
```python
import pandas as pd
import numpy as np

# Generate random data
pd.DataFrame({
    'A': np.random.randint(0, 100, size=20),
    'B': np.random.normal(0, 1, size=20),
    'C': np.random.choice(['X', 'Y', 'Z'], size=20),
    'D': np.random.uniform(0, 1, size=20)
})
```
kylebutts and others added 8 commits July 19, 2024 15:39
Prior to this PR, the parser would be called for almost any interaction
with the text (e.g. moving the cursor around). To fix this, cell parsing
was moved from the `CellManager` to `DocumentManager`. A map of
document managers are maintained for each document.
<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will 
  automatically close the issue. If there are any details about your 
approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->

This PR addresses #705
(prompt flickering) by adjusting the prompt to be spaces immediately
after code is executed. This prevents the prompt from being displayed
while code is executing, which was the cause of the flickering.

Prior to this PR, the Console prompt would noticeably flicker about 30%
of the time. The sequence of distinct UI frames that lead to this
flicking are:

1: User enters some code and executes it:

<img width="538" alt="image"
src="https://github.com/user-attachments/assets/33396be9-0f42-41c9-954b-7a985c4c1c60">

2: The `ConsoleInput` component gets the code from the
`CodeEditorWidget`, creates the provisional `ActivityItemInput`
component, then clears the `CodeEditorWidget`'s model. This results in
the following frame because the `CodeEditorWidget` renders the standard
prompt too soon:

<img width="528" alt="image"
src="https://github.com/user-attachments/assets/505f762b-76df-42b5-bfaf-a4aa2e48ead6">

This is what causes the flicker because once the code executes, the
result of the execution is displayed between the `ActivityItemInput` and
the `CodeEditorWidget`:

<img width="528" alt="image"
src="https://github.com/user-attachments/assets/6f1e36c1-0aa7-445f-8d1b-e860a619197e">








### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
The latest release has been finalized at
https://github.com/microsoft/vscode-python/tree/release/2024.10.

The new env locator is housed at
https://github.com/microsoft/python-environment-tools. The least
invasive thing to do for now would be to host builds on GitHub and
download then at yarn time like we do for Ark.

There are also a handful of other changes having to do with the terminal
REPL in vscode-python, so we should investigate those to make sure I
didn't break anything when resolving the merge conflicts.

---------

Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com>
Co-authored-by: Jonathan McPherson <[email protected]>
Minor selector change. Looks like the class runtime-items went away in
the console.

### QA Notes

All smoke tests pass
…0.x to 1.2.x (#4105)

polars 1.2.x contains various behavior changes that had to be worked
around, causing errors like #4070. I reported some of the issues as bugs
upstream in polars (they may or may not be considered bugs in polars --
they look like bugs to me or at minimum unpleasant sharp edges). I was
able to get the unit tests working on both 0.20.x and 1.2.x but we have
a blind spot in our CI right now in that we do not test > polars 1.0
yet.

### QA Notes

These failures arose because the polars version in the smoke test CI
setup wasn't pinned -- it would have been sufficient to run the unit
test suite for both 0.20.x and 1.2.x to find these issues.
Addresses #2829 

This is a brute-force solution to the confusing actions menu in altair
plots.

We hide the menu by selecting it via css (with the path `.vega-embed
details[title="Click to view actions"]`)

Also adds a static property to the
`PositronNotebookOutputWebviewService` service to store these addon css
properties in case we need to do more of them in the future for other
plotting libraries etc..

Ultimately the solution should probably be more robust then this and
involve stubbing in functions for opening new pages etc that the actions
menu tries to use, but that's a lot more work and this gets the job done
at the moment. (See #4087)

### Before
_Altair plot with action menu that is unusable_

![image](https://github.com/user-attachments/assets/78f05113-da7b-4cdf-bcf7-26b36bdc5419)


### After
_Altair plot sans actions menu_
<img width="341" alt="image"
src="https://github.com/user-attachments/assets/a7d00b80-4f19-4b3a-9851-7c29a6e48689">

<!-- Thank you for submitting a pull request.
If this is your first pull request you can find information about
contributing here:
  * https://github.com/posit-dev/positron/blob/main/CONTRIBUTING.md

We recommend synchronizing your branch with the latest changes in the
main branch by either pulling or rebasing.
-->

<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will 
  automatically close the issue. If there are any details about your 
approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->

### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->
…for rendering html in positron notebooks (#4078)

This PR has three main parts to it as told by the (first) three commits:

1. Update the `IPositronNotebookWebviewService` to expose the
`.createRawHtmlOutput()` method and allow that method to create standard
`WebviewElement`s in addition to `OverlayWebview`s. (Also adds the
ability to create the webview without an active runtime due to runtime
requirements preventing notebooks from showing html content until the
kernel is connected.)
2. Add knowledge of the current language runtime attached to a notebook
to the `PositronNotebookInstance` class. (Also uses that knowledge to
make the kernel badge more accurate)
3. Replace the existing rendering of HTML content in notebooks with the
`IPositronNotebookWebviewService.createRawHtmlOutput()` and all the
goodies that we get (and will get in the future) from that.

### QA Notes

This should be a simple under-the-hood swap; nothing should look or work
differently.
Updates Ark to 0.1.118; for
#3846.
@limasilet limasilet marked this pull request as ready for review July 22, 2024 19:20
@limasilet limasilet requested a review from jmcphers July 22, 2024 19:21
@limasilet limasilet marked this pull request as draft July 22, 2024 19:22
@limasilet limasilet changed the title Refresh branch - increase timeout for tart Refresh branch Jul 22, 2024
@limasilet limasilet marked this pull request as ready for review July 22, 2024 19:24
@jmcphers jmcphers merged commit 067ae78 into feature/ec2-pulumi Jul 22, 2024
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.