Skip to content

Commit aa98900

Browse files
authored
Merge pull request #2134 from pypa/feature/python-2-sunset-docs
Crash under Python 2
2 parents 63acfc1 + dbdd19d commit aa98900

File tree

5 files changed

+84
-18
lines changed

5 files changed

+84
-18
lines changed

.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Please DO NOT SUBMIT this template without first investigating the issue and ans
1313
1414
If you did not intend to use this template, but only meant to file a blank issue, just hit the back button and click "Open a blank issue".
1515
16-
It's by design that Setuptools 45 and later will stop working on Python 2. To ease the transition, Setuptools 45 was released to continue to have Python 2 compatibility, but emit a strenuous warning that it will stop working.
16+
Setuptools 45 dropped support for Python 2 with a strenuous warning and Setuptools 47 fails to run on Python 2.
1717
1818
In most cases, using pip 9 or later to install Setuptools from PyPI or any index supporting the Requires-Python metadata will do the right thing and install Setuptools 44.x on Python 2.
1919
@@ -28,6 +28,7 @@ Your first course of action should be to reason about how you managed to get an
2828
<!-- These are the recommended workarounds for the issue. Please
2929
try them first. -->
3030

31+
- [ ] Read [Python 2 Sunset docs](https://setuptools.readthedocs.io/en/latest/python%202%20sunset.html).
3132
- [ ] Python 2 is required for this application.
3233
- [ ] I maintain the software that installs Setuptools (if not, please contact that project).
3334
- [ ] Setuptools installed with pip 9 or later.
@@ -40,6 +41,11 @@ try them first. -->
4041
- Python installed how:
4142
- Virtualenv version (if using virtualenv): n/a
4243

44+
Command(s) that triggered the warning/error (and output):
45+
46+
```
47+
```
48+
4349
Command(s) used to install setuptools (and output):
4450

4551
```

.travis.yml

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ language: python
44
jobs:
55
fast_finish: true
66
include:
7-
- &latest_py2
8-
python: 2.7
9-
env: TOXENV=py27
10-
- <<: *latest_py2
11-
env: LANG=C TOXENV=py27
127
- python: pypy3
138
env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow).
149
- python: 3.5

changelog.d/2094.breaking.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Setuptools now actively crashes under Python 2. Python 3.5 or later is required. Users of Python 2 should use ``setuptools<45``.

docs/python 2 sunset.txt

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
:orphan:
2+
3+
Python 2 Sunset
4+
===============
5+
6+
Since January 2020 and the release of Setuptools 45, Python 2 is no longer
7+
supported by the most current release (`discussion
8+
<https://github.com/pypa/setuptools/issues/1458>`_). Setuptools as a project
9+
continues to support Python 2 with bugfixes and important features on
10+
Setuptools 44.x.
11+
12+
By design, most users will be unaffected by this change. That's because
13+
Setuptools 45 declares its supported Python versions to exclude Python 2.7,
14+
and installers such as pip 9 or later will honor this declaration and prevent
15+
installation of Setuptools 45 or later in Python 2 environments.
16+
17+
Users that do import any portion of Setuptools 45 or later on Python 2 are
18+
directed to this documentation to provide guidance on how to work around the
19+
issues.
20+
21+
Workarounds
22+
-----------
23+
24+
The best recommendation is to avoid Python 2 and move to Python 3 where
25+
possible. This project acknowledges that not all environments can drop Python
26+
2 support, so provides other options.
27+
28+
In less common scenarios, later versions of Setuptools can be installed on
29+
unsupported Python versions. In these environments, the installer is advised
30+
to first install ``setuptools<45`` to "pin Setuptools" to a compatible
31+
version.
32+
33+
- When using older versions of pip (before 9.0), the ``Requires-Python``
34+
directive is not honored and invalid versions can be installed. Users are
35+
advised first to upgrade pip and retry or to pin Setuptools. Use ``pip
36+
--version`` to determine the version of pip.
37+
- When using ``easy_install``, ``Requires-Python`` is not honored and later
38+
versions can be installed. In this case, users are advised to pin
39+
Setuptools. This applies to ``setup.py install`` invocations as well, as
40+
they use Setuptools under the hood.
41+
42+
It's still not working
43+
----------------------
44+
45+
If after trying the above steps, the Python environment still has incompatible
46+
versions of Setuptools installed, here are some things to try.
47+
48+
1. Uninstall and reinstall Setuptools. Run ``pip uninstall -y setuptools`` for
49+
the relevant environment. Repeat until there is no Setuptools installed.
50+
Then ``pip install setuptools``.
51+
2. If possible, attempt to replicate the problem in a second environment
52+
(virtual machine, friend's computer, etc). If the issue is isolated to just
53+
one unique enviornment, first determine what is different about those
54+
environments (or reinstall/reset the failing one to defaults).
55+
3. End users who are not themselves the maintainers for the package they are
56+
trying to install should contact the support channels for the relevant
57+
application. Please be considerate of those projects by searching for
58+
existing issues and following the latest guidance before reaching out for
59+
support. When filing an issue, be sure to give as much detail as possible
60+
to help the maintainers understand what factors led to the issue after
61+
following their recommended guidance.
62+
4. Reach out to your local support groups. There's a good chance someone
63+
nearby has the expertise and willingness to help.
64+
5. If all else fails, `file this template
65+
<https://github.com/pypa/setuptools/issues/new?assignees=&labels=Python+2&template=setuptools-warns-about-python-2-incompatibility.md&title=Incompatible+install+in+(summarize+your+environment)>`_
66+
with Setuptools. Please complete the whole template, providing as much
67+
detail about what factors led to the issue. Setuptools maintainers will
68+
summarily close tickets filed without any meaningful detail or engagement
69+
with the issue.

pkg_resources/py2_warn.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44

55

66
msg = textwrap.dedent("""
7-
You are running Setuptools on Python 2, which is no longer
8-
supported and
9-
>>> SETUPTOOLS WILL STOP WORKING <<<
10-
in a subsequent release (no sooner than 2020-04-20).
11-
Please ensure you are installing
12-
Setuptools using pip 9.x or later or pin to `setuptools<45`
13-
in your environment.
14-
If you have done those things and are still encountering
15-
this message, please follow up at
16-
https://bit.ly/setuptools-py2-warning.
7+
Encountered a version of Setuptools that no longer supports
8+
this version of Python. Please head to
9+
https://bit.ly/setuptools-py2-warning for support.
1710
""")
1811

19-
pre = "Setuptools will stop working on Python 2\n"
12+
pre = "Setuptools no longer works on Python 2\n"
2013

21-
sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
14+
if sys.version_info < (3,):
15+
warnings.warn(pre + "*" * 60 + msg + "*" * 60)
16+
raise SystemExit(32)

0 commit comments

Comments
 (0)