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

Cannot display "application/vnd.dataresource+json" #15004

Closed
1 of 2 tasks
scarf005 opened this issue Jan 9, 2024 · 1 comment
Closed
1 of 2 tasks

Cannot display "application/vnd.dataresource+json" #15004

scarf005 opened this issue Jan 9, 2024 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) notebook-output

Comments

@scarf005
Copy link

scarf005 commented Jan 9, 2024

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Minimal Reproduction

  1. install deno
  2. enable deno's jupyter kernel
  3. write following .ipynb file and open in vscode.
import pl from "npm:nodejs-polars"
import { display } from "https://deno.land/x/display@v1.1.2/mod.ts"

const df = pl.DataFrame({
	fruit: ["Apples", "Oranges"],
	comparability: [0, 1],
})
await display(df)
df

Expected behavior (Jupyter Lab)

image

Actual behaivor (VSCode)

image

The workaround

Preprocessing

With help of denoland/vscode_deno#1014, found out that the display function sent data to jupyter in following format:

message_type: "display_data",
data: {
    "application/vnd.dataresource+json": { data: [ [Object], [Object] ], schema: { fields: [Array] } },
    "text/html": "<table><thead><tr><th>fruit</th><th>comparability</th></tr></thead><tbody><tr><td>Apples</td><td>0</"... 59 more characters
  },
  metadata: {},
  transient: {}
}

Removing "application/vnd.dataresource+json" field fixes it.

Changing presentation

image image

Changing presentation from application/vnd.dataresource+json to text/html fixes it.

However this issue is still problematic because:

  • mimetype application/vnd.dataresource+json is not recognized as JSON
  • data in unrecognized mimetype renders as empty, which is confusing to encounter and hard to figure out the cause
  • most of the time users would probably want HTML output to have the highest priority
  • the behaviour of VSCode extension differs from jupyter lab

VS Code Version

1.85.1 (Universal)

Jupyter Extension Version

v2024.1.2024010901

Jupyter logs

18:56:13.795 [info] Restart requested ~/repo/polars/main.ipynb
18:56:13.796 [info] Dispose Kernel process 24186.
18:56:13.801 [warn] StdErr from Kernel Process Client disconnected PeerIdentity(b"XXXXXX")
18:56:13.807 [info] Launching Raw Kernel Deno # ~/.local/share/deno/bin/deno
18:56:13.808 [info] Process Execution: ~/.local/share/deno/bin/deno --unstable jupyter --kernel --conn ~/Library/Jupyter/runtime/kernel-v2-XXXXXX.json
    > cwd: ~/repo/polars
18:56:14.018 [info] Restarted XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX
18:56:16.874 [info] Handle Execution of Cells 0 for ~/repo/polars/main.ipynb
18:56:16.875 [info] Kernel acknowledged execution of cell 0 @ 1704794176875
18:56:16.922 [info] End cell 0 execution after 0.047s, completed @ 1704794176922, started @ 1704794176875

Coding Language and Runtime Version

deno 1.39.2 (release, aarch64-apple-darwin), typescript 5.3.3

Language Extension Version (if applicable)

Deno, v3.31.0

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

@scarf005 scarf005 added the bug Issue identified by VS Code Team member as probable bug label Jan 9, 2024
@DonJayamanne DonJayamanne self-assigned this Jan 10, 2024
@DonJayamanne DonJayamanne added notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) output-renderer notebook-output and removed output-renderer labels Jan 10, 2024
@DonJayamanne
Copy link
Contributor

Duplicate of microsoft/vscode-notebook-renderers#189

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) notebook-output
Projects
None yet
Development

No branches or pull requests

2 participants