Repository navigation
Deprecate filter argument in iradon due to clash with python keyword - #4158
Conversation
hmaarrfk
left a comment
There was a problem hiding this comment.
This is a decent approach for simple deprecations such as this one. I would like to see the addition of warnings being issued, as well as more information being displayed in the docstring, two things that are easy for developers to see and do without a decorator. Not to mention, a test would go a long way.
I've done alot of this stuff in
https://github.com/hmaarrfk/wabisabi
|
You don't need to pass all tests from wabisabi. Generally, Ive Found that the tests help me find bugs in my own code that might be difficult to spot. You should also consider what you want you to happen when the user specifies the argument with both names |
|
I am not sure that we should consider the case where the user specifies the argument with both names: the deprecation mechanism is made to manage old users code. Using both arguments name is a user bug not an |
…into Deprecate_filter_argument_in_iradon
lagru
left a comment
There was a problem hiding this comment.
This is interesting. Although I wonder if the decorator interferes with the displayed signature for tools such as help(), sphinx or IPythons "?". If not, maybe it's not worth it to use a fancy decorator to save a few explicit and simple lines of code...
Co-Authored-By: Lars Grueter <[email protected]>
|
Thank you @lagru for your review and comments. The functools.warps decorator is the generic tool to manage the docstring and function name and signature stuff. So there is no impact on that side with this decorator, but I can add a test for that ;-) |
Just tested locally. At least |
|
@lagru , I already implemented the test, it doesn't hurt ;-) |
|
@rfezzani if you are going to get into docstring mangling, then maybe it becomes worthwhile to take the code (tests or implementation) from: https://github.com/hmaarrfk/wabisabi shameless plug again, but it was developed for these usecases. Ultimately, I decided it wasn't worth imposing the custom decorator on others. But you are soon approaching some of the other features of the wabisabi decorator. |
|
@hmaarrfk, I am not planning to go into docstring mangling, unless you think it is a good idea... |
…into Deprecate_filter_argument_in_iradon
…into Deprecate_filter_argument_in_iradon
|
Hi everyone, do you think that this PR still needs more work or is it fine? |
…into Deprecate_filter_argument_in_iradon
|
No problem @jni, I am just searching some more issues to work on ;-) |
Oh, that we can provide in spades! 😂 Did you see my post on the mailing list about n-dimensional edge filters, for example? =) |
|
Yes, I saw it, very cool! But I also saw on your message that you will submit a PR soon on that 😄 |
…into Deprecate_filter_argument_in_iradon
|
I think the only thing missing from this is a |
|
I added it @hmaarrfk ;-) |
|
whoa, so many failures. |
lagru
left a comment
There was a problem hiding this comment.
@rfezzani Looks good! Sorry for holding this up a little further but could you add a note to the Version 0.19 section in TODO.txt about this deprecation? I tried doing this myself but got in trouble with git somewhere along the way. 😅
Otherwise this is ready to merge.
|
@rfezzani Thanks! |
Description
This PR is about deprecating the reserved Python keyword
filterused as argument foriradonfunction. It is related to the issue #4152.filteris replaced byfilter_namein the definition and documentation ofiradonand the decoratordeprecate_argis defined inskimage._shared.utilsand used to raise aDeprecationWarningif the old argument is explicitly used by the user and replace it by the new argument name.Checklist
./doc/examples(new features only)./benchmarks, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py.doc/release/release_dev.rst.@meeseeksdev backport to v0.14.x