nteract/papermill

How should we pass / control kwargs ?

オープン

#354 opened on 2019/05/05

 (7 件のコメント) (0 件のリアクション) (4 人の担当者)Python (402 件のフォーク)batch import
help wantedidea

Repository metrics

Stars
 (5,381 個のスター)
PR merge metrics
 (PR metrics pending)

説明

In https://github.com/nteract/papermill/pull/351 it was raised that the manner in which we pass kwargs hasn't been well defined. We have several places where we pass everything downstream with **kwargs. But we don't control for duplicate names, especially as we're making API improvements.

Having kwarg passing is very useful from plugins we didn't write to be able to control their execution easily, and I'd prefer we keep a mechanism for passing parameters and data to any registered handler methods to support use cases we haven't thought or which are specific to a particular use case.

Off the top of mind I can think of two simple ways to address the name overlap issue.

  • Make a function wrapper to safely map kwargs, prioritizing function def names over kwargs that overlap
  • Always convert kwargs to safe_kwargs dict we pass without the ** splat pattern

One of us will need to implement the solution we land on, likely before the next release. I assigned maintainers involved in the original discussion for now.

コントリビューターガイド