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

Saving large Jupyter notebooks fails due to the string length restriction of JSON.stringify #227997

Open
DonJayamanne opened this issue Sep 9, 2024 · 2 comments
Assignees
Labels
notebook notebook-ipynb papercut 🩸 A particularly annoying issue impacting someone on the team

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Sep 9, 2024

Given we're serializing a lot of cells, we can easily serialize the cells one by one and then construct the bytes from that, instead of building a string.

I.e. notebook = {cells: [.....], metadata: {...}}

pseudo code:
json = [TextEncoder.encode({), ...notebook.cells.map(cell => TextEncoder.encode(JSON.stringify(cell)))];

Given that we know the indent level, its easy to construct the JSON string in pieces of bytes.

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug notebook notebook-ipynb labels Sep 9, 2024
@DonJayamanne DonJayamanne self-assigned this Sep 9, 2024
@DonJayamanne
Copy link
Contributor Author

@rebornix /cc

@DonJayamanne
Copy link
Contributor Author

This will address the issue, however we need a way to read the JSON as well,
However given that no one seems to be running into this issue (unable to save/load large notebooks), I'm changing this from bug to paper cut for now

@DonJayamanne DonJayamanne added papercut 🩸 A particularly annoying issue impacting someone on the team and removed bug Issue identified by VS Code Team member as probable bug labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notebook notebook-ipynb papercut 🩸 A particularly annoying issue impacting someone on the team
Projects
None yet
Development

No branches or pull requests

1 participant