From 6d56926b6af88a28da05e307b5bc4736870697da Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Fri, 1 Apr 2022 17:10:08 +0100 Subject: [PATCH 01/15] Remove Python 3.6 related code --- httpcore/_async/interfaces.py | 2 +- httpcore/_compat.py | 6 ------ setup.cfg | 2 +- setup.py | 3 +-- unasync.py | 3 +-- 5 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 httpcore/_compat.py diff --git a/httpcore/_async/interfaces.py b/httpcore/_async/interfaces.py index 95165724..c3ffa2a8 100644 --- a/httpcore/_async/interfaces.py +++ b/httpcore/_async/interfaces.py @@ -1,6 +1,6 @@ +from contextlib import asynccontextmanager from typing import AsyncIterator, Optional, Union -from .._compat import asynccontextmanager from .._models import ( URL, Origin, diff --git a/httpcore/_compat.py b/httpcore/_compat.py deleted file mode 100644 index aa4f5bd3..00000000 --- a/httpcore/_compat.py +++ /dev/null @@ -1,6 +0,0 @@ -# `contextlib.asynccontextmanager` exists from Python 3.7 onwards. -# For 3.6 we require the `async_generator` package for a backported version. -try: - from contextlib import asynccontextmanager # type: ignore -except ImportError: - from async_generator import asynccontextmanager # type: ignore # noqa diff --git a/setup.cfg b/setup.cfg index a3d719d5..e18b33d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,5 +31,5 @@ filterwarnings = ignore:ssl\.PROTOCOL_TLS is deprecated:DeprecationWarning [coverage:run] -omit = venv/*, httpcore/_sync/*, httpcore/_compat.py +omit = venv/*, httpcore/_sync/* include = httpcore/*, tests/* diff --git a/setup.py b/setup.py index 9bfc613b..85cfc801 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def get_packages(package): setup( name="httpcore", - python_requires=">=3.6", + python_requires=">=3.7", version=get_version("httpcore"), url="https://github.com/encode/httpcore", project_urls={ @@ -73,7 +73,6 @@ def get_packages(package): "Framework :: AsyncIO", "Framework :: Trio", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", diff --git a/unasync.py b/unasync.py index a7b2e46f..1e8c51e5 100755 --- a/unasync.py +++ b/unasync.py @@ -1,10 +1,9 @@ #!venv/bin/python -import re import os +import re import sys SUBS = [ - ('from .._compat import asynccontextmanager', 'from contextlib import contextmanager'), ('from ..backends.auto import AutoBackend', 'from ..backends.sync import SyncBackend'), ('import trio as concurrency', 'from tests import concurrency'), ('AsyncByteStream', 'SyncByteStream'), From fd7328450a1ccd71060e6ff588504f4dba6094bb Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Fri, 1 Apr 2022 17:12:20 +0100 Subject: [PATCH 02/15] Remove Python 3.6 from matrix strategy --- .github/workflows/test-suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 86b4a03d..7209fc2b 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" From bb518f3ba0c8cd0cc0824f675ec1fdad99f2c2dd Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:16:43 +0100 Subject: [PATCH 03/15] Unpin `twine` version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 163b7212..e6ac15d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ mkdocs-material-extensions==1.0.3 mkdocstrings==0.17.0 # Packaging -twine==3.8.0 +twine wheel==0.37.1 # Tests & Linting From 9391602ff463b23e287811bd3600dff219c2f2da Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:17:04 +0100 Subject: [PATCH 04/15] Bump `black` version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e6ac15d2..cac6e63b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ wheel==0.37.1 # Tests & Linting anyio==3.5.0 autoflake==1.4 -black==22.1.0 +black==22.3.0 coverage==6.2 flake8==4.0.1 isort==5.10.1 From 56a87234cc75594a2b7b9702e5084075c5a735ed Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:22:36 +0100 Subject: [PATCH 05/15] Make black target version 3.7 --- scripts/check | 2 +- scripts/lint | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check b/scripts/check index 53bb7b10..71b23996 100755 --- a/scripts/check +++ b/scripts/check @@ -9,7 +9,7 @@ export SOURCE_FILES="httpcore tests" set -x ${PREFIX}isort --check --diff --project=httpcore $SOURCE_FILES -${PREFIX}black --exclude '/(_sync|sync_tests)/' --check --diff --target-version=py36 $SOURCE_FILES +${PREFIX}black --exclude '/(_sync|sync_tests)/' --check --diff --target-version=py37 $SOURCE_FILES ${PREFIX}flake8 $SOURCE_FILES ${PREFIX}mypy $SOURCE_FILES scripts/unasync --check diff --git a/scripts/lint b/scripts/lint index 5908a931..8ae9ce4b 100755 --- a/scripts/lint +++ b/scripts/lint @@ -10,7 +10,7 @@ set -x ${PREFIX}autoflake --in-place --recursive --remove-all-unused-imports $SOURCE_FILES ${PREFIX}isort --project=httpcore $SOURCE_FILES -${PREFIX}black --target-version=py36 --exclude '/(_sync|sync_tests)/' $SOURCE_FILES +${PREFIX}black --target-version=py37 --exclude '/(_sync|sync_tests)/' $SOURCE_FILES # Run unasync last because its `--check` mode is not aware of code formatters. # (This means sync code isn't prettified, and that's mostly okay.) From 3e262cb8dd8bcaf56522db0df582e0582af95f97 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:42:23 +0100 Subject: [PATCH 06/15] Linting --- httpcore/_sync/interfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpcore/_sync/interfaces.py b/httpcore/_sync/interfaces.py index df2f2c19..bf512abe 100644 --- a/httpcore/_sync/interfaces.py +++ b/httpcore/_sync/interfaces.py @@ -1,6 +1,6 @@ +from contextlib import contextmanager from typing import Iterator, Optional, Union -from contextlib import contextmanager from .._models import ( URL, Origin, From 74c99f2cb8f1c1eebc0cdfa88e574245a4253dd6 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:49:30 +0100 Subject: [PATCH 07/15] Unpin `wheel` dependency --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cac6e63b..447373d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ mkdocstrings==0.17.0 # Packaging twine -wheel==0.37.1 +wheel # Tests & Linting anyio==3.5.0 From 555e7bc1712c2bef97866cfcda2916093eccddee Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Mon, 4 Apr 2022 16:50:37 +0100 Subject: [PATCH 08/15] Bump `mkdocs` to 1.3.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 447373d3..0fac4339 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ trio==0.19.0 # Docs -mkdocs==1.2.3 +mkdocs==1.3.0 mkdocs-autorefs==0.3.1 mkdocs-material==8.2.3 mkdocs-material-extensions==1.0.3 From 0f5115c40967aef9c614ff30bcbe5dd05aabe738 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Tue, 5 Apr 2022 09:17:44 +0100 Subject: [PATCH 09/15] Unpin `mkdocs` --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0fac4339..a1f32b54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ trio==0.19.0 # Docs -mkdocs==1.3.0 +mkdocs mkdocs-autorefs==0.3.1 mkdocs-material==8.2.3 mkdocs-material-extensions==1.0.3 From 4b1133a9e39e663cf67b4309b0dd724b2b961b3b Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Tue, 5 Apr 2022 09:49:50 +0100 Subject: [PATCH 10/15] Revert "Unpin `mkdocs`" This reverts commit 0f5115c40967aef9c614ff30bcbe5dd05aabe738. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a1f32b54..0fac4339 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ trio==0.19.0 # Docs -mkdocs +mkdocs==1.3.0 mkdocs-autorefs==0.3.1 mkdocs-material==8.2.3 mkdocs-material-extensions==1.0.3 From 1503cf07e204e5bb7bbbd46f12164fb65c33ed59 Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Tue, 5 Apr 2022 11:37:56 +0200 Subject: [PATCH 11/15] Attempt: * Downpin flake8 to 3.9.2 * Pin Jinja2 to 3.0.3 --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0fac4339..aa46a279 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ mkdocs-autorefs==0.3.1 mkdocs-material==8.2.3 mkdocs-material-extensions==1.0.3 mkdocstrings==0.17.0 +jinja2==3.0.3 # See: https://github.com/mkdocs/mkdocs/issues/2799 # Packaging twine @@ -19,7 +20,7 @@ anyio==3.5.0 autoflake==1.4 black==22.3.0 coverage==6.2 -flake8==4.0.1 +flake8==3.9.2 isort==5.10.1 mypy==0.931 pytest==7.0.1 From cc41ccfdd44a15e0a46237b114f8b9906a2dcb0c Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Tue, 5 Apr 2022 11:42:18 +0200 Subject: [PATCH 12/15] Attempt: bump pytest-httpbin to 1.0.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index aa46a279..61a789bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,6 +24,6 @@ flake8==3.9.2 isort==5.10.1 mypy==0.931 pytest==7.0.1 -pytest-httpbin==1.0.1 +pytest-httpbin==1.0.2 pytest-trio==0.7.0 pytest-asyncio==0.16.0 From b49f0175f7047e48ac1e9c22afaf42cff47b7a88 Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Tue, 5 Apr 2022 11:57:26 +0200 Subject: [PATCH 13/15] Pin werkzeug --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 61a789bf..1ce69a1a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,6 +24,7 @@ flake8==3.9.2 isort==5.10.1 mypy==0.931 pytest==7.0.1 -pytest-httpbin==1.0.2 +pytest-httpbin==1.0.1 pytest-trio==0.7.0 pytest-asyncio==0.16.0 +werkzeug<2.1 # See: https://github.com/postmanlabs/httpbin/issues/673 From 46859fdb92ddcc5cdce9905298693e66113060dc Mon Sep 17 00:00:00 2001 From: Florimond Manca Date: Tue, 5 Apr 2022 16:04:02 +0200 Subject: [PATCH 14/15] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1ce69a1a..eded0d18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ anyio==3.5.0 autoflake==1.4 black==22.3.0 coverage==6.2 -flake8==3.9.2 +flake8==3.9.2 # See: https://github.com/PyCQA/flake8/pull/1438 isort==5.10.1 mypy==0.931 pytest==7.0.1 From 0929a2cfb40498a76443468643f79ec8b56078c4 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Wed, 6 Apr 2022 10:07:31 +0100 Subject: [PATCH 15/15] Add note about 3.7+ in README/docs --- README.md | 4 ++++ docs/index.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 1b794ae5..15435494 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ Some things HTTP Core does do: * Provides both sync and async interfaces. * Async backend support for `asyncio` and `trio`. +## Requirements + +Python 3.7+ + ## Installation For HTTP/1.1 only support, install with: diff --git a/docs/index.md b/docs/index.md index f54ffd5f..61e334b9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,6 +23,10 @@ Some things HTTP Core does do: * Provides both sync and async interfaces. * Async backend support for `asyncio` and `trio`. +## Requirements + +Python 3.7+ + ## Installation For HTTP/1.1 only support, install with: