-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Adds deprecated
function to track deprecations
#3404
Conversation
Hmmm. Tests ran at home... :-) I'll have a look at the build. |
def deprecated(since, message): | ||
current_version = [int(i) for i in VERSION.split('.')] | ||
|
||
assert current_version[0] == since[0], "Deprecated code must be removed before major version change. Current: {0} vs Deprecated Since: {1}".format(current_version[0], since[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.
Shouldn't it be > here ?
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.
Might have been confused by the since
argument. Maybe it should be named target_version
or something similar.
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.
Perhaps deprecated_from_version
— I've no objection to long variable names.
OK. I'll add tests around I can't understand the lint failure. It says run isort, but that's what I've done...
Yet on Travis it fails. Confused... |
Def same version of isort on each? (travis says isort==3.9.6) |
@tomchristie That'll probably be it. I'll tidy this up later now. In general, are we happy with the approach? |
Can't 100% decide if the indirection is a benefit or not, but prob ok. |
Re tests:
... so still confused. (Will work it out.) |
I think the key is that you only have to mark it deprecated once, rather than remember for each update. @xordoquy can probably say best, since he's on the sharp-end
OK. I'll add this. |
Quick check before I get back to this: Once all the boxes are ticked, do we want this? (If not what of #3372? — is "search for |
Closing in favour of #3478 |
Fixes #3372.
Here's a first pass at a
deprecated
function.There was only the one outstanding case, searching for uses of
warnings.warn
, in the pagination code. I've applied the function there.compat.py
? (Other option seems to berest_framework.__init__.py
)