Repository: psf/requests
File: setup.py (Python)

Code before:
#!/usr/bin/env python
import os
import sys

from codecs import open

from setuptools import setup
from setuptools.command.test import test as TestCommand


CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 7)

if CURRENT_PYTHON < REQUIRED_PYTHON:
    sys.stderr.write(
        """
==========================
Unsupported Python version
==========================
This version of Requests requires Python {}.{}, but you're trying to
install it on Python {}.{}.
This may be because you are using a version of pip that doesn't
understand the python_requires classifier. Make sure you
have pip >= 9.0 and setuptools >= 24.2, then try again:
    $ python -m pip install --upgrade pip setuptools
    $ python -m pip install requests
This will install the latest version of Requests which works on your
version of Python. If you can't upgrade your pip (or Python), request
an older version of Requests:
    $ python -m pip install "requests<2.28"
""".format(
            *(REQUIRED_PYTHON + CURRENT_PYTHON)
        )
    )
    sys.exit(1)

class PyTest(TestCommand):
    user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]

    def initialize_options(self):
        TestCommand.initialize_options(self)
        try:
            from multiprocessing import cpu_count
            self.pytest_args = ['-n', str(cpu_count()), '--boxed']
        except (ImportError, NotImplementedError):
            self.pytest_args = ['-n', '1', '--boxed']

    def finalize_options(self):

Review comment (suggestion):
We discussed this in the urllib3 Discord with @nateprewitt and @graingert and figured out that this series of steps isn't always going to solve the problem because pip *also* dropped Python versions over time.

There were a few solutions proposed:
- Keep the current message
- Always recommend installing pip<21 (last version that supported Python 2 and 3.5)
- Recommend installing [pip-with-requires-python](https://pypi.org/project/pip-with-requires-python)
- Not give a recommendation on *how* to upgrade pip and setuptools?

I also raised the point of recommending users upgrade pip/setuptools would likely break OS installations.

Code after:
#!/usr/bin/env python
import os
import sys

from codecs import open

from setuptools import setup
from setuptools.command.test import test as TestCommand


CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 7)

if CURRENT_PYTHON < REQUIRED_PYTHON:
    sys.stderr.write(
        """
==========================
Unsupported Python version
==========================
This version of Requests requires at least Python {}.{}, but
you're trying to install it on Python {}.{}. To resolve this,
consider upgrading to a supported Python version.

If you can't upgrade your Python version, you'll need to
pin to an older version of Requests (<2.28).
""".format(
            *(REQUIRED_PYTHON + CURRENT_PYTHON)
        )
    )
    sys.exit(1)

class PyTest(TestCommand):
    user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]

    def initialize_options(self):
        TestCommand.initialize_options(self)
        try:
            from multiprocessing import cpu_count
            self.pytest_args = ['-n', str(cpu_count()), '--boxed']
        except (ImportError, NotImplementedError):
            self.pytest_args = ['-n', '1', '--boxed']

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):