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

Remove support for Python 2.7, 3.6 and Pypy3.6 #6091

Merged
merged 3 commits into from Mar 25, 2022

Conversation

nateprewitt
Copy link
Member

This PR is a proposal to officially remove support for Python 2.7 as discussed in #6023. The next minor release (Requests 2.28.0) will no longer provide support for any of the end of life Python runtimes. Users are encouraged to upgrade to Python 3.8 or later. If you're unable to do so, we'd recommend pinning to requests<2.28.

This will be the first of a few PRs that will be doing some general code clean up now that we're moving to a Python 3-only code base. I'll post the others as drafts shortly.

setup.py Show resolved Hide resolved
Copy link
Member

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so exciting! Here's a handful of comments/questions:

tests/compat.py Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
Copy link
Contributor

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other bits to clean up:

tox.ini: add 310, remove 27 and 36

Several files: clean up use_chardet_on_py3

requests/utils.py: replacer = os.rename if sys.version_info[0] == 2 else os.replace

tests/testserver/server.py:

        # NB: when Python 2.7 is no longer supported, the argument
        # can be removed to use a default backlog size
        sock.listen(5)

setup.py Outdated Show resolved Hide resolved
@nateprewitt nateprewitt changed the title Remove support for Python 2.7, 3.6 and Pypy3 Remove support for Python 2.7, 3.6 and Pypy3.6 Mar 23, 2022
Formally removing any remaining vestiges of Python 2 from Requests.
We'll also leave behind Python 3.6 while we're at it.
@nateprewitt
Copy link
Member Author

Thanks @hugovk, those are all great call outs! use_chardet_on_py3 is an unfortunate misnomer because it just forcing use of chardet. The only reason it references py3 is because chardet was the default for Python 2. I don't think we can change the extra name at this point.

I addressed the rest of @sethmlarson's comments too and added a hard failure in the setup.py for anyone installing on pip<9.

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Copy link
Member

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :shipit:

@nateprewitt nateprewitt merged commit 8bce583 into psf:main Mar 25, 2022
@nateprewitt nateprewitt deleted the halve_it branch March 25, 2022 16:50
@nateprewitt nateprewitt added this to the 2.28.0 milestone Apr 7, 2022
@nateprewitt nateprewitt mentioned this pull request Jun 8, 2022
JacekLach added a commit to JacekLach/requests-feedstock that referenced this pull request Aug 30, 2022
psf/requests#6091 drops py3.6 support, so the feedstock should require python 3.7 or newer
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants