-
Notifications
You must be signed in to change notification settings - Fork 155
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
Mitosheet default df renderer #1330
base: jupyterlab-4-manually
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
let dataframeVariableName = undefined; | ||
if (activeCellIndex) { | ||
const previousCell = getCellAtIndex(cells, activeCellIndex - 1) | ||
dataframeVariableName = getLastNonEmptyLine(getCellText(previousCell)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test more cases: things like having two dataframes as the output, non dataframes as the output, etc.
Add UI tests for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for:
- Tuple of dataframes
- Series
- plotly graph
Make code gen work. Need to get the correct dataframe name. |
Using Enter to submit column renames does not work until you click somewhere else in the widget. This might just be on Chrome btw. But we need to fix it since Chrome is most popular |
Don't register analysis. |
Don't have email popup |
Question: Each time we add a mitosheet.sheet() call the notebook size grows by about 2MB, but adding Mito as a default dataframe output only increases the size of the saved notebook by 2KB. I think this is because the mime renderer doesn't actually get saved to the notebook (at least right now). But if I were to look at the size of the notebook while being used it would still grow 2MB per mito spreadsheet default dataframe ouput |
Approaches tried using the mime render, documenting for future referenceThe challenging part is figuring out which dataframe to display in the mitosheet. To figure this out, we need to find the code cell that triggered this dataframe render and get the dataframe on its last line. Finding the code cell is challenging however. Below describes a few options we tried and why they don't work.
However, this didn't work for the reasons below. Why using Mime Renderes did not workThere is still a race condition bug where if code cell 1 creates a dataframe renderer, and code cell 2 edits the dataframe, the mitosheet output will show the dataframe state after code cell 2 has run, instead of the state of the dataframe at code cell 1. This occurs because in order to create the mitosheet, we need to execute the mitosheet.sheet() function. To do so, we had to send a new kernel message from the mimerender with the code mitosheet.sheet(df). However, becasue the kernel message queue might have had additional messages already queued that edited the df, by the time the mitosheet was rendered, it might have displayed a dataframe that reflected future code cell edits instead of the current state of the dataframe at the time the code cell with the hanging df was executed. This is not what we want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another review
let codeCell = getCellAtIndex(cells, mimeRenderInputCellIndex + 1) | ||
const codeCellText = getCellText(codeCell); | ||
|
||
if (codeCell === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn this logic into a helper function and share it with the other write generated code
Make sure |
Description
Makes Mito the default dataframe renderer in Jupyter. When a dataframe is hanging at the end of the a code cell, it is automatically displayed in a mitosheet instead of the static, pandas view that only shows a subset of the data.
Testing
Use the Test Notebook.ipynb to try various approaches. Some things to look for:
In addition, see the new frontend tests that ensure this behavior.
Documentation
yes, we need to update the mito docs.