From 929bf75fb401b5760e9d45352301c708a4062b1a Mon Sep 17 00:00:00 2001 From: John Litborn <11260241+jakkdl@users.noreply.github.com> Date: Wed, 27 Sep 2023 01:01:51 +0200 Subject: [PATCH 1/4] conditionally require exceptiongroup (#183) also: add python 3.12 and pypy3.9, 3.10 to CI --- .github/workflows/ci.yml | 8 +++++--- requirements-dev.txt | 2 +- setup.py | 3 ++- trio_websocket/_impl.py | 7 +++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0e5cf6..351f146 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,13 +6,15 @@ on: - master pull_request: +# pylint crashes on 3.12 due to https://github.com/pylint-dev/astroid/issues/2201 +# see https://github.com/pylint-dev/pylint/issues/8782 jobs: build_and_test_pinned: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 @@ -52,7 +54,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['pypy-3.7'] + python-version: ['pypy-3.9','pypy-3.10'] steps: - uses: actions/checkout@v3 @@ -70,7 +72,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.12-dev'] steps: - uses: actions/checkout@v3 - name: Setup Python diff --git a/requirements-dev.txt b/requirements-dev.txt index fe59300..78917ab 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -20,7 +20,7 @@ click==8.1.3 # via pip-tools coverage[toml]==7.2.1 # via pytest-cov -cryptography==39.0.2 +cryptography==41.0.4 # via trustme exceptiongroup==1.1.0 # via diff --git a/setup.py b/setup.py index bf1dd43..a5040a6 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], @@ -40,7 +41,7 @@ keywords='websocket client server trio', packages=find_packages(exclude=['docs', 'examples', 'tests']), install_requires=[ - 'exceptiongroup', + 'exceptiongroup; python_version<"3.11"', 'trio>=0.11', 'wsproto>=0.14', ], diff --git a/trio_websocket/_impl.py b/trio_websocket/_impl.py index 6521b90..259f4fd 100644 --- a/trio_websocket/_impl.py +++ b/trio_websocket/_impl.py @@ -13,7 +13,6 @@ import trio import trio.abc -from exceptiongroup import BaseExceptionGroup from wsproto import ConnectionType, WSConnection from wsproto.connection import ConnectionState import wsproto.frame_protocol as wsframeproto @@ -30,6 +29,10 @@ ) import wsproto.utilities +if sys.version_info < (3, 11): # pragma: no cover + # pylint doesn't care about the version_info check, so need to ignore the warning + from exceptiongroup import BaseExceptionGroup # pylint: disable=redefined-builtin + _TRIO_MULTI_ERROR = tuple(map(int, trio.__version__.split('.')[:2])) < (0, 22) CONN_TIMEOUT = 60 # default connect & disconnect timeout, in seconds @@ -65,7 +68,7 @@ def __exit__(self, ty, value, tb): if value is None or not self._armed: return False - if _TRIO_MULTI_ERROR: + if _TRIO_MULTI_ERROR: # pragma: no cover filtered_exception = trio.MultiError.filter(_ignore_cancel, value) # pylint: disable=no-member elif isinstance(value, BaseExceptionGroup): filtered_exception = value.subgroup(lambda exc: not isinstance(exc, trio.Cancelled)) From b263098d029aeac3072e1bc20f09f0a15f5bee41 Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Tue, 26 Sep 2023 16:09:56 -0700 Subject: [PATCH 2/4] version 0.11.1 --- CHANGELOG.md | 4 ++++ trio_websocket/_version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4830eca..aed5273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release history +## trio-websocket 0.11.1 (2023-09-26) +### Changed +- remove exceptiongroup dependency for Python >= 3.11 + ## trio-websocket 0.10.4 (2023-09-06) ### Fixed - fix client hang when connection lost just after remote closes diff --git a/trio_websocket/_version.py b/trio_websocket/_version.py index d1109e1..ae4865c 100644 --- a/trio_websocket/_version.py +++ b/trio_websocket/_version.py @@ -1 +1 @@ -__version__ = '0.11.0-dev' +__version__ = '0.11.1' From e1722218464fcb9b4f87fcff749edc71f7d405a5 Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Tue, 26 Sep 2023 16:26:29 -0700 Subject: [PATCH 3/4] version 0.12.0-dev --- trio_websocket/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trio_websocket/_version.py b/trio_websocket/_version.py index ae4865c..2320701 100644 --- a/trio_websocket/_version.py +++ b/trio_websocket/_version.py @@ -1 +1 @@ -__version__ = '0.11.1' +__version__ = '0.12.0-dev' From 52ce3462a59b669d8c9524314699dbf27591271f Mon Sep 17 00:00:00 2001 From: John Belmonte Date: Wed, 27 Sep 2023 13:17:42 -0700 Subject: [PATCH 4/4] upgrade dev dependencies, support lint under python 3.12 upgrade pip-tools, pytest, pylint --- .github/workflows/ci.yml | 7 ++++--- requirements-dev-full.txt | 36 +++++++++++------------------------- requirements-dev.txt | 22 +++++----------------- 3 files changed, 20 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 351f146..3e88af2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,15 +6,15 @@ on: - master pull_request: -# pylint crashes on 3.12 due to https://github.com/pylint-dev/astroid/issues/2201 -# see https://github.com/pylint-dev/pylint/issues/8782 jobs: build_and_test_pinned: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + # latest pylint/astroid doesn't support 3.7 + # python3.7 is covered in build_and_test_old_deps + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12-dev'] steps: - uses: actions/checkout@v3 @@ -68,6 +68,7 @@ jobs: - run: make test build_and_test_latest: + # use latest package versions meeting .in requirements runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/requirements-dev-full.txt b/requirements-dev-full.txt index 6dd9063..6ad3f76 100644 --- a/requirements-dev-full.txt +++ b/requirements-dev-full.txt @@ -1,12 +1,12 @@ # -# This file is autogenerated by pip-compile with Python 3.7 +# This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --output-file=requirements-dev-full.txt requirements-dev.in requirements-extras.in setup.py # alabaster==0.7.13 # via sphinx -astroid==2.15.0 +astroid==3.0.0 # via pylint async-generator==1.10 # via trio @@ -14,7 +14,6 @@ attrs==22.2.0 # via # -r requirements-dev.in # outcome - # pytest # trio babel==2.12.1 # via sphinx @@ -34,14 +33,14 @@ coverage[toml]==7.2.1 # via pytest-cov cryptography==39.0.2 # via trustme -dill==0.3.6 +dill==0.3.7 # via pylint docutils==0.18.1 # via # readme-renderer # sphinx # sphinx-rtd-theme -exceptiongroup==1.1.0 +exceptiongroup==1.1.3 ; python_version < "3.11" # via # pytest # trio @@ -57,14 +56,10 @@ imagesize==1.4.1 # via sphinx importlib-metadata==6.0.0 # via - # build - # click # keyring - # pluggy - # pytest # sphinx # twine -importlib-resources==5.12.0 +importlib-resources==6.1.0 # via keyring iniconfig==2.0.0 # via pytest @@ -76,8 +71,6 @@ jinja2==3.1.2 # via sphinx keyring==23.13.1 # via twine -lazy-object-proxy==1.9.0 - # via astroid markdown-it-py==2.2.0 # via rich markupsafe==2.1.2 @@ -97,7 +90,7 @@ packaging==23.0 # build # pytest # sphinx -pip-tools==6.12.3 +pip-tools==6.14.0 # via -r requirements-dev.in pkginfo==1.9.6 # via twine @@ -112,11 +105,11 @@ pygments==2.14.0 # readme-renderer # rich # sphinx -pylint==2.17.0 +pylint==3.0.0a7 # via -r requirements-extras.in pyproject-hooks==1.0.0 # via build -pytest==7.2.2 +pytest==7.4.2 # via # -r requirements-dev.in # pytest-cov @@ -125,7 +118,7 @@ pytest-cov==4.0.0 # via -r requirements-dev.in pytest-trio==0.8.0 # via -r requirements-dev.in -pytz==2022.7.1 +pytz==2023.3.post1 # via babel readme-renderer==37.3 # via twine @@ -175,6 +168,7 @@ tomli==2.0.1 # via # build # coverage + # pip-tools # pylint # pyproject-hooks # pytest @@ -188,15 +182,9 @@ trustme==0.9.0 # via -r requirements-dev.in twine==4.0.2 # via -r requirements-extras.in -typed-ast==1.5.4 - # via astroid -typing-extensions==4.5.0 +typing-extensions==4.8.0 # via # astroid - # h11 - # importlib-metadata - # markdown-it-py - # platformdirs # pylint # rich urllib3==1.26.15 @@ -207,8 +195,6 @@ webencodings==0.5.1 # via bleach wheel==0.38.4 # via pip-tools -wrapt==1.15.0 - # via astroid wsproto==1.2.0 # via trio-websocket (setup.py) zipp==3.15.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 78917ab..4ad6a84 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.7 +# This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --output-file=requirements-dev.txt requirements-dev.in setup.py @@ -10,7 +10,6 @@ attrs==22.2.0 # via # -r requirements-dev.in # outcome - # pytest # trio build==0.10.0 # via pip-tools @@ -22,7 +21,7 @@ coverage[toml]==7.2.1 # via pytest-cov cryptography==41.0.4 # via trustme -exceptiongroup==1.1.0 +exceptiongroup==1.1.3 ; python_version < "3.11" # via # pytest # trio @@ -33,12 +32,6 @@ idna==3.4 # via # trio # trustme -importlib-metadata==6.0.0 - # via - # build - # click - # pluggy - # pytest iniconfig==2.0.0 # via pytest outcome==1.2.0 @@ -49,7 +42,7 @@ packaging==23.0 # via # build # pytest -pip-tools==6.12.3 +pip-tools==6.14.0 # via -r requirements-dev.in pluggy==1.0.0 # via pytest @@ -57,7 +50,7 @@ pycparser==2.21 # via cffi pyproject-hooks==1.0.0 # via build -pytest==7.2.2 +pytest==7.4.2 # via # -r requirements-dev.in # pytest-cov @@ -74,6 +67,7 @@ tomli==2.0.1 # via # build # coverage + # pip-tools # pyproject-hooks # pytest trio==0.22.0 @@ -82,16 +76,10 @@ trio==0.22.0 # trio-websocket (setup.py) trustme==0.9.0 # via -r requirements-dev.in -typing-extensions==4.5.0 - # via - # h11 - # importlib-metadata wheel==0.38.4 # via pip-tools wsproto==1.2.0 # via trio-websocket (setup.py) -zipp==3.15.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip