Repository: pypa/setuptools

Issue:
Drop support for Python 2.7
It's possible we already have a ticket for this, but #1457 revived the idea. Here are my thoughts:

I'm interested in dropping support for new releases on Python 2.7. I can imagine maintaining support for Python 2.7 in a bugfix-only branch. My main worry would be breaking the expectation that the latest version of setuptools is generally viable in all supported versions. But there are features now that would mitigate that issue -- the python_version declaration and PEP 518 support in pip, I'm thinking systems admins and app developers would still be able to install the "latest" version of setuptools, even in Python 2.7, but they would only get the maintenance versions. Presumably the same thing happened for Python 2.6. I'd really like to drop support for Python 2.7 earlier than later if possible.


Discussion:
Hello @jaraco! Apologies if this is documented somewhere else. Are there any additional plans for dropping Python 2.7 support?
In the brief discussions I've had with others, I get the sense there are too many environments that would break if setuptools were to drop Python 2 support. In many ways, setuptools is at the base of the dependency tree so will have to be the last package to drop support.
Pip is in a similar boat, see https://github.com/pypa/pip/issues/6148 and for packaging in general see https://discuss.python.org/t/packaging-and-python-2/662. 
I'd like to revive consideration for this issue, not because it's Jan 2020 as much as that I spent several hours yesterday addressing Python 2 support in this codebase.

Let's say we were to summarily drop support for Python 2.7 today - what impact would that have? Projects using pip 9 or later to install setuptools would not be affected (they'd continue to get compatible, if frozen, versions). Only projects using `easy_install` or some other mechanism (e.g. from GitHub master) for installation might be affected.

That seems perfectly reasonable to me.

Resolving patch:
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -83,6 +83,7 @@
 __import__('pkg_resources.extern.packaging.specifiers')
 __import__('pkg_resources.extern.packaging.requirements')
 __import__('pkg_resources.extern.packaging.markers')
+__import__('pkg_resources.py2_warn')
 
 
 __metaclass__ = type
diff --git a/pkg_resources/py2_warn.py b/pkg_resources/py2_warn.py
new file mode 100644
--- /dev/null
+++ b/pkg_resources/py2_warn.py
@@ -0,0 +1,19 @@
+import sys
+import warnings
+import textwrap
+
+
+msg = textwrap.dedent("""
+    You are running Setuptools on Python 2, which is no longer
+    supported and
+    >>> SETUPTOOLS WILL STOP WORKING <<<
+    in a subsequent release. Please ensure you are installing
+    Setuptools using pip 9.x or later or pin to `setuptools<45`
+    in your environment.
+    If you have done those things and are still encountering
+    this message, please comment in
+    https://github.com/pypa/setuptools/issues/1458
+    about the steps that led to this unsupported combination.
+    """)
+
+sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)


Test patch: