diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 86b4a03d4..7209fc2bf 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 1b794ae50..154354940 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 f54ffd5ff..61e334b91 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: diff --git a/httpcore/_async/interfaces.py b/httpcore/_async/interfaces.py index 95165724e..c3ffa2a8f 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 aa4f5bd3f..000000000 --- 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/httpcore/_sync/interfaces.py b/httpcore/_sync/interfaces.py index df2f2c198..bf512abe4 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, diff --git a/requirements.txt b/requirements.txt index 163b72127..eded0d18b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,25 +4,27 @@ 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 mkdocstrings==0.17.0 +jinja2==3.0.3 # See: https://github.com/mkdocs/mkdocs/issues/2799 # Packaging -twine==3.8.0 -wheel==0.37.1 +twine +wheel # Tests & Linting anyio==3.5.0 autoflake==1.4 -black==22.1.0 +black==22.3.0 coverage==6.2 -flake8==4.0.1 +flake8==3.9.2 # See: https://github.com/PyCQA/flake8/pull/1438 isort==5.10.1 mypy==0.931 pytest==7.0.1 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 diff --git a/scripts/check b/scripts/check index 53bb7b101..71b239961 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 5908a9312..8ae9ce4b6 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.) diff --git a/setup.cfg b/setup.cfg index a3d719d5c..e18b33d2c 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 9bfc613be..85cfc801b 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 a7b2e46fe..1e8c51e5f 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'),