From 6409e726d9c0b69c5113d67654617600e5c856a6 Mon Sep 17 00:00:00 2001 From: Jair Henrique Date: Fri, 7 Jul 2023 10:32:05 -0300 Subject: [PATCH] Drop python 3.8 support --- docs/installation.rst | 2 +- pyproject.toml | 2 +- setup.py | 3 +- tox.ini | 81 ++++++++++++++++++++++++++++++++++++++ vcr/matchers.py | 5 +-- vcr/stubs/aiohttp_stubs.py | 3 +- 6 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 tox.ini diff --git a/docs/installation.rst b/docs/installation.rst index 21def634f..a6025e1a8 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -9,7 +9,7 @@ with pip:: Compatibility ------------- -VCR.py supports Python 3.8+, and `pypy `__. +VCR.py supports Python 3.9+, and `pypy `__. The following HTTP libraries are supported: diff --git a/pyproject.toml b/pyproject.toml index 749534568..3fad69800 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ select = [ "W", # pycodestyle warning ] line-length = 110 -target-version = "py38" +target-version = "py39" [tool.ruff.isort] known-first-party = ["vcr"] diff --git a/setup.py b/setup.py index 5b7a4c017..f213f9239 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def find_version(*file_paths): author_email="me@kevinmccarthy.org", url="https://github.com/kevin1024/vcrpy", packages=find_packages(exclude=["tests*"]), - python_requires=">=3.8", + python_requires=">=3.9", install_requires=install_requires, license="MIT", extras_require=extras_require, @@ -89,7 +89,6 @@ def find_version(*file_paths): "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..f93206aff --- /dev/null +++ b/tox.ini @@ -0,0 +1,81 @@ +[tox] +skip_missing_interpreters=true +envlist = + cov-clean, + lint, + {py39,py310,py311}-{requests-urllib3-1,httplib2,urllib3-1,tornado4,boto3,aiohttp,httpx}, + {py310,py311}-{requests-urllib3-2,urllib3-2}, + {pypy3}-{requests-urllib3-1,httplib2,urllib3-1,tornado4,boto3}, + {py310}-httpx019, + cov-report + + +[gh-actions] +python = + 3.9: py39 + 3.10: py310, lint + 3.11: py311 + pypy-3: pypy3 + +# Coverage environment tasks: cov-clean and cov-report +# https://pytest-cov.readthedocs.io/en/latest/tox.html +[testenv:cov-clean] +deps = coverage +skip_install=true +commands = coverage erase + +[testenv:cov-report] +deps = coverage +skip_install=true +commands = + coverage html + coverage report --fail-under=90 + +[testenv:lint] +skipsdist = True +commands = + black --version + black --check --diff . + ruff --version + ruff check . +deps = + black + ruff +basepython = python3.10 + +[testenv] +# Need to use develop install so that paths +# for aggregate code coverage combine +usedevelop=true +commands = + ./runtests.sh --cov=./vcr --cov-branch --cov-report=xml --cov-append {posargs} +allowlist_externals = + ./runtests.sh +deps = + Werkzeug==2.0.3 + pytest + pytest-httpbin>=1.0.1 + pytest-cov + PyYAML + ipaddress + requests: requests>=2.22.0 + httplib2: httplib2 + urllib3-1: urllib3<2 + urllib3-2: urllib3<3 + boto3: boto3 + aiohttp: aiohttp + aiohttp: pytest-asyncio + aiohttp: pytest-aiohttp + httpx: httpx + {py39,py310}-{httpx}: httpx + {py39,py310}-{httpx}: pytest-asyncio + httpx: httpx>0.19 + httpx019: httpx==0.19 + {py39,py310}-{httpx}: pytest-asyncio +depends = + lint,{py39,py310,py311,pypy3}-{requests-urllib3-1,httplib2,urllib3-1,tornado4,boto3},{py310,py311}-{requests-urllib3-2,urllib3-2},{py39,py310,py311}-{aiohttp},{py39,py310,py311}-{httpx}: cov-clean + cov-report: lint,{py39,py310,py311,pypy3}-{requests-urllib3-1,httplib2,urllib3-1,tornado4,boto3},{py310,py311}-{requests-urllib3-2,urllib3-2},{py39,py310,py311}-{aiohttp} +passenv = + AWS_ACCESS_KEY_ID + AWS_DEFAULT_REGION + AWS_SECRET_ACCESS_KEY diff --git a/vcr/matchers.py b/vcr/matchers.py index 0949fd950..cbdeabe10 100644 --- a/vcr/matchers.py +++ b/vcr/matchers.py @@ -3,11 +3,10 @@ import urllib import xmlrpc.client from string import hexdigits -from typing import List, Set from .util import read_body -_HEXDIG_CODE_POINTS: Set[int] = {ord(s.encode("ascii")) for s in hexdigits} +_HEXDIG_CODE_POINTS: set[int] = {ord(s.encode("ascii")) for s in hexdigits} log = logging.getLogger(__name__) @@ -109,7 +108,7 @@ def _dechunk(body): CHUNK_GAP = b"\r\n" BODY_LEN: int = len(body) - chunks: List[bytes] = [] + chunks: list[bytes] = [] pos: int = 0 while True: diff --git a/vcr/stubs/aiohttp_stubs.py b/vcr/stubs/aiohttp_stubs.py index 9b07b9d1a..88be90a7f 100644 --- a/vcr/stubs/aiohttp_stubs.py +++ b/vcr/stubs/aiohttp_stubs.py @@ -4,8 +4,9 @@ import functools import json import logging +from collections.abc import Mapping from http.cookies import CookieError, Morsel, SimpleCookie -from typing import Mapping, Union +from typing import Union from aiohttp import ClientConnectionError, ClientResponse, CookieJar, RequestInfo, hdrs, streams from aiohttp.helpers import strip_auth_from_url