From 325be5fa5cf57cc5a1c71e804a7080aea749ad29 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sat, 26 Feb 2022 12:47:17 -0500 Subject: [PATCH] Drop EOL Python 3.6 --- .github/workflows/test-suite.yml | 2 +- README.md | 1 - README_chinese.md | 5 ++--- docs/index.md | 1 - httpx/_client.py | 3 +-- httpx/_compat.py | 7 ------- setup.py | 2 +- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 86b4a03d4a..7209fc2bf0 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - uses: "actions/checkout@v2" diff --git a/README.md b/README.md index 23866adbbd..188272a122 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,6 @@ As well as these optional installs: * `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)* * `click` - Command line client support. *(Optional, with `httpx[cli]`)* * `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)* -* `async_generator` - Backport support for `contextlib.asynccontextmanager`. *(Only required for Python 3.6)* A huge amount of credit is due to `requests` for the API layout that much of this work follows, as well as to `urllib3` for plenty of design diff --git a/README_chinese.md b/README_chinese.md index 0daa78c610..f8400a7644 100644 --- a/README_chinese.md +++ b/README_chinese.md @@ -86,7 +86,7 @@ HTTPX将并为您提供以下功能: * 支持HTTP(S) 代理 * 支持设定timeout * 流式下载 -* 支持 .netrc +* 支持 .netrc * 接收Chunked编码 ## 安装 @@ -111,7 +111,7 @@ HTTPX 要求 Python 3.6版本或更高. 想学习基础知识?请访问 [快速开始](https://www.python-httpx.org/quickstart/). -想获得进阶帮助? 请访问 [Advanced Usage](https://www.python-httpx.org/advanced/) 来获得答案, 不妨来看看 [异步支持](https://www.python-httpx.org/async/) 或者 [HTTP/2](https://www.python-httpx.org/http2/) +想获得进阶帮助? 请访问 [Advanced Usage](https://www.python-httpx.org/advanced/) 来获得答案, 不妨来看看 [异步支持](https://www.python-httpx.org/async/) 或者 [HTTP/2](https://www.python-httpx.org/http2/) [Developer Interface](https://www.python-httpx.org/api/) 提供了全面的API参考。 @@ -136,7 +136,6 @@ HTTPX项目依赖于这些优秀的库: * `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)* * `click` - Command line client support. *(Optional, with `httpx[cli]`)* * `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)* -* `async_generator` - Backport support for `contextlib.asynccontextmanager`. *(Only required for Python 3.6)* A huge amount of credit is due to `requests` for the API layout that much of this work follows, as well as to `urllib3` for plenty of design diff --git a/docs/index.md b/docs/index.md index 2b3865bb8e..6032f6af0a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -121,7 +121,6 @@ As well as these optional installs: * `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)* * `click` - Command line client support. *(Optional, with `httpx[cli]`)* * `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)* -* `async_generator` - Backport support for `contextlib.asynccontextmanager`. *(Only required for Python 3.6)* A huge amount of credit is due to `requests` for the API layout that much of this work follows, as well as to `urllib3` for plenty of design diff --git a/httpx/_client.py b/httpx/_client.py index c57cfb6ea9..cec0d63589 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -2,12 +2,11 @@ import enum import typing import warnings -from contextlib import contextmanager +from contextlib import asynccontextmanager, contextmanager from types import TracebackType from .__version__ import __version__ from ._auth import Auth, BasicAuth, FunctionAuth -from ._compat import asynccontextmanager from ._config import ( DEFAULT_LIMITS, DEFAULT_MAX_REDIRECTS, diff --git a/httpx/_compat.py b/httpx/_compat.py index ed61e98f60..4548d3db73 100644 --- a/httpx/_compat.py +++ b/httpx/_compat.py @@ -5,13 +5,6 @@ import ssl import sys -# `contextlib.asynccontextmanager` exists from Python 3.7 onwards. -# For 3.6 we require the `async_generator` package for a backported version. -if sys.version_info >= (3, 7): - from contextlib import asynccontextmanager # type: ignore -else: - from async_generator import asynccontextmanager # type: ignore # noqa - # Brotli support is optional # The C bindings in `brotli` are recommended for CPython. # The CFFI bindings in `brotlicffi` are recommended for PyPy and everything else. diff --git a/setup.py b/setup.py index 945bfb83e0..34a2bc5532 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def get_packages(package): setup( name="httpx", - python_requires=">=3.6", + python_requires=">=3.7", version=get_version("httpx"), url="https://github.com/encode/httpx", project_urls={