-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Deprecators #4464
Deprecators #4464
Conversation
Hello @hmaarrfk! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-03-02 00:33:34 UTC |
This is a pretty cool thing for long-term maintenance 👍. |
Very cool stuff. What about #4158 then? Close, postpone.... |
bc5bcc3
to
0421860
Compare
A small complaining on the tests, @hmaarrfk:
Could you check it, please? :) |
So if people are in favor of this, I suggest we either: A. Version wabisabi (well what we need from it) and start doing this kind of deprecation 1 file at a time, taking care of internal warnings at every step of the way. This is a "one time necessary change" with the change acting as a no-op if the version specified has passed. |
I'm +1 here, but I have two questions to help others decide @hmaarrfk:
How difficult (and heavy) would that be?
How heavy would that be? |
The only dependency is numpydoc for documentation mangling. That said, it is optional, and for many people it will be installed automatically when they install Spyder. Versioning it would require copying in 3 files or so, maybe more for tests, but the license is already included in the files, and I can give my blessing to provide full copyright to scikit image if it helps. |
Even if the decorators acts punctually, I don't think that it is a good idea to keep ghost/useless lines in the code base... Even if it doesn't hurt to keep these lines, it would be a good idea to plan some cleanings at release time... |
Yes of course, but I don't think it can be considered "technical Dept" just an annoyance in the codebase that would require minimal review to be pushed through |
@@ -0,0 +1,2 @@ | |||
# Avoid circular imports |
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.
😢 We really need to dive in skimage
import strategy to fix it...
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.
Thank you @hmaarrfk really cool ;-)
Edit
What if we move deprecate_kwarg
from skimage._shared.utils
to wabisabi
?
What if we replace skimage._shared.utils.deprecate_kwarg
by wabisabi.kwarg_name_change
? 😄
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.
@hmaarrfk I've suggested a very small change. What's the status with wabisabi? Are you ok making breaking changes there? Overall, I absolutely love the functionality and am now convinced to depend on it.
Having said this, this could not be used nicely for e.g. changes in rescale behaviour. (As far as I can see?) ie you'd need to introduce preserve_range
s everywhere and then remove them eventually, which is double the pain of just changing it at 1.0...
But, in general, I really like this functionality and can see myself using it both in 0.x and in the 1.0->2.0 transition.
|
||
|
||
def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10, | ||
@kwonly_change('1.0') |
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.
Ironically, I think this should be a keyword-only argument. 😂
@kwonly_change('1.0') | |
@kwonly_change(until_version='1.0') |
def iradon(radon_image, theta=None, output_size=None, | ||
@kwonly_change('1.0', previous_arg_order=['radon_image', 'theta', | ||
'output_size', 'filter_name', | ||
'interpolation', 'circle']) |
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.
Whoa. This is a super-cool feature.
Rescale behavior is a little tougher. We can try to write a spec for itto see how the input output response would look like. I would rather not make breaking changes there, but I don't think I use the kwonly deprecator in my production code so maybe it is ok to break? You can suggest a PR there if you like |
Aw. But it would be so delightfully meta to use wabisabi on wabisabi itself! 😂 Anyway, I'll have a look. My main proposals right now are:
The function definition itself can be simplified by using |
do you really want to depend on toolz?
do you want all the functions to start with |
Yep, pretty lightweight, pure python, and extremely stable. Dask depends on it so it's not even like it's unmaintained.
Maybe? I like my code to read as close to English as possible. And it's equivalent to having them all end with |
A Is there additional functionality here that we still want to consider or can this PR be closed? |
No. I don't think so. I was following your progress and it seems you added the important features. |
Description
@jni, @alexdesiqueira this is the demo that I was talking about regarding how the decorator can be used to basically make the change "once".
In version 1.0, you are left with "zombie" decorators that would basically do nothing.
https://github.com/hmaarrfk/wabisabi/blob/master/wabisabi/kwonly_change.py#L89
I forced push to my old PR, now i can't reopen it.
#3346
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