From 46dab46d6debf69331b646bff11052dc731d4ae4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 24 May 2020 15:50:07 -0400 Subject: [PATCH 1/7] Add landing page for Python 2 sunset. Ref #2094. --- ...ls-warns-about-python-2-incompatibility.md | 5 +++ docs/python 2 sunset.txt | 35 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 docs/python 2 sunset.txt diff --git a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md index 2f5fe53dd0..e2d5ed5360 100644 --- a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md +++ b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md @@ -40,6 +40,11 @@ try them first. --> - Python installed how: - Virtualenv version (if using virtualenv): n/a +Command(s) that triggered the warning/error (and output): + +``` +``` + Command(s) used to install setuptools (and output): ``` diff --git a/docs/python 2 sunset.txt b/docs/python 2 sunset.txt new file mode 100644 index 0000000000..543487d81b --- /dev/null +++ b/docs/python 2 sunset.txt @@ -0,0 +1,35 @@ +:orphan: + +Python 2 Sunset +=============== + +Since January 2020 and the release of Setuptools 45, Python 2 is no longer supported by the most current release (`discussion `_). Setuptools as a project continues to support Python 2 with bugfixes and important features on Setuptools 44.x. + +By design, most users will be unaffected by this change. That's because Setuptools 45 declares its supported Python versions to exclude Python 2.7, and installers such as pip 9 or later will honor this declaration and prevent installation of Setuptools 45 or later in Python 2 environments. + +Users that do import any portion of Setuptools 45 or later on Python 2 are directed to this documentation to provide guidance on how to work around the issues. + +Workarounds +----------- + +The best recommendation is to avoid Python 2 and move to Python 3 where possible. This project acknowledges that not all environments can drop Python 2 support, so provides other options. + +In less common scenarios, later versions of Setuptools can be installed on unsupported Python versions. In these environments, the installer is advised to first install ``setuptools<45`` to "pin Setuptools" to a compatible version. + +- When using older versions of pip (before 9.0), the ``Requires-Python`` directive is not honored and invalid versions can be installed. Users are advised first to upgrade pip and retry or to pin Setuptools. Use ``pip --version`` to determine the version of pip. +- When using ``easy_install``, ``Requires-Python`` is not honored and later versions can be installed. In this case, users are advised to pin Setuptools. This applies to ``setup.py install`` invocations as well, as they use Setuptools under the hood. + +It's still not working +---------------------- + +If after trying the above steps, the Python environment still has incompatible versions of Setuptools installed, here are some things to try. + +1. Uninstall and reinstall Setuptools. Run ``pip uninstall -y setuptools`` for the relevant environment. Repeat until there is no Setuptools installed. Then ``pip install setuptools``. + +2. If possible, attempt to replicate the problem in a second environment (virtual machine, friend's computer, etc). If the issue is isolated to just one unique enviornment, first determine what is different about those environments (or reinstall/reset the failing one to defaults). + +3. End users who are not themselves the maintainers for the package they are trying to install should contact the support channels for the relevant application. Please be respectful by searching for existing issues and following the latest guidance before reaching out for support. If you do file an issue, be sure to give as much detail as possible to help the maintainers understand how you encountered the issue following their recommended guidance. + +4. Reach out to your local support groups. There's a good chance someone near you has the expertise and willingness to help. + +5. If all else fails, `file this template `_ with Setuptools. Please complete the whole template, providing as much detail about how you encountered the issue. Setuptools maintainers will summarily close tickets filed without any meaningful detail or engagement with the issue. From 64b1a6fa12f7d4f6508008541adbebdcd6ee20a8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 24 May 2020 16:06:38 -0400 Subject: [PATCH 2/7] Force fail on Python 2. When doing so, emit an error that directs users to the latest guidance. Fixes #2094. --- ...ls-warns-about-python-2-incompatibility.md | 1 + .travis.yml | 5 ----- pkg_resources/py2_warn.py | 19 +++++++------------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md index e2d5ed5360..b5fe8abf68 100644 --- a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md +++ b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md @@ -28,6 +28,7 @@ Your first course of action should be to reason about how you managed to get an +- [ ] Read [Python 2 Sunset docs](https://setuptools.readthedocs.io/en/latest/python%202%20sunset.html). - [ ] Python 2 is required for this application. - [ ] I maintain the software that installs Setuptools (if not, please contact that project). - [ ] Setuptools installed with pip 9 or later. diff --git a/.travis.yml b/.travis.yml index 3e97f353aa..21716ea61c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,6 @@ language: python jobs: fast_finish: true include: - - &latest_py2 - python: 2.7 - env: TOXENV=py27 - - <<: *latest_py2 - env: LANG=C TOXENV=py27 - python: pypy3 env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow). - python: 3.5 diff --git a/pkg_resources/py2_warn.py b/pkg_resources/py2_warn.py index bfc3523415..00cc8bc75d 100644 --- a/pkg_resources/py2_warn.py +++ b/pkg_resources/py2_warn.py @@ -4,18 +4,13 @@ msg = textwrap.dedent(""" - You are running Setuptools on Python 2, which is no longer - supported and - >>> SETUPTOOLS WILL STOP WORKING <<< - in a subsequent release (no sooner than 2020-04-20). - 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 follow up at - https://bit.ly/setuptools-py2-warning. + Encountered a version of Setuptools that no longer supports + this version of Python. Please head to + https://bit.ly/setuptools-py2-warning for support. """) -pre = "Setuptools will stop working on Python 2\n" +pre = "Setuptools no longer works on Python 2\n" -sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60) +if sys.version_info < (3,): + warnings.warn(pre + "*" * 60 + msg + "*" * 60) + raise SystemExit(32) From e23403355f87272c8b0c027b98bf18309c38fa31 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 24 May 2020 16:14:54 -0400 Subject: [PATCH 3/7] Prefer imperative voice --- docs/python 2 sunset.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/python 2 sunset.txt b/docs/python 2 sunset.txt index 543487d81b..6b8016fb04 100644 --- a/docs/python 2 sunset.txt +++ b/docs/python 2 sunset.txt @@ -28,8 +28,8 @@ If after trying the above steps, the Python environment still has incompatible v 2. If possible, attempt to replicate the problem in a second environment (virtual machine, friend's computer, etc). If the issue is isolated to just one unique enviornment, first determine what is different about those environments (or reinstall/reset the failing one to defaults). -3. End users who are not themselves the maintainers for the package they are trying to install should contact the support channels for the relevant application. Please be respectful by searching for existing issues and following the latest guidance before reaching out for support. If you do file an issue, be sure to give as much detail as possible to help the maintainers understand how you encountered the issue following their recommended guidance. +3. End users who are not themselves the maintainers for the package they are trying to install should contact the support channels for the relevant application. Please be respectful by searching for existing issues and following the latest guidance before reaching out for support. When filing an issue, be sure to give as much detail as possible to help the maintainers understand what factors led to the issue after following their recommended guidance. -4. Reach out to your local support groups. There's a good chance someone near you has the expertise and willingness to help. +4. Reach out to your local support groups. There's a good chance someone nearby has the expertise and willingness to help. -5. If all else fails, `file this template `_ with Setuptools. Please complete the whole template, providing as much detail about how you encountered the issue. Setuptools maintainers will summarily close tickets filed without any meaningful detail or engagement with the issue. +5. If all else fails, `file this template `_ with Setuptools. Please complete the whole template, providing as much detail about what factors led to the issue. Setuptools maintainers will summarily close tickets filed without any meaningful detail or engagement with the issue. From 7c571c264e0f49965ee2dabbcb9f360aa9c91e28 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 25 May 2020 10:31:53 -0400 Subject: [PATCH 4/7] Reword and simplify note about supported versions. --- .../setuptools-warns-about-python-2-incompatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md index b5fe8abf68..1a4f58f284 100644 --- a/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md +++ b/.github/ISSUE_TEMPLATE/setuptools-warns-about-python-2-incompatibility.md @@ -13,7 +13,7 @@ Please DO NOT SUBMIT this template without first investigating the issue and ans 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". -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. +Setuptools 45 dropped support for Python 2 with a strenuous warning and Setuptools 47 fails to run on Python 2. 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. From e0b3acb4868f8283565fae462b71fb75d1c5a2bd Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 25 May 2020 10:33:46 -0400 Subject: [PATCH 5/7] Add changelog entry. --- changelog.d/2094.breaking.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2094.breaking.rst diff --git a/changelog.d/2094.breaking.rst b/changelog.d/2094.breaking.rst new file mode 100644 index 0000000000..c278d0fdb4 --- /dev/null +++ b/changelog.d/2094.breaking.rst @@ -0,0 +1 @@ +Setuptools now actively crashes under Python 2. Python 3.5 or later is required. Users of Python 2 should use ``setuptools<45``. From 96f0781f08b3da918ffaafae656623c3c3152682 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 25 May 2020 10:39:33 -0400 Subject: [PATCH 6/7] Wrap lines and remove newlines between enumerated paragraphs. --- docs/python 2 sunset.txt | 68 ++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/docs/python 2 sunset.txt b/docs/python 2 sunset.txt index 6b8016fb04..a6d768cb2e 100644 --- a/docs/python 2 sunset.txt +++ b/docs/python 2 sunset.txt @@ -3,33 +3,67 @@ Python 2 Sunset =============== -Since January 2020 and the release of Setuptools 45, Python 2 is no longer supported by the most current release (`discussion `_). Setuptools as a project continues to support Python 2 with bugfixes and important features on Setuptools 44.x. +Since January 2020 and the release of Setuptools 45, Python 2 is no longer +supported by the most current release (`discussion +`_). Setuptools as a project +continues to support Python 2 with bugfixes and important features on +Setuptools 44.x. -By design, most users will be unaffected by this change. That's because Setuptools 45 declares its supported Python versions to exclude Python 2.7, and installers such as pip 9 or later will honor this declaration and prevent installation of Setuptools 45 or later in Python 2 environments. +By design, most users will be unaffected by this change. That's because +Setuptools 45 declares its supported Python versions to exclude Python 2.7, +and installers such as pip 9 or later will honor this declaration and prevent +installation of Setuptools 45 or later in Python 2 environments. -Users that do import any portion of Setuptools 45 or later on Python 2 are directed to this documentation to provide guidance on how to work around the issues. +Users that do import any portion of Setuptools 45 or later on Python 2 are +directed to this documentation to provide guidance on how to work around the +issues. Workarounds ----------- -The best recommendation is to avoid Python 2 and move to Python 3 where possible. This project acknowledges that not all environments can drop Python 2 support, so provides other options. +The best recommendation is to avoid Python 2 and move to Python 3 where +possible. This project acknowledges that not all environments can drop Python +2 support, so provides other options. -In less common scenarios, later versions of Setuptools can be installed on unsupported Python versions. In these environments, the installer is advised to first install ``setuptools<45`` to "pin Setuptools" to a compatible version. +In less common scenarios, later versions of Setuptools can be installed on +unsupported Python versions. In these environments, the installer is advised +to first install ``setuptools<45`` to "pin Setuptools" to a compatible +version. -- When using older versions of pip (before 9.0), the ``Requires-Python`` directive is not honored and invalid versions can be installed. Users are advised first to upgrade pip and retry or to pin Setuptools. Use ``pip --version`` to determine the version of pip. -- When using ``easy_install``, ``Requires-Python`` is not honored and later versions can be installed. In this case, users are advised to pin Setuptools. This applies to ``setup.py install`` invocations as well, as they use Setuptools under the hood. +- When using older versions of pip (before 9.0), the ``Requires-Python`` + directive is not honored and invalid versions can be installed. Users are + advised first to upgrade pip and retry or to pin Setuptools. Use ``pip + --version`` to determine the version of pip. +- When using ``easy_install``, ``Requires-Python`` is not honored and later + versions can be installed. In this case, users are advised to pin + Setuptools. This applies to ``setup.py install`` invocations as well, as + they use Setuptools under the hood. It's still not working ---------------------- -If after trying the above steps, the Python environment still has incompatible versions of Setuptools installed, here are some things to try. +If after trying the above steps, the Python environment still has incompatible +versions of Setuptools installed, here are some things to try. -1. Uninstall and reinstall Setuptools. Run ``pip uninstall -y setuptools`` for the relevant environment. Repeat until there is no Setuptools installed. Then ``pip install setuptools``. - -2. If possible, attempt to replicate the problem in a second environment (virtual machine, friend's computer, etc). If the issue is isolated to just one unique enviornment, first determine what is different about those environments (or reinstall/reset the failing one to defaults). - -3. End users who are not themselves the maintainers for the package they are trying to install should contact the support channels for the relevant application. Please be respectful by searching for existing issues and following the latest guidance before reaching out for support. When filing an issue, be sure to give as much detail as possible to help the maintainers understand what factors led to the issue after following their recommended guidance. - -4. Reach out to your local support groups. There's a good chance someone nearby has the expertise and willingness to help. - -5. If all else fails, `file this template `_ with Setuptools. Please complete the whole template, providing as much detail about what factors led to the issue. Setuptools maintainers will summarily close tickets filed without any meaningful detail or engagement with the issue. +1. Uninstall and reinstall Setuptools. Run ``pip uninstall -y setuptools`` for + the relevant environment. Repeat until there is no Setuptools installed. + Then ``pip install setuptools``. +2. If possible, attempt to replicate the problem in a second environment + (virtual machine, friend's computer, etc). If the issue is isolated to just + one unique enviornment, first determine what is different about those + environments (or reinstall/reset the failing one to defaults). +3. End users who are not themselves the maintainers for the package they are + trying to install should contact the support channels for the relevant + application. Please be respectful by searching for existing issues and + following the latest guidance before reaching out for support. When filing + an issue, be sure to give as much detail as possible to help the + maintainers understand what factors led to the issue after following their + recommended guidance. +4. Reach out to your local support groups. There's a good chance someone + nearby has the expertise and willingness to help. +5. If all else fails, `file this template + `_ + with Setuptools. Please complete the whole template, providing as much + detail about what factors led to the issue. Setuptools maintainers will + summarily close tickets filed without any meaningful detail or engagement + with the issue. From dbdd19d4212a35ac501c3f56987c035512ab6557 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 25 May 2020 10:40:09 -0400 Subject: [PATCH 7/7] s/respectful/considerate of those projects/ --- docs/python 2 sunset.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/python 2 sunset.txt b/docs/python 2 sunset.txt index a6d768cb2e..f7b7ee257f 100644 --- a/docs/python 2 sunset.txt +++ b/docs/python 2 sunset.txt @@ -54,11 +54,11 @@ versions of Setuptools installed, here are some things to try. environments (or reinstall/reset the failing one to defaults). 3. End users who are not themselves the maintainers for the package they are trying to install should contact the support channels for the relevant - application. Please be respectful by searching for existing issues and - following the latest guidance before reaching out for support. When filing - an issue, be sure to give as much detail as possible to help the - maintainers understand what factors led to the issue after following their - recommended guidance. + application. Please be considerate of those projects by searching for + existing issues and following the latest guidance before reaching out for + support. When filing an issue, be sure to give as much detail as possible + to help the maintainers understand what factors led to the issue after + following their recommended guidance. 4. Reach out to your local support groups. There's a good chance someone nearby has the expertise and willingness to help. 5. If all else fails, `file this template