From b46bff0d2bea20406ac9a32495ae2fa37e94960e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 12:26:45 -0500 Subject: [PATCH 01/15] Migrate to using propcache for property caching https://github.com/aio-libs/yarl/pull/1070#discussion_r1784654941 --- aiohttp/_helpers.pyi | 6 ---- aiohttp/_helpers.pyx | 35 ----------------------- aiohttp/helpers.py | 47 ------------------------------ requirements/runtime-deps.in | 1 + setup.cfg | 1 + tests/test_helpers.py | 55 +----------------------------------- 6 files changed, 3 insertions(+), 142 deletions(-) delete mode 100644 aiohttp/_helpers.pyi delete mode 100644 aiohttp/_helpers.pyx diff --git a/aiohttp/_helpers.pyi b/aiohttp/_helpers.pyi deleted file mode 100644 index 1e358937024..00000000000 --- a/aiohttp/_helpers.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import Any - -class reify: - def __init__(self, wrapped: Any) -> None: ... - def __get__(self, inst: Any, owner: Any) -> Any: ... - def __set__(self, inst: Any, value: Any) -> None: ... diff --git a/aiohttp/_helpers.pyx b/aiohttp/_helpers.pyx deleted file mode 100644 index 5f089225dc8..00000000000 --- a/aiohttp/_helpers.pyx +++ /dev/null @@ -1,35 +0,0 @@ - -cdef _sentinel = object() - -cdef class reify: - """Use as a class method decorator. It operates almost exactly like - the Python `@property` decorator, but it puts the result of the - method it decorates into the instance dict after the first call, - effectively replacing the function it decorates with an instance - variable. It is, in Python parlance, a data descriptor. - - """ - - cdef object wrapped - cdef object name - - def __init__(self, wrapped): - self.wrapped = wrapped - self.name = wrapped.__name__ - - @property - def __doc__(self): - return self.wrapped.__doc__ - - def __get__(self, inst, owner): - if inst is None: - return self - cdef dict cache = inst._cache - val = cache.get(self.name, _sentinel) - if val is _sentinel: - val = self.wrapped(inst) - cache[self.name] = val - return val - - def __set__(self, inst, value): - raise AttributeError("reified property is read-only") diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index ec67abf5ebf..80d6babc126 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -440,53 +440,6 @@ def is_expected_content_type( return expected_content_type in response_content_type -class _TSelf(Protocol, Generic[_T]): - _cache: Dict[str, _T] - - -class reify(Generic[_T]): - """Use as a class method decorator. - - It operates almost exactly like - the Python `@property` decorator, but it puts the result of the - method it decorates into the instance dict after the first call, - effectively replacing the function it decorates with an instance - variable. It is, in Python parlance, a data descriptor. - """ - - def __init__(self, wrapped: Callable[..., _T]) -> None: - self.wrapped = wrapped - self.__doc__ = wrapped.__doc__ - self.name = wrapped.__name__ - - def __get__(self, inst: _TSelf[_T], owner: Optional[Type[Any]] = None) -> _T: - try: - try: - return inst._cache[self.name] - except KeyError: - val = self.wrapped(inst) - inst._cache[self.name] = val - return val - except AttributeError: - if inst is None: - return self - raise - - def __set__(self, inst: _TSelf[_T], value: _T) -> None: - raise AttributeError("reified property is read-only") - - -reify_py = reify - -try: - from ._helpers import reify as reify_c - - if not NO_EXTENSIONS: - reify = reify_c # type: ignore[misc,assignment] -except ImportError: - pass - - def is_ip_address(host: Optional[str]) -> bool: """Check if host looks like an IP Address. diff --git a/requirements/runtime-deps.in b/requirements/runtime-deps.in index 269118d5cb8..7c5aa7867f3 100644 --- a/requirements/runtime-deps.in +++ b/requirements/runtime-deps.in @@ -8,4 +8,5 @@ Brotli; platform_python_implementation == 'CPython' brotlicffi; platform_python_implementation != 'CPython' frozenlist >= 1.1.1 multidict >=4.5, < 7.0 +propcache >= 0.0.0 yarl >= 1.13.0, < 2.0 diff --git a/setup.cfg b/setup.cfg index af021dc2877..f5ac7d54b05 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,6 +54,7 @@ install_requires = async-timeout >= 4.0, < 5.0 ; python_version < "3.11" frozenlist >= 1.1.1 multidict >=4.5, < 7.0 + propcache >= 0.0.0 yarl >= 1.13.0, < 2.0 [options.exclude_package_data] diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 9da3565acd9..668af54bd1f 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -7,7 +7,7 @@ import weakref from math import ceil, modf from pathlib import Path -from typing import Any, Dict, Iterator, Optional, Type, Union +from typing import Dict, Iterator, Optional, Union from unittest import mock from urllib.request import getproxies_environment # type: ignore[attr-defined] @@ -227,59 +227,6 @@ def test_basic_auth_from_not_url() -> None: helpers.BasicAuth.from_url("http://user:pass@example.com") # type: ignore[arg-type] -class ReifyMixin: - reify: Type["helpers.reify[Any]"] - - def test_reify(self) -> None: - class A: - def __init__(self) -> None: - self._cache: Dict[str, str] = {} - - @self.reify # type: ignore[misc] - def prop(self) -> int: - return 1 - - a = A() - assert 1 == a.prop - - def test_reify_class(self) -> None: - class A: - def __init__(self) -> None: - self._cache: Dict[str, str] = {} - - @self.reify # type: ignore[misc] - def prop(self) -> int: - """Docstring.""" - return 1 - - assert isinstance(A.prop, self.reify) # type: ignore[arg-type] - assert "Docstring." == A.prop.__doc__ # type: ignore[arg-type] - - def test_reify_assignment(self) -> None: - class A: - def __init__(self) -> None: - self._cache: Dict[str, str] = {} - - @self.reify # type: ignore[misc] - def prop(self) -> int: - return 1 - - a = A() - - with pytest.raises(AttributeError): - a.prop = 123 - - -class TestPyReify(ReifyMixin): - reify = helpers.reify_py - - -if not helpers.NO_EXTENSIONS and not IS_PYPY and hasattr(helpers, "reify_c"): - - class TestCReify(ReifyMixin): - reify = helpers.reify_c # type: ignore[attr-defined,assignment] - - # ----------------------------------- is_ip_address() ---------------------- From 032c328aaf4aede946af9dd68936df944c2ac2fa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 12:33:27 -0500 Subject: [PATCH 02/15] update txt --- requirements/base.txt | 2 ++ requirements/constraints.txt | 8 +++++--- requirements/cython.txt | 4 ++-- requirements/dev.txt | 8 +++++--- requirements/doc.txt | 6 +++--- requirements/lint.txt | 2 +- requirements/runtime-deps.txt | 2 ++ 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index ead3ffeaea2..2f2770cfd2e 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -30,6 +30,8 @@ multidict==6.1.0 # yarl packaging==24.1 # via gunicorn +propcache==0.0.0 + # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns pycparser==2.22 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 2bdf4edf4e5..1744a6a0a0c 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # -# pip-compile --allow-unsafe --output-file=requirements/constraints.txt --resolver=backtracking --strip-extras requirements/constraints.in +# pip-compile --allow-unsafe --output-file=requirements/constraints.txt --strip-extras requirements/constraints.in # aiodns==3.2.0 ; sys_platform == "linux" or sys_platform == "darwin" # via @@ -134,6 +134,8 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in +propcache==0.0.0 + # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via # -r requirements/lint.in diff --git a/requirements/cython.txt b/requirements/cython.txt index f67cc903a0b..51f1dbc12ac 100644 --- a/requirements/cython.txt +++ b/requirements/cython.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with Python 3.8 # by the following command: # -# pip-compile --allow-unsafe --output-file=requirements/cython.txt --resolver=backtracking --strip-extras requirements/cython.in +# pip-compile --allow-unsafe --output-file=requirements/cython.txt --strip-extras requirements/cython.in # cython==3.0.11 # via -r requirements/cython.in diff --git a/requirements/dev.txt b/requirements/dev.txt index f4792cf2c0a..3e0edf842ce 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # -# pip-compile --allow-unsafe --output-file=requirements/dev.txt --resolver=backtracking --strip-extras requirements/dev.in +# pip-compile --allow-unsafe --output-file=requirements/dev.txt --strip-extras requirements/dev.in # aiodns==3.2.0 ; sys_platform == "linux" or sys_platform == "darwin" # via @@ -131,6 +131,8 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in +propcache==0.0.0 + # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via # -r requirements/lint.in diff --git a/requirements/doc.txt b/requirements/doc.txt index 6f034d9d30d..f5315fae2c5 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # -# pip-compile --allow-unsafe --output-file=requirements/doc.txt --resolver=backtracking --strip-extras requirements/doc.in +# pip-compile --allow-unsafe --output-file=requirements/doc.txt --strip-extras requirements/doc.in # aiohttp-theme==0.1.7 # via -r requirements/doc.in diff --git a/requirements/lint.txt b/requirements/lint.txt index 03ad50c89ee..02128408ec2 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with Python 3.8 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/lint.txt --strip-extras requirements/lint.in diff --git a/requirements/runtime-deps.txt b/requirements/runtime-deps.txt index 777c7f19354..70fb877dfb6 100644 --- a/requirements/runtime-deps.txt +++ b/requirements/runtime-deps.txt @@ -26,6 +26,8 @@ multidict==6.1.0 # via # -r requirements/runtime-deps.in # yarl +propcache==0.0.0 + # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns pycparser==2.22 From aa988cb0bc8520eded84bff2be9c84950f6d5fd3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 12:41:00 -0500 Subject: [PATCH 03/15] fix typing --- aiohttp/helpers.py | 3 ++- tests/test_helpers.py | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 80d6babc126..92ab7356bbe 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -49,6 +49,7 @@ from urllib.request import getproxies, proxy_bypass from multidict import CIMultiDict, MultiDict, MultiDictProxy, MultiMapping +from propcache import under_cached_property as reify from yarl import URL from . import hdrs @@ -60,7 +61,7 @@ else: import async_timeout -__all__ = ("BasicAuth", "ChainMapProxy", "ETag") +__all__ = ("BasicAuth", "ChainMapProxy", "ETag", "reify") PY_310 = sys.version_info >= (3, 10) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 668af54bd1f..27de7174b27 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -2,7 +2,6 @@ import base64 import datetime import gc -import platform import sys import weakref from math import ceil, modf @@ -24,9 +23,6 @@ should_remove_content_length, ) -IS_PYPY = platform.python_implementation() == "PyPy" - - # ------------------- parse_mimetype ---------------------------------- From cf165ac8e82ab8f9bd30cb1fd9d1011617cf2b5b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 12:43:04 -0500 Subject: [PATCH 04/15] Apply suggestions from code review --- requirements/constraints.txt | 6 +++--- requirements/cython.txt | 4 ++-- requirements/dev.txt | 6 +++--- requirements/doc.txt | 6 +++--- requirements/lint.txt | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 1744a6a0a0c..f8e67c11f3c 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: # -# pip-compile --allow-unsafe --output-file=requirements/constraints.txt --strip-extras requirements/constraints.in +# pip-compile --allow-unsafe --output-file=requirements/constraints.txt --resolver=backtracking --strip-extras requirements/constraints.in # aiodns==3.2.0 ; sys_platform == "linux" or sys_platform == "darwin" # via diff --git a/requirements/cython.txt b/requirements/cython.txt index 51f1dbc12ac..f67cc903a0b 100644 --- a/requirements/cython.txt +++ b/requirements/cython.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with python 3.8 # by the following command: # -# pip-compile --allow-unsafe --output-file=requirements/cython.txt --strip-extras requirements/cython.in +# pip-compile --allow-unsafe --output-file=requirements/cython.txt --resolver=backtracking --strip-extras requirements/cython.in # cython==3.0.11 # via -r requirements/cython.in diff --git a/requirements/dev.txt b/requirements/dev.txt index 3e0edf842ce..646a4c4d628 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: # -# pip-compile --allow-unsafe --output-file=requirements/dev.txt --strip-extras requirements/dev.in +# pip-compile --allow-unsafe --output-file=requirements/dev.txt --resolver=backtracking --strip-extras requirements/dev.in # aiodns==3.2.0 ; sys_platform == "linux" or sys_platform == "darwin" # via diff --git a/requirements/doc.txt b/requirements/doc.txt index f5315fae2c5..6f034d9d30d 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,8 +1,8 @@ # -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: # -# pip-compile --allow-unsafe --output-file=requirements/doc.txt --strip-extras requirements/doc.in +# pip-compile --allow-unsafe --output-file=requirements/doc.txt --resolver=backtracking --strip-extras requirements/doc.in # aiohttp-theme==0.1.7 # via -r requirements/doc.in diff --git a/requirements/lint.txt b/requirements/lint.txt index 02128408ec2..03ad50c89ee 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with python 3.8 # by the following command: # # pip-compile --allow-unsafe --output-file=requirements/lint.txt --strip-extras requirements/lint.in From 773acaa977dcfaae1066b686e9d057a145d1bac8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 2 Oct 2024 12:46:49 -0500 Subject: [PATCH 05/15] delete more --- .gitignore | 2 -- setup.py | 1 - 2 files changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7d38dd91998..62770ddc80a 100644 --- a/.gitignore +++ b/.gitignore @@ -37,8 +37,6 @@ aiohttp/_find_header.c aiohttp/_headers.html aiohttp/_headers.pxi -aiohttp/_helpers.c -aiohttp/_helpers.html aiohttp/_http_parser.c aiohttp/_http_parser.html aiohttp/_http_writer.c diff --git a/setup.py b/setup.py index ce38273c573..cc66fe214ca 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,6 @@ define_macros=[("LLHTTP_STRICT_MODE", 0)], include_dirs=["vendor/llhttp/build"], ), - Extension("aiohttp._helpers", ["aiohttp/_helpers.c"]), Extension("aiohttp._http_writer", ["aiohttp/_http_writer.c"]), ] From 1af7229f7cf7c6162432f2324116376a12b853f8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Oct 2024 17:54:52 -0500 Subject: [PATCH 06/15] changelog --- CHANGES/9394.packaging.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CHANGES/9394.packaging.rst diff --git a/CHANGES/9394.packaging.rst b/CHANGES/9394.packaging.rst new file mode 100644 index 00000000000..232442889cf --- /dev/null +++ b/CHANGES/9394.packaging.rst @@ -0,0 +1,3 @@ +Switched to using the ``propcache`` package for property caching -- by :user:`bdraco`. + +The ``propcache `` package is derived from the property caching code in ``yarl`` and has been broken out to avoid maintaining it for multiple projects. From 5548b9e66320f90ff32e78b7a26532b0671f3a32 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Oct 2024 17:56:07 -0500 Subject: [PATCH 07/15] Update CHANGES/9394.packaging.rst --- CHANGES/9394.packaging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES/9394.packaging.rst b/CHANGES/9394.packaging.rst index 232442889cf..a9caac71566 100644 --- a/CHANGES/9394.packaging.rst +++ b/CHANGES/9394.packaging.rst @@ -1,3 +1,3 @@ Switched to using the ``propcache`` package for property caching -- by :user:`bdraco`. -The ``propcache `` package is derived from the property caching code in ``yarl`` and has been broken out to avoid maintaining it for multiple projects. +The ``propcache`` package is derived from the property caching code in ``yarl`` and has been broken out to avoid maintaining it for multiple projects. From 8cb9a502c3114efc88206612e3dc99c557ee9ce5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Oct 2024 17:57:02 -0500 Subject: [PATCH 08/15] bug report --- .github/ISSUE_TEMPLATE/bug_report.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8ae7af0fff5..eb92f768a29 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -86,6 +86,15 @@ body: $ python -m pip show multidict validations: required: true +- type: textarea + attributes: + label: propcache Version + description: Attach your version of propcache. + render: console + value: | + $ python -m pip show propcache + validations: + required: true - type: textarea attributes: label: yarl Version From 12e9b35a36962ba5d22fbf9fb0fa8642c7ba58c6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Oct 2024 21:19:04 -0500 Subject: [PATCH 09/15] Update CHANGES/9394.packaging.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) --- CHANGES/9394.packaging.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES/9394.packaging.rst b/CHANGES/9394.packaging.rst index a9caac71566..456ac0f52c8 100644 --- a/CHANGES/9394.packaging.rst +++ b/CHANGES/9394.packaging.rst @@ -1,3 +1,6 @@ -Switched to using the ``propcache`` package for property caching -- by :user:`bdraco`. +Switched to using the :mod:`propcache ` package for property caching +-- by :user:`bdraco`. -The ``propcache`` package is derived from the property caching code in ``yarl`` and has been broken out to avoid maintaining it for multiple projects. +The :mod:`propcache ` package is derived from the property caching +code in :mod:`yarl` and has been broken out to avoid maintaining it for multiple +projects. From 3a0ce2236ea4deb592286fc5c975fed5621c8982 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Oct 2024 21:20:41 -0500 Subject: [PATCH 10/15] Migrate to propcache 1.0.0 --- aiohttp/helpers.py | 2 +- requirements/base.txt | 2 +- requirements/constraints.txt | 2 +- requirements/dev.txt | 2 +- requirements/runtime-deps.in | 2 +- requirements/runtime-deps.txt | 2 +- setup.cfg | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 92ab7356bbe..55b363003fc 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -49,7 +49,7 @@ from urllib.request import getproxies, proxy_bypass from multidict import CIMultiDict, MultiDict, MultiDictProxy, MultiMapping -from propcache import under_cached_property as reify +from propcache.api import under_cached_property as reify from yarl import URL from . import hdrs diff --git a/requirements/base.txt b/requirements/base.txt index 2f2770cfd2e..b53be2a06da 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -30,7 +30,7 @@ multidict==6.1.0 # yarl packaging==24.1 # via gunicorn -propcache==0.0.0 +propcache==1.0.0 # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns diff --git a/requirements/constraints.txt b/requirements/constraints.txt index f8e67c11f3c..a0059a6f6ba 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -134,7 +134,7 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in -propcache==0.0.0 +propcache==1.0.0 # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via diff --git a/requirements/dev.txt b/requirements/dev.txt index 646a4c4d628..ca45e223b7d 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -131,7 +131,7 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in -propcache==0.0.0 +propcache==1.0.0 # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via diff --git a/requirements/runtime-deps.in b/requirements/runtime-deps.in index 7c5aa7867f3..521608df506 100644 --- a/requirements/runtime-deps.in +++ b/requirements/runtime-deps.in @@ -8,5 +8,5 @@ Brotli; platform_python_implementation == 'CPython' brotlicffi; platform_python_implementation != 'CPython' frozenlist >= 1.1.1 multidict >=4.5, < 7.0 -propcache >= 0.0.0 +propcache >= 1.0.0 yarl >= 1.13.0, < 2.0 diff --git a/requirements/runtime-deps.txt b/requirements/runtime-deps.txt index 70fb877dfb6..22095e2a559 100644 --- a/requirements/runtime-deps.txt +++ b/requirements/runtime-deps.txt @@ -26,7 +26,7 @@ multidict==6.1.0 # via # -r requirements/runtime-deps.in # yarl -propcache==0.0.0 +propcache==1.0.0 # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns diff --git a/setup.cfg b/setup.cfg index f5ac7d54b05..8ffc739e1d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ install_requires = async-timeout >= 4.0, < 5.0 ; python_version < "3.11" frozenlist >= 1.1.1 multidict >=4.5, < 7.0 - propcache >= 0.0.0 + propcache >= 1.0.0 yarl >= 1.13.0, < 2.0 [options.exclude_package_data] From 17039a2aa3e4900690e72ae29156cdf9e903039e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Oct 2024 15:15:51 +0200 Subject: [PATCH 11/15] Fix propcache version to be 0.2.0 --- requirements/base.txt | 2 +- requirements/constraints.txt | 2 +- requirements/dev.txt | 2 +- requirements/runtime-deps.in | 2 +- requirements/runtime-deps.txt | 2 +- setup.cfg | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index b53be2a06da..5d793411e2e 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -30,7 +30,7 @@ multidict==6.1.0 # yarl packaging==24.1 # via gunicorn -propcache==1.0.0 +propcache==0.2.0 # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns diff --git a/requirements/constraints.txt b/requirements/constraints.txt index a0059a6f6ba..1cc5460ba7a 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -134,7 +134,7 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in -propcache==1.0.0 +propcache==0.2.0 # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via diff --git a/requirements/dev.txt b/requirements/dev.txt index ca45e223b7d..8357caaa187 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -131,7 +131,7 @@ pluggy==1.5.0 # via pytest pre-commit==3.5.0 # via -r requirements/lint.in -propcache==1.0.0 +propcache==0.2.0 # via -r requirements/runtime-deps.in proxy-py==2.4.8 # via diff --git a/requirements/runtime-deps.in b/requirements/runtime-deps.in index 521608df506..800420b9130 100644 --- a/requirements/runtime-deps.in +++ b/requirements/runtime-deps.in @@ -8,5 +8,5 @@ Brotli; platform_python_implementation == 'CPython' brotlicffi; platform_python_implementation != 'CPython' frozenlist >= 1.1.1 multidict >=4.5, < 7.0 -propcache >= 1.0.0 +propcache >= 0.2.0 yarl >= 1.13.0, < 2.0 diff --git a/requirements/runtime-deps.txt b/requirements/runtime-deps.txt index 22095e2a559..92c8b131bd0 100644 --- a/requirements/runtime-deps.txt +++ b/requirements/runtime-deps.txt @@ -26,7 +26,7 @@ multidict==6.1.0 # via # -r requirements/runtime-deps.in # yarl -propcache==1.0.0 +propcache==0.2.0 # via -r requirements/runtime-deps.in pycares==4.4.0 # via aiodns diff --git a/setup.cfg b/setup.cfg index 8ffc739e1d8..42ae12855b8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ install_requires = async-timeout >= 4.0, < 5.0 ; python_version < "3.11" frozenlist >= 1.1.1 multidict >=4.5, < 7.0 - propcache >= 1.0.0 + propcache >= 0.2.0 yarl >= 1.13.0, < 2.0 [options.exclude_package_data] From 5f5e459b2b687df6873ed9dfd1640a16776a3616 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Oct 2024 15:18:48 +0200 Subject: [PATCH 12/15] add propcache to intersphinx_mapping --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index c8b41edda44..2deabea1b4f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -74,6 +74,7 @@ "pytest": ("http://docs.pytest.org/en/latest/", None), "python": ("http://docs.python.org/3", None), "multidict": ("https://multidict.readthedocs.io/en/stable/", None), + "propcache": ("https://propcache.aio-libs.org/en/stable", None), "yarl": ("https://yarl.readthedocs.io/en/stable/", None), "aiosignal": ("https://aiosignal.readthedocs.io/en/stable/", None), "aiohttpjinja2": ("https://aiohttp-jinja2.readthedocs.io/en/stable/", None), From 0be9509b582972c4c2757dfea0a2598a2048481b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Oct 2024 22:14:40 +0200 Subject: [PATCH 13/15] Update aiohttp/helpers.py --- aiohttp/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 55b363003fc..093826709b9 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -61,7 +61,7 @@ else: import async_timeout -__all__ = ("BasicAuth", "ChainMapProxy", "ETag", "reify") +__all__ = ("BasicAuth", "ChainMapProxy", "ETag") PY_310 = sys.version_info >= (3, 10) From 9105e7c1cddb09e9e141d0e9989447c43ea8cd67 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Oct 2024 22:16:08 +0200 Subject: [PATCH 14/15] Update aiohttp/helpers.py --- aiohttp/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 093826709b9..39df6cef938 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -49,7 +49,7 @@ from urllib.request import getproxies, proxy_bypass from multidict import CIMultiDict, MultiDict, MultiDictProxy, MultiMapping -from propcache.api import under_cached_property as reify +from propcache.api import under_cached_property as reify # noqa: F401 from yarl import URL from . import hdrs From 3280055094375025355b8fcf4195591fe75b6c97 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 7 Oct 2024 23:17:17 +0200 Subject: [PATCH 15/15] restore reify to __all__ --- aiohttp/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aiohttp/helpers.py b/aiohttp/helpers.py index 39df6cef938..55b363003fc 100644 --- a/aiohttp/helpers.py +++ b/aiohttp/helpers.py @@ -49,7 +49,7 @@ from urllib.request import getproxies, proxy_bypass from multidict import CIMultiDict, MultiDict, MultiDictProxy, MultiMapping -from propcache.api import under_cached_property as reify # noqa: F401 +from propcache.api import under_cached_property as reify from yarl import URL from . import hdrs @@ -61,7 +61,7 @@ else: import async_timeout -__all__ = ("BasicAuth", "ChainMapProxy", "ETag") +__all__ = ("BasicAuth", "ChainMapProxy", "ETag", "reify") PY_310 = sys.version_info >= (3, 10)