-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Implement deepnote big number chart support and renderer #41
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
Merged
jamesbhobbs
merged 58 commits into
main
from
tomaskislan/grn-4762-support-big-number-blocks
Oct 23, 2025
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
a422532
feat: Set up a custom renderer for data frames.
Artmann 3f9c6af
wip
Artmann e334698
feat: Implement deepnote big number chart support and renderer
tkislan 87f4a09
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan 62297c2
refactor: Clean up debug logs and improve big number block conversion…
tkislan 7878345
feat: Pass block metadata to cell outputs for renderer to access
tkislan a12d042
feat: Set up a custom renderer for data frames.
Artmann c19acd4
wip
Artmann 066229a
add the table state.
Artmann e36b9c0
page size handling
Artmann 558035f
add page navigation
Artmann 5113db6
Generate Python code before executing the cell.
Artmann 1ba9ab4
clean up
Artmann a51a150
pr feedback.
Artmann 98d7fe6
Update build/esbuild/build.ts
Artmann a476bfd
feat: Move DEEPNOTE_VSCODE_RAW_CONTENT_KEY into constants file
tkislan 3a4d579
feedback
Artmann 40ede24
feat: Add chart big number converter tests
tkislan d220422
Reformat test code
tkislan 78d3cb7
Refactor ChartBigNumberBlockConverter tests to use deepStrictEqual fo…
tkislan 4fa78e2
docs and metadata changes.
Artmann e8ce411
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan 8ae05ab
use the latest blocks package.
Artmann 3597ce3
Merge branch 'main' into chris/display-data-frames
Artmann 9fec8d4
add the packages permission
Artmann 0537364
simplify execution flow.
Artmann 9b9216a
remove copyright header
Artmann e5a1bba
clean up the code
Artmann e7cccb9
Merge branch 'main' into chris/display-data-frames
Artmann 895fe09
revert controller changes
Artmann 54ca963
pr feedback
Artmann 8309267
Merge branch 'main' into chris/display-data-frames
Artmann df330bc
pr feedback
Artmann 8b88881
fix the tests
Artmann 8386006
guard metadata spread against undefined.
Artmann 8121bfa
Merge remote-tracking branch 'origin/chris/display-data-frames' into …
tkislan 3bdf030
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan d9afa1a
fix: Merge cleanup
tkislan e2b6c36
More merge cleanup
tkislan 722ab50
Fix test
tkislan 628ab6e
feat: Add big number chart json config execution support
tkislan ed5329d
fix: Enhance error handling for big number metadata parsing and impro…
tkislan 6649ca8
refactor: Simplify chart big number renderer by directly rendering to…
tkislan a3007ac
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan b25656b
Fix import
tkislan 8014bc3
fix: Change deepnote_big_number_comparison_type to string type for be…
tkislan 85c8b70
fix: Remove constants, accidentaly added to wrong branch
tkislan 68567e0
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
tkislan 067f757
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan cc3f23c
Fix imports
tkislan 6ee3612
fix: Remove unused code
tkislan 95fd687
feat(big-number): Integrate react-error-boundary for error handling a…
tkislan 05ab7a0
Update test snapshots
tkislan 5f05be1
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
jamesbhobbs 8d83d0c
fix: Fix spell check in test
tkislan 60442ec
Merge remote-tracking branch 'origin/main' into tomaskislan/grn-4762-…
tkislan 236cccd
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
tkislan f8dcd85
Merge branch 'main' into tomaskislan/grn-4762-support-big-number-blocks
jamesbhobbs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import { | |
| window, | ||
| extensions | ||
| } from 'vscode'; | ||
| import { coerce, SemVer } from 'semver'; | ||
|
|
||
| import type { Kernel } from '@jupyterlab/services'; | ||
| import { CellExecutionCreator } from './cellExecutionCreator'; | ||
|
|
@@ -45,7 +46,7 @@ import { handleTensorBoardDisplayDataOutput } from './executionHelpers'; | |
| import { Identifiers, RendererExtension, WIDGET_MIMETYPE } from '../../platform/common/constants'; | ||
| import { CellOutputDisplayIdTracker } from './cellDisplayIdTracker'; | ||
| import { createDeferred } from '../../platform/common/utils/async'; | ||
| import { coerce, SemVer } from 'semver'; | ||
| import { CHART_BIG_NUMBER_MIME_TYPE } from '../../platform/deepnote/deepnoteConstants'; | ||
|
|
||
| // Helper interface for the set_next_input execute reply payload | ||
| interface ISetNextInputPayload { | ||
|
|
@@ -1181,6 +1182,15 @@ export class CellExecutionMessageHandler implements IDisposable { | |
| const output = translateCellDisplayOutput( | ||
| new NotebookCellOutput(outputToBeUpdated.outputItems, outputToBeUpdated.outputContainer.metadata) | ||
| ); | ||
|
|
||
| const data = msg.content.data; | ||
| // deepnote-toolkit returns the text/plain mime type for big number outputs | ||
| // and for the custom renderer to be used, we need to return the application/vnd.deepnote.chart.big-number+json mime type | ||
| if (outputToBeUpdated.cell.metadata['__deepnotePocket']?.['type'] === 'big-number') { | ||
| data[CHART_BIG_NUMBER_MIME_TYPE] = data['text/plain']; | ||
| delete data['text/plain']; | ||
| } | ||
|
Comment on lines
+1189
to
+1192
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add comment why we need this |
||
|
|
||
| const newOutput = cellOutputToVSCCellOutput( | ||
| { | ||
| ...output, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/notebooks/deepnote/converters/chartBigNumberBlockConverter.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { NotebookCellData, NotebookCellKind } from 'vscode'; | ||
| import { z } from 'zod'; | ||
|
|
||
| import type { BlockConverter } from './blockConverter'; | ||
| import type { DeepnoteBlock } from '../../../platform/deepnote/deepnoteTypes'; | ||
| import { DeepnoteBigNumberMetadataSchema } from '../deepnoteSchemas'; | ||
| import { parseJsonWithFallback } from '../dataConversionUtils'; | ||
| import { DEEPNOTE_VSCODE_RAW_CONTENT_KEY } from './constants'; | ||
|
|
||
| const DEFAULT_BIG_NUMBER_CONFIG = DeepnoteBigNumberMetadataSchema.parse({}); | ||
|
|
||
| export class ChartBigNumberBlockConverter implements BlockConverter { | ||
| applyChangesToBlock(block: DeepnoteBlock, cell: NotebookCellData): void { | ||
| block.content = ''; | ||
|
|
||
| const config = DeepnoteBigNumberMetadataSchema.safeParse(parseJsonWithFallback(cell.value)); | ||
|
|
||
| if (config.success !== true) { | ||
| block.metadata = { | ||
| ...block.metadata, | ||
| [DEEPNOTE_VSCODE_RAW_CONTENT_KEY]: cell.value | ||
| }; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| if (block.metadata != null) { | ||
| delete block.metadata[DEEPNOTE_VSCODE_RAW_CONTENT_KEY]; | ||
| } | ||
|
|
||
| block.metadata = { | ||
| ...(block.metadata ?? {}), | ||
| ...config.data | ||
| }; | ||
| } | ||
|
|
||
| canConvert(blockType: string): boolean { | ||
| return blockType.toLowerCase() === 'big-number'; | ||
| } | ||
|
|
||
| convertToCell(block: DeepnoteBlock): NotebookCellData { | ||
| const deepnoteJupyterRawContentResult = z.string().safeParse(block.metadata?.[DEEPNOTE_VSCODE_RAW_CONTENT_KEY]); | ||
| const deepnoteBigNumberMetadataResult = DeepnoteBigNumberMetadataSchema.safeParse(block.metadata); | ||
|
|
||
| if (deepnoteBigNumberMetadataResult.error != null) { | ||
| console.error('Error parsing deepnote big number metadata:', deepnoteBigNumberMetadataResult.error); | ||
| console.debug('Metadata:', JSON.stringify(block.metadata)); | ||
| } | ||
|
|
||
| const configStr = deepnoteJupyterRawContentResult.success | ||
| ? deepnoteJupyterRawContentResult.data | ||
| : deepnoteBigNumberMetadataResult.success | ||
| ? JSON.stringify(deepnoteBigNumberMetadataResult.data, null, 2) | ||
| : JSON.stringify(DEFAULT_BIG_NUMBER_CONFIG, null, 2); | ||
|
|
||
| const cell = new NotebookCellData(NotebookCellKind.Code, configStr, 'json'); | ||
|
|
||
| return cell; | ||
| } | ||
|
|
||
| getSupportedTypes(): string[] { | ||
| return ['big-number']; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.