-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Cell metadata and persistent cell deactivation #1895
Conversation
Try this Pull Request!Open Julia and type: julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/lungben/Pluto.jl", rev="metadata")
julia> using Pluto |
Co-authored-by: Rik Huijzer <[email protected]>
frontend tests will give ✅ again if you update from |
EDIT: I am wondering the same as Rik in this comment: #1895 (comment) We should store directly-disabled status in the file, but do we need to store the indirectly-disabled status in the file? We already remove the Pluto-created comment when reading the notebook file, without checking whether it was (indirectly) disabled (👍), so it's not necessary to read the file correctly, right? Why I think this is important: if we don't store indirectly-disabled status in the file, then:
Here is my original comment about reducing double state Right now, I think it's a really good idea to have the metadata system be part of the implementation of #1205, but we should really go for it! Instead of using |
I removed the explicit |
Minor comment: now the indirectly disabled cells comment blocks do not have any explicit explanation, I tried to play with this, with some file editing (removing comments, adding or removing disable lines), |
Thanks for testing out the file editing @ederag ! |
In which respect is this better than #421 (I don't mind at all to have my idea dismissed, but modifiying the notebook format ist something which really needs to be considered carefully, so I just remind it). |
This PR essentially implements #421 on cell level, i.e. the metadata for each Pluto cell is its own TOML "file" (written as comment before the cell in the notebook.jl file). Suggested in #421, but not implemented here are:
|
Ok I understand - probably this is the way to go in the moment. For 2: I can imagine that quite lot of stuff can become part of cell metadata, so a newer "rich metadata notebook" at certain point will not make much sense for an old pluto version. I guess the reading code for the current notebook format will stay forever, and so can the writing code, which could be invoked when opening a notebook in "legacy format." if an author wants the ability to run a notebook under old pluto versions. We had a bit of a similar situation for the Manifest.toml... |
I think this is a really good middle ground! We get the future-proofness of using TOML for metadata (thanks for the suggestion!), which means that we won't have to struggle in the future on how to add new metadata items into the file format, but without a breaking change to the notebook format. The comparison with the Manifest.toml change is a good one! I think they handled it well by adding future-proof compatibility code in 1.6, and backwards-proof compat code in 1.7 and later. But! I think we might be able to avoid a breaking file format change, because we have more flexibility than the original Manifest.toml did (which was the reason for the new format): for example, we can put anything next to the |
Just called with @pankgeorg , he will make some final changes to also generalize the default value to future metadata, which currently needs this special code: Should be ready and merged before the next community call! |
Is it okay if I remove the frontend changes (and remove disabled_cell as it was before), feel like it would make the PR a lot cleaner 😁 |
The frontend changes currently do 2 things:
While 1. is not required to store the cell disabling status, it is the basis for any future enhancements in the frontend using the new metadata system. Therefor I suggest to keep it in this PR. |
I want to keep 1. for sure! Just would like to also expose |
Some motivations for 2. in #1895 (comment). Basically, if there is an API to get/set metadata from Julia/JS then there is going to be less logic if everything already refers to the metadata. Maybe we can namespace (under metadata.pluto.disabled) the disabled property in the metadata? As a follow up it would be great to persists logs hiding for example. |
I only wanted to keep the frontend changes to a minimum (because they span a lot of different files), but if you are confident it works now, then having it migrated now is very nice :) |
@dralletje Although the file format was the main focus of #1895 (comment), the user interface seemed fine as well |
Michiel's concern is real, pretty much this comment: https://github.com/fonsp/Pluto.jl/pull/1895/files#diff-6f965d00041ae73bc1bc31832951173264ef6f72375983989b13d99069f5aaf6R66 A quick word for my (very small!) updates:
-> On the front-end I fixed the possible invalidation issue and adjusted the code to expect the metadata.default to exist and be false (and then true) finally, we fix a small saving issue: I noticed that a cell needed to run after deactivating something, to get the right stuff saved. That was because we saved very early; we need to save after the last field that gets serialized changes. Before that was @lungben this is amazing work! |
Thanks! |
ToDo: