-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Improve Parameter signatures #742
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! What's draft about it?
Draft as it only updated the static signature of only one Parameter type. I wanted to get some feedback on the approach, which I've got now so I can keep going! I'll also attempt to write some tests. |
OK I finally understand what's going on. These are the default Python warning filters:
In the REPL or in a notebook Interestingly, it means that when you set the Param can be quite heavily used in a notebook and what we're deprecating in this PR (and others) are APIs that are used directly by Param users. As such |
Given there was already a positive review, I'm going to merge and we can iterate later if there's a need for it. |
Fixes #736
This is for now just a POC, I'd like to get the opinion of others before proceeding any further. Reminder, the signatures have changed with the Sentinel PR, now all the default values are
Undefined
. So this PR attempts to fix that:static code analysis (e.g. in VSCode): by using
typing.overload
on a stub__init__
method, see https://github.com/holoviz/param/commit/b9e0ce0476099e88778fee4e6ec4b12f7f79e3d2.- In this example I have not put**kwargs
in the signature, contrary to the original signature. Instead I have added all the keywords defined inParameter.__init__
. I believe that's a nicer UX. That's unfortunately not DRY, but I don't think it's possible to dynamically add the keywords to the overloaded signature, it all has to be static.dynamic code analysis (e.g. in Jupyter Lab): by updating
__signature__
. Hmm I just realize thatparam.Parameter
does not have it signature updated, I'll fix that.