-
Notifications
You must be signed in to change notification settings - Fork 152
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
outputs_hidden vs collapsed metadata #137
Comments
Not sure if you have seen this already, but there was a discussion on this topic when I was implementing storing this state in Jupyterlab: jupyterlab/jupyterlab#3981 (comment). What I implemented only supports |
You actually did implement outputs_hidden too: |
Tangentially related - the source_hidden field specified in the same nbformat PR was implemented in papermill in nteract/papermill#135, but not the outputs_hidden field. |
CC also @MSeal, who was involved in the source_hidden implementation in papermill. |
@rgbkrk mentioned in nteract/papermill#135 (comment) that the plan was for nteract to support outputs_hidden. |
We *set* the `jupyter.outputs_hidden` metadata for completeness, but we only pay attention to the top-level `collapsed` metadata field. We might remove even setting the jupyter.outputs_hidden metadata depending on the resolution of jupyter/nbformat#137
If it helps, jupyter/notebook#534 is a thread that needs to be reignited to add support for the source_hidden and outputs_hidden in classic (I get this requests a lot through papermill to add support to classic UI). I don't have a strong opinion on the fields, beyond that we have a consistent contract set in nbformat and conform the various interfaces to it. I've found |
FYI, because of the apparent conflict between I'm tempted to make it just ignore |
I decided to go ahead and not implement |
Do not set jupyter.outputs_hidden until we can fully support it both in reading and writing. See jupyterlab#5968 (comment) and jupyter/nbformat#137. Basically, it is unclear what to do in case of a conflict between the `collapsed` and `jupyter.outputs_hidden` metadata fields. For backwards compatibility, we clearly need to respect and write to `collapsed`. Since `jupyter.outputs_hidden` is relatively new and unimplemented, let’s wait for clarification on it before supporting it, so we don’t have to change how we support it in the future.
Maybe we should get weigh in from others before finalizing this in a release? I'd prefer we're all consistent and have the opinion hit nbformat close there-after. If there's not consistent feedback today we should probably support one as a fallback name for the other until it's unified in nbformat. I would note that jupyter.outputs_hidden is a much clearer name than collapsed if we're future looking for format adoption. |
Chiming in with my two cents: the description for Similar to @MSeal's perspective, I lean towards standardizing formally on |
@captainsafia, thanks. In the nbformat docs, it explicitly says I don't think we can ignore @MSeal, you suggested one to be a fallback of the other. Which one do you suggest be the primary source of truth? For pragmatic reasons, it makes sense to me for applications to write to both Another thing I realized: though not explicitly defined in the standard, each of these keys pragmatically has a default which is used when there is not a value for the field. These defaults probably ought to be explicitly defined in the standard. (For example, For nbformat 5, I totally agree that we can resolve the confusion and have the elegance of the namespace by dropping |
Yes, my comment was more suggesting a naming opinion for v5 if we want to unify more there for the future. I see what you're saying with conforming to v4 naming, however along those line of thinking code cells already have I like the default value in the spec idea. We should absolutely add that. @rgbkrk is unfortunately on paternity leave, but I believe his input for v5 changes would be best to get before we commit to anything there. |
@jasongrout Oh boy! Looks like the docs and the schema disagree. In the schema, it refers to the entire cell. Assuming the docs are the source of truth, I've submitted #141 to correct this. Agreed on dropping collapsed in nbformat 5. |
@captainsafia - oh, great catch! In cases where there is ambiguity between docs and spec, I think the classic notebook behavior should be the source of truth, since I think that is still how the vast majority of users have interacted with the notebook format (if not currently, then certainly in the past...) |
Yes, technically, since 2017. Though I think this conversation was started partly because we realized that most frontends we know about were actually only implementing nbformat 4.2, so I feel like we have a bit more leeway in how we use the new 4.4 fields than the
That's why I think I want to still write to
Maybe what I'll do is essentially: if (metadata.jupyter.outputs_hidden !== undefined) {
if (metadata.collapsed === undefined) {
metadata.collapsed = metadata.jupyter.outputs_hidden;
}
delete metadata.jupyter.outputs_hidden;
} That way |
Sure. That'll work well enough. We can talk about v5 field support separately. |
Actually, I changed my mind again. jasongrout/jupyterlab@36dfc3e in JupyterLab ensures that |
This makes sure that these redundant pieces of metadata always agree. See jupyter/nbformat#137
This makes sure that these redundant pieces of metadata always agree. See jupyter/nbformat#137
I'm trying to implement the appropriate semantics for
collapsed
/jupyter.outputs_hidden
metadata in JupyterLab.The format docs seem ambiguous to me about the difference between the cell
collapsed
vsjupyter.outputs_hidden
metadata.In the nbformat docs, we have the following descriptions:
collapsed
: Whether the cell’s output container should be collapsedjupyter.outputs_hidden
: Whether the cell’s outputs should be shownIn the discussion introducing
outputs_hidden
(#94), @ellisonbg mentions the confusion, and @rgbkrk and @damianavila mention in the next two comments that they viewcollapsed
as essentially setting a small fixed height for the output, whileoutputs_hidden
is completely hiding the outputs. (To me, the separatescrolled
metadata is about setting a height for the outputs.)How has this played out in practice over the last several years since the
outputs_hidden
field was defined? Classic notebook still only setscollapsed
, and setting it hides the outputs, not just shortening them (scrolled
metadata shortens the output region). As far as I can tell, the classic notebook doesn't recognize thejupyter.outputs_hidden
metadata.Does anyone else respect the
jupyter.outputs_hidden
metadata, or treat it differently from thecollapsed
metadata?CC @rgbkrk, @mpacer, @ellisonbg
The text was updated successfully, but these errors were encountered: