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

WIP - Filter empty cells #405

Closed

Conversation

martinRenou
Copy link
Member

No description provided.

This was referenced Oct 8, 2019
@vidartf
Copy link
Contributor

vidartf commented Oct 8, 2019

As long as the filter does not remove any cell cells where the output is populated later (I'm not sure what cell.outputs is in that case), this is OK as well.

@martinRenou martinRenou changed the title Filter empty cells WIP - Filter empty cells Oct 8, 2019
@maartenbreddels
Copy link
Member

My preference goes to solving this in the template, and for instance not do this in the debug template.

@martinRenou
Copy link
Member Author

Well, we actually still do that in the template. The only difference is that we don't add empty cells in the page, instead of only making them invisible.

@vidartf
Copy link
Contributor

vidartf commented Oct 10, 2019

A way to get an empty output (but I guess this makes the cell be not empty, so this should still be ok):

display({}, raw=True, display_id=True)

@martinRenou
Copy link
Member Author

But:

handle = display({}, raw=True, display_id=True)
handle.update({'text/html': 'test'})

does not seem to show anything (in classic Notebook)

@vidartf
Copy link
Contributor

vidartf commented Oct 10, 2019

It works in lab though.

@vidartf
Copy link
Contributor

vidartf commented Oct 10, 2019

Xref ipython/ipython#11907

@martinRenou
Copy link
Member Author

martinRenou commented Oct 10, 2019

It works in lab though.

And actually it works in Voila as well. Both using master and this branch. The output appears empty but it's not.

'outputs': [{'output_type': 'display_data', 'metadata': {}, 'data': {}}]

@vidartf
Copy link
Contributor

vidartf commented Oct 11, 2019

Yes, but the question is then: Does #391 work?

@martinRenou
Copy link
Member Author

Yes, for the same reason. cell.outputs is not None in the template, so we don't hide it in CSS

@maartenbreddels
Copy link
Member

As discussed, cells should always be returned, since voila has the option to show the source code. Also, filtering out cells is impossible, since we don't know a priori if a cell will not contain output, and to make the progress indicator work, we need to return as many cells as there are in the notebook.

I think that only leaves the option open for a template to have custom behavior for empty output cells, e.g. only have an if statement in the template:

{% if 'outputs' in cell and cell.outputs %>

@martinRenou
Copy link
Member Author

Closing in favor of #391

@martinRenou martinRenou deleted the filter_empty_cells2 branch October 17, 2019 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants