-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support python 3.11 and aiohttp 3.8 #224
Support python 3.11 and aiohttp 3.8 #224
Conversation
Commit adfb650 removed support for aiohttp 2.x and Python 3.5 but there are still some remnants of these left. We get rid of them. This also removes one `mypy` warning: > compat.py:31: error: All conditional function variants must have identical signatures [misc]
We no longer run tests against aiohttp 2.x so we don't need it in `tox.ini`.
A couple places in README files should also be updated but this is covered by #223 |
2ce038c
to
afd9bf9
Compare
I needed a few attempts but it seems that all test combinations are finally passing. |
aioresponses works with Python 3.10 with no issues so we update the package metadata to say that, and we update the list of test environments to include Python 3.10.
aioresponses works with aiohttp 3.8 so we extend the list of test environments to include this version.
But the coverage report tells that there's some dead code. Let me fix that as well. |
afd9bf9
to
1c7d946
Compare
We cannot run tests with Python 3.10 using Pytest 6.x due to [1]. This is fixed in Pytest 7.x but Pytest 7.x no longer supports Python 3.6 which aioresponses tries to support. However because Python 3.6 is already past the EOL date, the simplest solution is to no longer test with Python 3.6 and to stop declaring support for that version. [1] pytest-dev/pytest#8546
Our tests are filing on Python 3.10 due to [1] so we update Pytest in `requirements-dev.txt` to the latest version. [1] pytest-dev/pytest#8546
aiohttp 3.6 and older use Python features which were removed in Python 3.10: assert port is not None > hosts = await asyncio.shield(self._resolve_host( host, port, traces=traces), loop=self._loop) E TypeError: shield() got an unexpected keyword argument 'loop' .tox/py3.10-aiohttp35/lib/python3.10/site-packages/aiohttp/connector.py:952: TypeError To avoid test failures, we remove unsupported combinations from GitHub workflows.
aiohttp 3.2.x and older don't work on Python 3.7 and because we now require Python 3.7+, we can drop support for aiohttp 3.0, 3.1, and 3.2.
Codecov ReportBase: 96.50% // Head: 96.68% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #224 +/- ##
==========================================
+ Coverage 96.50% 96.68% +0.18%
==========================================
Files 3 3
Lines 343 332 -11
==========================================
- Hits 331 321 -10
+ Misses 12 11 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
1c7d946
to
d946dcb
Compare
Wow, a lot of work was done :) |
Looking forward to seeing this get merged! 🎉 |
Things changed a but since I created this PR. I will add conflict resolution and support for 3.11. |
…pport-python-3.10-and-aiohttp-3.8
aioresponses works with Python 3.11 with no issues so we update the package metadata to say that, and we update the list of test environments to include Python 3.11. Python 3.11 is supported by aiohttp starting from its v3.8 ([1]), and we also need newer `yarl` ([2]). [1] aio-libs/aiohttp#6600 [2] aio-libs/yarl#706
@pnuckowski This PR is ready now |
@pnuckowski bump! |
@@ -5,6 +5,7 @@ | |||
from urllib.parse import parse_qsl, urlencode | |||
|
|||
from aiohttp import __version__ as aiohttp_version, StreamReader | |||
from aiohttp.client_proto import ResponseHandler | |||
from multidict import MultiDict | |||
from pkg_resources import parse_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package throws the following warning when running locally
DeprecationWarning: pkg_resources is deprecated as an API
The official documentation suggests the use of importlib.resources, importlib.metadata as a replacement. More info here: https://setuptools.pypa.io/en/stable/pkg_resources.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All that's being used here is parse_version
with literal version strings. I'd suggest packaging.version.parse
instead of anything from importlib
.
@pnuckowski Is anything else blocking this from being merged and released? I got bit by this today and the PR has been sitting for a long time now.
Failing that, does anyone know of a fork that includes Python 3.11 support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brettdh I'm wondering the same thing :-S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that all unit tests pass in Python 3.11.4 after changing this line (and one other like it, in tests/test_aioresponses.py
) to this:
from packaging.version import parse as parse_version
Using a private fork for now, but hoping that can get fixed, merged, and released soon.
@pnuckowski Thank you! 💪 |
I was very confused about:
and then I realised that my aioresponses virtualenv also includes @pnuckowski Thanks for the quick response and for merging! Looking forward to a new release. |
Er, whoops; celebrated too soon. The
This is with aioresponses installed from |
The workaround is to install the |
@iamibi Thanks; that works for now. |
Remove remnants of aiohttp 2.x and Python 3.5 support
Commit adfb650 removed support for aiohttp 2.x and Python
3.5 but there are still some remnants of these left. We get rid of them.
This also removes one
mypy
warning:Add type annotation for stream_reader_factory
Remove aiohttp 2.x from tox.ini
We no longer run tests against aiohttp 2.x so we don't need it in
tox.ini
.Add Python 3.10 support
aioresponses works with Python 3.10 with no issues so we update the
package metadata to say that, and we update the list of test
environments to include Python 3.10.
Add tests against aiohttp 3.8
aioresponses works with aiohttp 3.8 so we extend the list of test
environments to include this version.
Add Python 3.10 tests to GitHub workflows
Add tests against aiohttp 3.8 to GitHub workflows
Drop Python 3.6 support
We cannot run tests with Python 3.10 using Pytest 6.x due to [1]. This
is fixed in Pytest 7.x but Pytest 7.x no longer supports Python 3.6
which aioresponses tries to support. However because Python 3.6 is
already past the EOL date, the simplest solution is to no longer test
with Python 3.6 and to stop declaring support for that version.
[1] pytest-dev/pytest#8546
Update Pytest to the latest version to fix tests on Python 3.10
Our tests are filing on Python 3.10 due to [1] so we update Pytest in
requirements-dev.txt
to the latest version.[1] pytest-dev/pytest#8546
Don't test with aiohttp 3.6 and older on Python 3.10
aiohttp 3.6 and older use Python features which were removed in Python
3.10:
To avoid test failures, we remove unsupported combinations from GitHub
workflows.
Drop support for aiohttp 3.2.x and older
aiohttp 3.2.x and older don't work on Python 3.7 and because we now
require Python 3.7+, we can drop support for aiohttp 3.0, 3.1, and 3.2.
Merge remote-tracking branch 'pnuckowski/aioresponses/master' into support-python-3.10-and-aiohttp-3.8
Add Python 3.11 support
aioresponses works with Python 3.11 with no issues so we update the
package metadata to say that, and we update the list of test
environments to include Python 3.11. Python 3.11 is supported by aiohttp
starting from its v3.8 ([1]), and we also need newer
yarl
([2]).[1] aio-libs/aiohttp#6600
[2] aio-libs/yarl#706