-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix global eval: false
#174
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Cell Options | ||
engine: julia | ||
execute: | ||
eval: false | ||
--- | ||
|
||
```{julia} | ||
println("shouldn't run") | ||
``` | ||
|
||
```{julia} | ||
#| eval: false | ||
println("shouldn't run either") | ||
``` | ||
|
||
```{julia} | ||
#| eval: true | ||
println("should run") | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
include("../utilities/prelude.jl") | ||
|
||
test_example(joinpath(@__DIR__, "../examples/evalfalse.qmd")) do json | ||
cells = json["cells"] | ||
@test length(cells) == 7 | ||
@test isempty(cells[2]["outputs"]) | ||
@test isempty(cells[4]["outputs"]) | ||
@test !isempty(cells[6]["outputs"]) | ||
@test occursin("should run", cells[6]["outputs"][1]["text"]) | ||
end |
Oops, something went wrong.
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.
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.
Does the logic really need an
Unset
rather than just inheriting the global setting as the cell default? Or is there some more subtle logic going on here that I'm not seeing?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.
I could have tried to route the options through the functions that extract the cell options but that would have been a larger change because those are currently independent. And I didn't take the usual
nothing
because that's a value that you can also set in YAML, and I wanted to error for invalid values instead I think, so I chose to make a new value that's outside of the YAML set.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.
How much larger? Larger changes aren't always the wrong thing to do. If logically these options aren't independent then adjusting the code so that there is dependence between them makes sense to me.
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.
Cell parsing can be independent from global settings. If you do the extra work to route the global options into parsing that saves you only from having to use this one placeholder value for "nothing was specified here". A cell with
eval: true
should be evaluated in aeval: false
global regime, but the default is also impliciteval: true
. So one needs to disambiguate implicit and explicit true. I do that with this placeholder. We could also decide that the implicittrue
is actuallyeval: null
or whatever that is in YAML (eval = nothing
on the Julia side). Right now, I think it would error if the user wrote that. But we could make it so that just means whatever the global default is. Then we don't needUnset
. That would be fine with me as well.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.
Just stick with what's here then for now.