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

Warn on Python 2.7 #6147

Merged
merged 3 commits into from
Jan 20, 2019
Merged

Warn on Python 2.7 #6147

merged 3 commits into from
Jan 20, 2019

Conversation

dstufft
Copy link
Member

@dstufft dstufft commented Jan 19, 2019

Ref: #6148

@pfmoore
Copy link
Member

pfmoore commented Jan 19, 2019

LGTM. Needs some test fixes to cater for the stderr output, though 😉

@dstufft
Copy link
Member Author

dstufft commented Jan 19, 2019

Yea, think I've got that sorted now.

@dstufft dstufft added this to the 19.0 milestone Jan 19, 2019
@cjerdonek cjerdonek added the type: deprecation Related to deprecation / removal. label Jan 20, 2019
@pradyunsg pradyunsg requested review from pfmoore and removed request for pfmoore January 20, 2019 02:43
@pradyunsg pradyunsg requested review from pfmoore and removed request for pfmoore January 20, 2019 02:47
@pradyunsg
Copy link
Member

pradyunsg commented Jan 20, 2019

I'll defer to @pfmoore to merge this in, if he has the time to take a look and confirm he's okay with the language of the message. :)

@dstufft
Copy link
Member Author

dstufft commented Jan 20, 2019

Gonna go ahead and merge this in now since @pfmoore already OK'd the message earlier and I haven't changed the messaging at all besides a grammar fix.

@dstufft dstufft merged commit 5074327 into pypa:master Jan 20, 2019
@dstufft dstufft deleted the warn-on-27 branch January 20, 2019 02:53
@ncoghlan
Copy link
Member

Well worded :)

@pfmoore
Copy link
Member

pfmoore commented Jan 20, 2019

Yep, it's fine with me. Sorry, I just left a "LGTM" comment than a formal approval - I should have done the latter.

@orutherfurd
Copy link
Contributor

Maybe a silly question, but is there an easy way to disable this, other than downgrading pip? I've got cron jobs running that now tell me to upgrade python, which is much more frustrating than it is helpful.

@dstufft
Copy link
Member Author

dstufft commented Jan 23, 2019

It uses the Python warnings module, so you can configure it with that, e.g.:

$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package    Version
---------- -------
pip        19.0.1
setuptools 40.6.3
wheel      0.32.3

$ PYTHONWARNINGS=ignore:::pip._internal.cli.base_command pip list
Package    Version
---------- -------
pip        19.0.1
setuptools 40.6.3
wheel      0.32.3

That'll hide any warning generated by the base command module. I'm not entirely opposed to some general way to acknowledge specific deprecation warnings and silence them, if that sounds useful then I'd encourage you to open a ticket.

@pradyunsg
Copy link
Member

I'm not entirely opposed to some general way to acknowledge specific deprecation warnings and silence them, if that sounds useful then I'd encourage you to open a ticket.

There's #6119, which can cover this use case as well.

@ncoghlan
Copy link
Member

ncoghlan commented Jan 27, 2019

PYTHONWARNINGS="ignore:DEPRECATION::pip._internal.cli.base_command" should ignore the upgrade warnings specifically.

Edit: The regex syntax I originally had in the message filter only works when defining filters through the Python API, not from the environment. Checks are also only made against the start of the message, not the whole thing. Accordingly, updated to search for the DEPRECATION prefix as recommended by @kylegibson below.

@orutherfurd
Copy link
Contributor

orutherfurd commented Jan 28, 2019 via email

@jlevitt

This comment has been minimized.

@xavfernandez

This comment has been minimized.

rajadain added a commit to WikiWatershed/model-my-watershed that referenced this pull request Jan 29, 2019
As of pip 19.0, it started printing warnings for Python 2.7, which
are treated as errors by Jenkins. I looked briefly in to ignoring
or silencing those warnings (see pypa/pip#6147 (comment)),
but couldn't configure Jenkins correctly. Thus, I'm going with the
downgrade, as was done for #bees in project-icp/bee-pollinator-app#447.
rajadain added a commit to WikiWatershed/model-my-watershed that referenced this pull request Jan 29, 2019
As of pip 19, it prints warnings about Python 2.7 (see pypa/pip#6147)
which register as errors in Jenkins, causing builds to fail. We
suppress the warnings by declaring this environment variable.
@felker
Copy link

felker commented Feb 12, 2019

The environment variable that @ncoghlan recommended did not suppress the warning for me. Is there another way to silence this? I run pip to get Zsh completions on every interactive shell startup, so they are quite bothersome.

pip 19.0.2 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)

@hugovk
Copy link
Contributor

hugovk commented Feb 13, 2019

@felker Try double quiet:

 pip -qq install something

(From #6207 (comment))

@felker
Copy link

felker commented Feb 13, 2019

@hugovk thanks, I will use this for now. But doesn't it silence all warnings? Weird that the environment variable didn't work for me...

@hugovk
Copy link
Contributor

hugovk commented Feb 13, 2019

@felker Yes. There are three levels of silencing, it'll silence everything at the first two levels.

@kylegibson
Copy link

@felker - The environment variable that @ncoghlan recommended also did not work for me. Here's what is currently working for me (pip 19.0.3):

PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command

The second component of the ignore spec is the prefix of the message that is being displayed. The current message is this:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.

@ncoghlan
Copy link
Member

@kylegibson You're right, I didn't test mine, and it was broken twice over (regex filters aren't accepted via the environment variable, and filters have to match the start of the message, not an arbitrary subsequence)

@pradyunsg
Copy link
Member

I'm going to go ahead and lock this PR. We have a place for discussion about Python 2.7 at #6231.

@pypa pypa locked as resolved and limited conversation to collaborators Feb 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: deprecation Related to deprecation / removal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.