Skip to content
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: Don't pass input_path to PapermillNotebookClient.__init__ #740

Merged
merged 3 commits into from Nov 16, 2023

Conversation

kdestin
Copy link
Contributor

@kdestin kdestin commented Nov 14, 2023

What does this PR do?

This pull request is a minor fix that prevents NBClientEngine from sending the input_path parameter to PapermillNotebookClient, which appears to not actually accept a parameter of that name.

Background

This change resolves a deprecation warning raised by traitlets when a trait provides an unrecognized argument to super().__init__:

  /home/user/path/to/venv/lib/python3.9/site-packages/traitlets/traitlets.py:1387: DeprecationWarning: Passing unrecognized arguments to super(PapermillNotebookClient).__init__(input_path='/path/to/notebook.ipynb').
  object.__init__() takes exactly one argument (the instance to initialize)
  This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
    warn(

The warning appears to be caused by papermill_engines.execute_notebook_with_engine

nb = papermill_engines.execute_notebook_with_engine(
engine_name,
nb,
input_path=input_path,
output_path=output_path if request_save_on_cell_execute else None,
kernel_name=kernel_name,
progress_bar=progress_bar,
log_output=log_output,
start_timeout=start_timeout,
stdout_file=stdout_file,
stderr_file=stderr_file,
**engine_kwargs
)

which forwards an input_path parameter to NBClientEngine.execute_managed_notebook, which is then supplied to PapermillNotebookClient.__init__. Neither PapermillNotebookClient nor its super classes appear to accept an input_path parameter, so the remedy appeared to be to remove it from the provided kwargs. 

Motivation

Running papermill in a pytest test without pytest reporting the surfaced warnings.


Please let me know if this actually needs test coverage to ensure that a deprecationwarning isn't being raised.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@MSeal MSeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. That warning was annoying to see. No need for a test for this, though pro-tip for future PRs, keep the linting changes across the repo and the actual code change as separate PRs. It makes it difficult to review, revert, and almost immediately causes conflicts that couple cleanup code with implementation code inseparably.

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Merging #740 (73a2138) into main (15ea2cb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #740   +/-   ##
=======================================
  Coverage   91.48%   91.49%           
=======================================
  Files          17       17           
  Lines        1621     1622    +1     
=======================================
+ Hits         1483     1484    +1     
  Misses        138      138           

@MSeal MSeal enabled auto-merge (squash) November 16, 2023 00:16
@MSeal MSeal disabled auto-merge November 16, 2023 15:58
@MSeal MSeal merged commit 7f25147 into nteract:main Nov 16, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants