Repository: aio-libs/aiohttp

Issue:
[TODO] Finish wiping the attrs usage
### Describe the bug

Originally, @asvetlov intended to delete any use of `attrs` from aiohttp 4.0+ series via https://github.com/aio-libs/aiohttp/pull/5284. He dropped it from the runtime deps too.

But there are some places that still rely on `attrs` meaning that this will cause failures in runtime because of the missing dep. The tests currently succeed because attrs is listed as a test dep.

One place where it's used is https://github.com/aio-libs/aiohttp/blob/4d58400477331704132cc9427d66699e5815ee25/aiohttp/web_protocol.py#L23.

### To Reproduce

pip install the recent master w/o the test deps and it should fail

### Expected behavior

aiohttp shouldn't rely on deps not declared in the metadata.

### Logs/tracebacks

```python-traceback
N/A
```


### Python Version

```console
$ python --version
```


### aiohttp Version

```console
$ python -m pip show aiohttp
```


### multidict Version

```console
$ python -m pip show multidict
```


### yarl Version

```console
$ python -m pip show yarl
```


### OS

N/A

### Related component

Server

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow the aio-libs Code of Conduct


Discussion:
A small side task here would be to add flake8-requirements, which will help ensure we don't have undeclared dependencies.
> A small side task here would be to add flake8-requirements, which will help ensure we don't have undeclared dependencies.

hey there, im new to git hub and beginner at coding too so.... can you please elaborate, thanks in advance
> > A small side task here would be to add flake8-requirements, which will help ensure we don't have undeclared dependencies.
> 
> hey there, im new to git hub and beginner at coding too so.... can you please elaborate, thanks in advance

Well, probably just need to add flake8-requirements to requirements/lint.txt (and add a line in `.flake8` pointing to requirements/base.txt, similar to https://github.com/aio-libs/aiohttp-session/blob/master/.flake8#L23).
But, obviously it will need the attrs stuff removed first, otherwise it will give an error. There could be other things we haven't noticed as well.
> Well, probably just need to add flake8-requirements to requirements/lint.txt

Nobody should manually edit pin constraint files managed by `pip-tools`. They should instead add direct deps to the corresponding `.in` files and regenerate the pins from that.

Resolving patch:
diff --git a/aiohttp/client.py b/aiohttp/client.py
--- a/aiohttp/client.py
+++ b/aiohttp/client.py
@@ -154,7 +154,7 @@ class ClientTimeout:
 
     # to create a timeout specific for a single request, either
     # - create a completely new one to overwrite the default
-    # - or use http://www.attrs.org/en/stable/api.html#attr.evolve
+    # - or use https://docs.python.org/3/library/dataclasses.html#dataclasses.replace
     # to overwrite the defaults
 
 
diff --git a/aiohttp/web_protocol.py b/aiohttp/web_protocol.py
--- a/aiohttp/web_protocol.py
+++ b/aiohttp/web_protocol.py
@@ -1,5 +1,6 @@
 import asyncio
 import asyncio.streams
+import dataclasses
 import traceback
 from collections import deque
 from contextlib import suppress
@@ -20,7 +21,6 @@
     cast,
 )
 
-import attr
 import yarl
 
 from .abc import AbstractAccessLogger, AbstractAsyncAccessLogger, AbstractStreamWriter
@@ -105,7 +105,7 @@ async def log(
         self.access_logger.log(request, response, self._loop.time() - request_start)
 
 
-@attr.s(auto_attribs=True, frozen=True, slots=True)
+@dataclasses.dataclass(frozen=True)
 class _ErrInfo:
     status: int
     exc: BaseException


Test patch:
diff --git a/tests/autobahn/Dockerfile.aiohttp b/tests/autobahn/Dockerfile.aiohttp
--- a/tests/autobahn/Dockerfile.aiohttp
+++ b/tests/autobahn/Dockerfile.aiohttp
@@ -5,13 +5,3 @@ COPY ./ /src
 WORKDIR /src
 
 RUN pip install .
-# NOTE: The attrs lib is necessary because it's
-# NOTE: still a de-facto runtime dependency of
-# NOTE: aiohttp. Although it shouldn't be anymore
-# NOTE: after the effort to get rid of it.
-# NOTE: It must be removed once made redundant.
-# Refs:
-# * https://github.com/aio-libs/aiohttp/issues/5806
-# * https://github.com/aio-libs/aiohttp/pull/5679/files#r654428147
-# * https://github.com/aio-libs/aiohttp/pull/5284
-RUN pip install attrs