Option for not writing an output ipynb file #669
Merged
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.
What does this PR do?
In the current setup of papermill, an
output_path
is required to write an output ipynb file even if you only want to use the returnedNotebookNode
object. For example, in my case, I end up usingtempfile
a good amount to get around this.This motivation came up in PR #107, as well
Approach
Let user pass
output_path = None
to indicate they don't want to write an output ipynb.A new IO handler was added,
NoIOHandler
to deal with this option.Alternative approach
I tried to match the api interface of PR #107, but I could also see having a specific string that indicates no output writing (similar to
"-"
indicating stdin/stdout).The advantage being that the IO handler can be registered in the IO factory as designed, and not implemented outside of it as I had to do with
path=None
, sinceget_handler
usespath.startswith
.If that sounds like a better approach, I'm open to string suggestions - haven't thought of a good one yet :)