nteract/papermill

How should we pass / control kwargs ?

開放

#354 建立於 2019年5月5日

 (7 則留言) (0 個反應) (4 位負責人)Python (402 個分叉)batch import
help wantedidea

倉庫指標

星標
 (5,381 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南