-
-
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
Notebook metadata #2016
Merged
Merged
Notebook metadata #2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Try this Pull Request!Open Julia and type: julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="cb/notebook-metadata")
julia> using Pluto |
This comment was marked as resolved.
This comment was marked as resolved.
I'm a bit worried about the limitations of TOML, specifically mixing Dicts and other types in a vector: julia> TOML.print(Dict("hello" => [Dict("a" => "b"), "c"]))
[[hello]]
a = "b"
[[hello]]
ERROR: array should contain only tables
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] _print(f::Nothing, io::Base.TTY, a::Dict{String, Vector{Any}}, ks::Vector{String}; indent::Int64, first_block::Bool, sorted::Bool, by::Function)
@ TOML.Internals.Printer /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/stdlib/v1.7/TOML/src/print.jl:160
[3] #print#13
@ /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/stdlib/v1.7/TOML/src/print.jl:168 [inlined]
[4] print(a::Dict{String, Vector{Any}}; sorted::Bool, by::Function)
@ TOML.Internals.Printer /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/stdlib/v1.7/TOML/src/print.jl:171
[5] print(a::Dict{String, Vector{Any}})
@ TOML.Internals.Printer /Applications/Julia-1.7 x86.app/Contents/Resources/julia/share/julia/stdlib/v1.7/TOML/src/print.jl:171
[6] top-level scope
@ REPL[9]:1 which can even lead to a TOML.jl bug creating an invalid file: JuliaLang/julia#45340 EDIT: well we already made this choice for cell metadata, so let's just be consistent... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a field
metadata
to Pluto'snotebook
structure. Nothing too special, but a few details are worth mentioning:TODO
Read-only testing to pin formatnot necessaryPrefix Ideas
This is arguably the least important part of this PR, but currently the metadata is saved in the following format:
This format works just fine, but Pluto's cell prefix format sets a precedent for wild and unique prefixes. If anyone has ideas that would make it implicitly clear that the lines marked with this prefix are notebook-level metadata statements, let me know.
A box around properties could be neat (but maybe overkill or distracting and maybe make editing properties from the file mildly annoying)