papermill icon indicating copy to clipboard operation
papermill copied to clipboard

Adds input of NotebookNode object directly

Open dcnadler opened this issue 2 years ago • 2 comments

What does this PR do?

User can pass an in-memory nbformat.NotebookNode object to pm.execute_notebook instead of requiring a path.

Related to issue https://github.com/nteract/papermill/issues/444

This adds a NotebookNodeHandler to read the input object.

A bit of refactoring was also needed to move code that expected a string:

  • Stdin/Stdout was pulled out into its own handler
  • The check and warning for .ipynb and .json file extensions by PapermillIO read/write was moved into get_handler (this also made the code more DRY)

Happy to take feedback, thanks!

dcnadler avatar Jun 28 '22 23:06 dcnadler

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Codecov Report

Merging #670 (17be0f5) into main (98013f0) will increase coverage by 0.17%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
+ Coverage   91.72%   91.90%   +0.17%     
==========================================
  Files          17       17              
  Lines        1583     1605      +22     
==========================================
+ Hits         1452     1475      +23     
+ Misses        131      130       -1     
Impacted Files Coverage Δ
papermill/engines.py 98.37% <100.00%> (+0.09%) :arrow_up:
papermill/execute.py 100.00% <100.00%> (ø)
papermill/iorw.py 81.15% <100.00%> (+0.91%) :arrow_up:
papermill/parameterize.py 98.00% <100.00%> (+0.04%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9f02383...17be0f5. Read the comment docs.

codecov[bot] avatar Jun 28 '22 23:06 codecov[bot]