Skip to content
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

deprecated() function refers to past changes as if they were upcoming. #10223

Closed
1 task done
maresb opened this issue Jul 27, 2021 · 3 comments
Closed
1 task done

deprecated() function refers to past changes as if they were upcoming. #10223

maresb opened this issue Jul 27, 2021 · 3 comments
Labels
state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature

Comments

@maresb
Copy link
Contributor

maresb commented Jul 27, 2021

Description

If I run the following:

from pip._internal.utils.deprecation import deprecated

deprecated("Some reason.", "the_replacement", "10")

then I get

pip._internal.utils.deprecation.PipDeprecationWarning: DEPRECATION: Some reason. pip 10
will remove support for this functionality. A possible replacement is the_replacement.

even though the version is 21.1.3 (>10).

Expected behavior

I expect a message which uses the correct verb tense such as

pip._internal.utils.deprecation.PipDeprecationWarning: DEPRECATION: Some reason. This
behavior change has been enforced since pip 10. A possible replacement is the_replacement.

pip version

21.3

Python version

3.9.6

OS

Ubuntu 21.04

How to Reproduce

See above.

Output

No response

Code of Conduct

@maresb maresb added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 27, 2021
@uranusjr
Copy link
Member

The deprecation warning is only intended to be used for gone_in to be later than the current version. If you call it like this, the function call would crash (which you either ignored or decided to not mention for whatever reason). I think the function as it stands if fine, although I wonuldn’t object if you submit a patch to conditionally use future tense when Version(gone_in) <= Version(pip.__version__).

@uranusjr uranusjr added state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature and removed S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 28, 2021
@maresb
Copy link
Contributor Author

maresb commented Jul 28, 2021

@uranusjr, ah, okay, thanks for clarifying!

It did indeed "raise" the warning as an exception, apologies for not mentioning that detail.

I was assuming that after old functionality is deleted, the deprecation could remain in the code for some time as a helpful error message. (As a user in need of a quick fix, it would be very useful to know before which version I need to revert.)

Apologies if it seems that I ignored your suggestion not to implement. I already implemented the fix for this a week ago for #10167, but I could only test it today. I'm glad that you don't find it objectionable.

@maresb
Copy link
Contributor Author

maresb commented Jul 29, 2021

Closed by #10167

@maresb maresb closed this as completed Jul 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants