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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/6148.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Start printing a warning for Python 2.7 to warn of impending Python 2.7 End-of-life and
prompt users to start migrating to Python 3.
9 changes: 9 additions & 0 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ def main(self, args):
replacement=None,
gone_in='19.2',
)
elif sys.version_info[:2] == (2, 7):
deprecated(
"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.",
replacement=None,
gone_in=None,
)

# TODO: Try to get these passing down from the command?
# without resorting to os.environ to hold these.
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,4 @@ def in_memory_pip():
@pytest.fixture
def deprecated_python():
"""Used to indicate wheither pip deprecated this python version"""
return sys.version_info[:2] == (3, 4)
return sys.version_info[:2] in [(3, 4), (2, 7)]